planter_5.lua 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. --[[
  2. Script Name : SpawnScripts/Castleview/planter_5.lua
  3. Script Purpose : planter_5
  4. Script Author : Scatman
  5. Script Date : 2009.10.02
  6. Script Notes :
  7. --]]
  8. local HIGH_ELF_MENTOR_QUEST_2 = 224
  9. local HIGH_ELF_MENTOR_QUEST_3 = 225
  10. local HIGH_ELF_MENTOR_QUEST_4 = 226
  11. function spawn(NPC)
  12. SetRequiredQuest(NPC, HIGH_ELF_MENTOR_QUEST_2, 5)
  13. SetPlayerProximityFunction(NPC, 10, "InRange2", "LeaveRange")
  14. SetPlayerProximityFunction(NPC, 10, "InRange3", "LeaveRange")
  15. end
  16. function hailed(NPC, Spawn)
  17. end
  18. function respawn(NPC)
  19. spawn(NPC)
  20. end
  21. function casted_on(Target, Caster, SpellName)
  22. if HasQuest(Caster, HIGH_ELF_MENTOR_QUEST_2) and not QuestStepIsComplete(Caster, HIGH_ELF_MENTOR_QUEST_2, 5) and SpellName == "Plant Seeds" then
  23. conversation = CreateConversation()
  24. AddConversationOption(conversation, "Plant the seeds.", "PlantSeeds")
  25. StartDialogConversation(conversation, 1, Target, Caster, "This is one of the planters that Vindain spoke of.")
  26. end
  27. end
  28. function PlantSeeds(NPC, Spawn)
  29. SetStepComplete(Spawn, HIGH_ELF_MENTOR_QUEST_2, 5)
  30. local GreenWisp = SpawnMob(GetZone(Spawn), 2360169, false, 712, -15.4961, -162.534, 200)
  31. local agitated_spirit = SpawnMob(GetZone(Spawn), 2360057, false, 712, -15.4961, -162.534, 200)
  32. if agitated_spirit ~= nil then
  33. AddHate(agitated_spirit, Spawn, 100)
  34. end
  35. Despawn(GreenWisp, 300000)
  36. conversation = CreateConversation()
  37. AddConversationOption(conversation, "Leave the planter.")
  38. StartDialogConversation(conversation, 1, NPC, Spawn, "You place a seed, some soil, and some water into the planter. The Green Wisp plant begins to grow, but then gurgles and pulls itself from the planter!")
  39. end
  40. function InRange2(NPC, Spawn)
  41. Say(NPC, "InRange2")
  42. if HasQuest(Spawn, HIGH_ELF_MENTOR_QUEST_3) and GetQuestStep(Spawn, HIGH_ELF_MENTOR_QUEST_3) == 2 then
  43. Say(NPC, "Passed quest check, spawning shrub")
  44. local corrupted_green_wisp = GetSpawn(Spawn, 2360130)
  45. if corrupted_green_wisp == nil then
  46. corrupted_green_wisp = SpawnMob(GetZone(NPC), 2360130, false, 712.015, -15.4941, -162.501, 200)
  47. Despawn(corrupted_green_wisp, 180000)
  48. end
  49. end
  50. end
  51. function InRange3(NPC, Spawn)
  52. if HasQuest(Spawn, HIGH_ELF_MENTOR_QUEST_4) and GetQuestStep(Spawn, HIGH_ELF_MENTOR_QUEST_4) == 1 then
  53. local Spirit = SpawnMob(GetZone(NPC), 2360059, false, 710.408, -15.5306, -161.493, 200)
  54. Despawn(Spirit, 120000)
  55. end
  56. end
  57. function LeaveRange(NPC, Spawn)
  58. end