Advertisement
Guest User

Health regen example

a guest
Aug 12th, 2018
1,093
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Item.setHealthRegen(self, amount, ticks)
  2.     self:setAbility(ITEM_ABILITY_HEALTHGAIN, amount)
  3.     self:setAbility(ITEM_ABILITY_HEALTHTICKS, ticks)
  4.     self:setAbility(ITEM_ABILITY_REGENERATION, 1)
  5. end
  6.  
  7. function Item.removeHealthRegen(self)
  8.     self:removeAbility(ITEM_ABILITY_HEALTHGAIN)
  9.     self:removeAbility(ITEM_ABILITY_HEALTHTICKS)
  10.     self:removeAbility(ITEM_ABILITY_REGENERATION)
  11. end
  12.  
  13. local item = player:getSlotItem(CONST_SLOT_RING)
  14. item:setHealthRegen(50, 1000) -- regen 50 health every second
  15.  
  16. -- later
  17. item:removeHealthRegen() -- regen will no longer work
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement