9
3

rikantusfirering.lua 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. --[[
  2. Script Name : SpawnScripts/Antonica/rikantusfirering.lua
  3. Script Author : Dorbin
  4. Script Date : 2023.05.19 05:05:05
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC)
  9. SetPlayerProximityFunction(NPC, 1, "InRange", "LeaveRange")
  10. end
  11. function respawn(NPC)
  12. spawn(NPC)
  13. end
  14. function InRange(NPC,Spawn,Zone)
  15. if GetDistance(NPC,Spawn)<1 or GetSpawnLocationID(NPC)== 133776619 and GetDistance(NPC,Spawn)<1 or GetSpawnLocationID(NPC)== 133776620 and GetDistance(NPC,Spawn)<1 then
  16. SpawnSet(Spawn,"visual_state",492)
  17. TakeFireDamage(Spawn)
  18. SendMessage(Spawn, "You are burning!", "red")
  19. AddTimer(NPC,3000,"InRange",1,Spawn)
  20. end
  21. end
  22. function LeaveRange(NPC,Spawn)
  23. SpawnSet(Spawn,"visual_state",0)
  24. end
  25. function TakeFireDamage(Spawn)
  26. local invul = IsInvulnerable(Spawn)
  27. if invul == true then
  28. return 0
  29. end
  30. local hp = GetHP(Spawn)
  31. local damage = GetMaxHP(Spawn)*0.05
  32. local damageToTake = damage * 1
  33. -- if we don't have enough HP make them die to pain and suffering not self
  34. if hp <= damageToTake then
  35. KillSpawn(Spawn, null, 1)
  36. else
  37. DamageSpawn(Spawn, Spawn, 192, 3, damageToTake, damageToTake, "Fire!", 0, 0, 1, 1)
  38. end
  39. end
  40. function Tick(Zone, Spawn, RegionType)
  41. TakeFireDamage(Spawn)
  42. -- returning 1 would stop the Tick process until Spawn leaves/re-enters region
  43. return 0
  44. end