widgettrainingdummy.lua 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. --[[
  2. Script Name : SpawnScripts/Edgewater/widgettrainingdummy.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.07.04 09:07:46
  5. Script Purpose :
  6. :
  7. --]]
  8. local ADangerousLesson = 5286
  9. function spawn(NPC)
  10. SetPlayerProximityFunction(NPC, 10, "InRange", Spawn)
  11. end
  12. function InRange(NPC, Spawn)
  13. if not HasQuest(Spawn, ADangerousLesson) and not HasCompletedQuest(Spawn, ADangerousLesson) then
  14. AddPrimaryEntityCommand(Spawn, NPC, "examine dummy", 5, "examine dummy", "", 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 dummy' then
  21. conversation = CreateConversation()
  22. AddConversationOption(conversation, "Read note", "offer")
  23. AddConversationOption(conversation, "Don't read")
  24. StartDialogConversation(conversation, 1, NPC, Spawn, "There is a note pinned to the training dummy.")
  25. SetAccessToEntityCommand(Spawn,NPC,"examine dummy", 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, ADangerousLesson)
  33. conversation = CreateConversation()
  34. AddConversationOption(conversation, "I will kill the toads")
  35. StartDialogConversation(conversation, 1, NPC, Spawn, "The note reads: \"You shouldn't waste your time hitting this down here when there are moving targets you can learn from. Go kill some bile toad foragers for a real lesson!\" ")
  36. end
  37. function check(NPC, Spawn)
  38. if not HasQuest(Spawn, ADangerousLesson) and not HasCompletedQuest(Spawn, ADangerousLesson) then
  39. SpawnSet(NPC, "show_command_icon", 1)
  40. SpawnSet(NPC, "display_hand_icon", 1)
  41. SetAccessToEntityCommand(Spawn,NPC,"examine dummy", 1)
  42. end
  43. end
  44. function respawn(NPC)
  45. spawn(NPC)
  46. end