Davey Chip
New Member
- Joined
- Mar 10, 2009
- Messages
- 13
- Solutions
- 1
- Reaction score
- 0
Hi,
So i'm trying to make a custom ring of healing, this is the bare bones of the script. My problem being, how do i add a delay to this, so it only heals every second or two, currently it just bursts with endless healing because i can't add a delay to the loop? I added the magic effect so i could see how often the script was being executed.
So i'm trying to make a custom ring of healing, this is the bare bones of the script. My problem being, how do i add a delay to this, so it only heals every second or two, currently it just bursts with endless healing because i can't add a delay to the loop? I added the magic effect so i could see how often the script was being executed.
Lua:
function onEquip(player, item, slot)
while item == player:getSlotItem(CONST_SLOT_RING) do
addEvent(healhealth,500, playerid)
addEvent(healmana,500, playerid)
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
end
return true
end
function healhealth(playerid)
playerid:addHealth(math.random(50,150))
return true
end
function healmana(playerid)
playerid:addMana(math.random(50, 150))
return true
end