9
3

FrenzyRoot2.lua 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. --[[
  2. Script Name : SpawnScripts/Commonlands/FrenzyRoot2.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.04.02 07:04:37
  5. Script Purpose :
  6. Script Notes : NEED TO ADD STOP MOVEMENT LUA FUNCTION, OTHERWISE ORCS ARE MOVING WHILE GATHERING
  7. --]]
  8. local QUEST = 408 -- Orcs of the Ree quest
  9. OrcID = 330128
  10. function spawn(NPC)
  11. SetPlayerProximityFunction(NPC, 50, "SpawnAccess", "SpawnAccess")
  12. AddSpawnAccess(NPC, NPC)
  13. end
  14. function hailed(NPC, Spawn)
  15. FaceTarget(NPC, Spawn)
  16. end
  17. function SpawnAccess(NPC, Spawn)
  18. if HasQuest(Spawn, QUEST) then
  19. AddSpawnAccess(NPC, Spawn)
  20. else
  21. RemoveSpawnAccess(NPC, Spawn)
  22. end
  23. local Orc = GetSpawn(NPC, OrcID)
  24. local OrcDistance = GetDistance(NPC, Orc)
  25. if OrcDistance <= 3 and not HasSpellEffect(Orc, 5468) then
  26. FaceTarget(Orc, NPC)
  27. SpawnSet(Orc, "visual_state", 2809)
  28. AddTimer(NPC, 5000, "progress", 1, Spawn)
  29. if HasSpellEffect(Orc, 5468) then
  30. CastSpell(Spawn, 5468,1, Orc)
  31. end
  32. end
  33. end
  34. function casted_on(NPC, Spawn, SpellName)
  35. if SpellName == 'Pick back up' then
  36. Despawn(NPC)
  37. SummonItem(Spawn, 46427, 1)
  38. end
  39. end
  40. function progress(NPC, Spawn)
  41. local Orc = GetSpawn(NPC, OrcID)
  42. SpawnSet(Orc, "visual_state", 0)
  43. AddStepProgress(Spawn, QUEST, 1, 1)
  44. if not HasSpellEffect(Orc, 5468) then
  45. CastSpell(Spawn, 5468, 1, Orc)
  46. end
  47. Despawn(NPC)
  48. end
  49. function respawn(NPC)
  50. spawn(NPC)
  51. end