awellspringcub.lua 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. --[[
  2. Script Name : Quests/Darklight/awellspringcub.lua
  3. Script Purpose : for the spawn "a wellspring cub" (340061)
  4. Script Author : Cynnar
  5. Script Date : 2/5/2016
  6. Script Notes : <special-instructions>
  7. --]]
  8. local DrawUponWellsprings = 155
  9. function spawn(NPC)
  10. choice = math.random(1, 4)
  11. if choice == 1 then
  12. clockwise1(NPC)
  13. elseif choice == 2 then
  14. clockwise2(NPC)
  15. elseif choice == 3 then
  16. counter_clockwise1(NPC)
  17. elseif choice == 4 then
  18. counter_clockwise2(NPC)
  19. end
  20. end
  21. function respawn(NPC)
  22. spawn(NPC)
  23. end
  24. function casted_on(NPC, Caster, SpellName)
  25. if SpellName == "Leash" then
  26. if GetQuestStep(Caster, DrawUponWellsprings) == 1 then
  27. if GetTempVariable(Caster, "cub") == nil then
  28. SetTempVariable(Caster, "cub", NPC)
  29. SpawnSet(NPC, "attackable", "0")
  30. SpawnSet(NPC, "show_level", "0")
  31. SetFollowTarget(NPC, Caster)
  32. SetSpeed(NPC, 9)
  33. ToggleFollow(NPC)
  34. end
  35. end
  36. end
  37. end
  38. function clockwise1(NPC)
  39. x = GetX(NPC)
  40. y = GetY(NPC)
  41. z = GetZ(NPC)
  42. MovementLoopAddLocation(NPC, x + 7 , y, z - 8 , 1, math.random(5, 15))
  43. MovementLoopAddLocation(NPC, x - 5 , y, z - 10, 1, math.random(5, 15))
  44. MovementLoopAddLocation(NPC, x - 10, y, z + 9 , 1, math.random(5, 15))
  45. MovementLoopAddLocation(NPC, x + 5 , y, z + 8 , 1, math.random(5, 15))
  46. end
  47. function clockwise2(NPC)
  48. x = GetX(NPC)
  49. y = GetY(NPC)
  50. z = GetZ(NPC)
  51. MovementLoopAddLocation(NPC, x + 2 , y, z - 8 , 1, math.random(5, 15))
  52. MovementLoopAddLocation(NPC, x - 7 , y, z - 5 , 1, math.random(5, 15))
  53. MovementLoopAddLocation(NPC, x , y, z + 6 , 1, math.random(5, 15))
  54. MovementLoopAddLocation(NPC, x + 9 , y, z + 1 , 1, math.random(5, 15))
  55. end
  56. function counter_clockwise1(NPC)
  57. x = GetX(NPC)
  58. y = GetY(NPC)
  59. z = GetZ(NPC)
  60. MovementLoopAddLocation(NPC, x - 7 , y, z + 8 , 1, math.random(5, 15))
  61. MovementLoopAddLocation(NPC, x + 5 , y, z + 10, 1, math.random(5, 15))
  62. MovementLoopAddLocation(NPC, x + 10, y, z - 9 , 1, math.random(5, 15))
  63. MovementLoopAddLocation(NPC, x - 5 , y, z - 8 , 1, math.random(5, 15))
  64. end
  65. function counter_clockwise2(NPC)
  66. x = GetX(NPC)
  67. y = GetY(NPC)
  68. z = GetZ(NPC)
  69. MovementLoopAddLocation(NPC, x - 2 , y, z + 8 , 1, math.random(5, 15))
  70. MovementLoopAddLocation(NPC, x + 7 , y, z + 5 , 1, math.random(5, 15))
  71. MovementLoopAddLocation(NPC, x , y, z - 6 , 1, math.random(5, 15))
  72. MovementLoopAddLocation(NPC, x - 9 , y, z - 1 , 1, math.random(5, 15))
  73. end