widgetsmallcup.lua 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. --[[
  2. Script Name : SpawnScripts/Edgewater/widgetsmallcup.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.07.04 08:07:33
  5. Script Purpose :
  6. :
  7. --]]
  8. local CrabMeatHunt = 5285
  9. function spawn(NPC)
  10. SetPlayerProximityFunction(NPC, 10, "InRange", Spawn)
  11. end
  12. function InRange(NPC, Spawn)
  13. if not HasQuest(Spawn, CrabMeatHunt) and not HasCompletedQuest(Spawn, CrabMeatHunt) then
  14. AddPrimaryEntityCommand(Spawn, NPC, "examine cup", 5, "examine cup", "", 100)
  15. SpawnSet(NPC, "show_command_icon", 1)
  16. SpawnSet(NPC, "display_hand_icon", 1)
  17. end
  18. end
  19. function casted_on(NPC, Spawn, SpellName)
  20. if SpellName == 'examine barrel' then
  21. conversation = CreateConversation()
  22. AddConversationOption(conversation, "Look inside", "offer")
  23. AddConversationOption(conversation, "Ignore cup")
  24. StartDialogConversation(conversation, 1, NPC, Spawn, "You find a small cup that appears to have something inside of it.")
  25. SetAccessToEntityCommand(Spawn,NPC,"examine cup", 0)
  26. SpawnSet(NPC, "show_command_icon", 0)
  27. SpawnSet(NPC, "display_hand_icon", 0)
  28. AddTimer(NPC, 10000, "check", 1, Spawn)
  29. end
  30. end
  31. function offer(NPC, Spawn)
  32. OfferQuest(NPC, Spawn, CrabMeatHunt)
  33. conversation = CreateConversation()
  34. AddConversationOption(conversation, "I will hunt crabs")
  35. StartDialogConversation(conversation, 1, NPC, Spawn, "Inside of the cup you find some crab meat. Crab meat sounds pretty good right about now, and at the very least you can always sell what you don't eat.")
  36. end
  37. function check(NPC, Spawn)
  38. if not HasQuest(Spawn, CrabMeatHunt) and not HasCompletedQuest(Spawn, CrabMeatHunt) then
  39. SpawnSet(NPC, "show_command_icon", 1)
  40. SpawnSet(NPC, "display_hand_icon", 1)
  41. SetAccessToEntityCommand(Spawn,NPC,"examine cup", 1)
  42. end
  43. end
  44. function respawn(NPC)
  45. spawn(NPC)
  46. end