Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.01 KB | None | 0 0
  1. local function startRegen(playerid, isBlock)
  2.     local regen = addEvent(function(pid)
  3.         local c = Creature(pid)
  4.         if c and c:isPlayer() then
  5.             if isBlock then
  6.                 stopEvent(regen)
  7.             else
  8.                 if not Tile(c:getPosition()):getGround():getActionId() == 4505 then
  9.                     stopEvent(regen)
  10.                 else
  11.                     c:addMana(c:getVocation():getManaGainAmount())
  12.                     c:addHealth(c:getVocation():getHealthGainAmount())
  13.                     startRegen(c:getId(), false)
  14.                 end
  15.             end
  16.         end
  17.     end, 3*1000, playerid)
  18. end
  19.            
  20. function onStepIn(creature, item, position, fromPosition)
  21.     if not creature:isPlayer() then
  22.         return true
  23.     end
  24.     if position == CASTLE_INFO.THRONE_POSITION then
  25.         Castle:onStepIn(creature)
  26.     else
  27.         startRegen(creature:getId(), false)
  28.     end
  29.     return true
  30. end
  31.  
  32. function onStepOut(creature, item, position, fromPosition)
  33.     if not creature:isPlayer() then
  34.         return true
  35.     end
  36.     if position == CASTLE_INFO.THRONE_POSITION then
  37.         Castle:onStepOut(creature)
  38.     else
  39.         startRegen(creature:getId(), true)
  40.     end
  41.     return true
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement