9
3

naj_lavaregion_damage.lua 761 B

1234567891011121314151617181920212223242526272829303132
  1. function TakeLavaDamage(Spawn)
  2. local invul = IsInvulnerable(Spawn)
  3. if invul == true then
  4. return 0
  5. end
  6. local hp = GetHP(Spawn)
  7. local level = GetLevel(Spawn)
  8. local damageToTake = level * 25
  9. -- if we don't have enough HP make them die to pain and suffering not self
  10. if hp <= damageToTake then
  11. KillSpawn(Spawn, null, 1)
  12. else
  13. DamageSpawn(Spawn, Spawn, 192, 3, damageToTake, damageToTake, "Lava Burn", 0, 0, 1, 1)
  14. end
  15. end
  16. function EnterRegion(Zone, Spawn, RegionType)
  17. -- initial tick for hitting the lava
  18. TakeLavaDamage(Spawn)
  19. -- 5 second Tick
  20. return 5000
  21. end
  22. function Tick(Zone, Spawn, RegionType)
  23. TakeLavaDamage(Spawn)
  24. -- returning 1 would stop the Tick process until Spawn leaves/re-enters region
  25. return 0
  26. end