halas_proximity_cheer.lua 770 B

123456789101112131415161718192021222324252627282930313233
  1. --[[
  2. Script Name : SpawnScripts/FrostfangSea/halas_proximity_cheer.lua
  3. Script Purpose : makes npcs cheer when player gets in proximity
  4. Script Author : theFoof
  5. Script Date : 2013.9.26
  6. Script Notes :
  7. --]]
  8. function spawn(NPC)
  9. SetPlayerProximityFunction(NPC, 15, "ProxCheer")
  10. end
  11. function respawn(NPC)
  12. spawn(NPC)
  13. end
  14. function hailed(NPC, Spawn)
  15. PlayFlavor(NPC, "", "", "hello", 0, 0, Spawn)
  16. FaceTarget(NPC, Spawn)
  17. end
  18. function ProxCheer(NPC, Spawn)
  19. FaceTarget(NPC, Spawn)
  20. if GetTempVariable(NPC, "cheer_timer") == nil then
  21. PlayFlavor(NPC, "", "", "cheer", 0, 0)
  22. SetTempVariable(NPC, "cheer_timer", "1")
  23. AddTimer(NPC, 15000, "CheerTimer")
  24. end
  25. end
  26. function CheerTimer(NPC)
  27. SetTempVariable(NPC, "cheer_timer", nil)
  28. end