<movevent event="Equip" itemid="ring id" slot="ring" function="onEquipItem" />
function onEquip(player, item, slot, isCheck)
-- remove the item before we kill them
item:remove()
-- kill the player
player:addHealth(-player:getMaxHealth())
return true
end
I wanted a ring that when giving use, it needs to be equipped, the player will die..9
I believe what he said in his broken English is using the ring makes the player die, not equipping itthat when giving use
That's cool, I didn't know thatif you do this the player will never be able to log back in.
onEquip function executes when the player logs in, if you make them die when they equip it they will relog and it will execute again, causing infinite death.
I wanted a ring that when giving use, it needs to be equipped, the player will die..
TFS 1.3
Client 10.99
I believe what he said in his broken English is using the ring makes the player die, not equipping it
That's cool, I didn't know that
if you bother removing the item onEquip, don't use return true afterwards.How about equipping the ring and then remove it from the player before he dies?
movements.xml
Lua:<movevent event="Equip" itemid="ring id" slot="ring" function="onEquipItem" />
script
Lua:function onEquip(player, item, slot, isCheck) -- remove the item before we kill them item:remove() -- kill the player player:addHealth(-player:getMaxHealth()) return true end
Yes!I believe what he said in his broken English is using the ring makes the player die, not equipping it
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:getSlotItem(CONST_SLOT_RING) == item then
player:addHealth(-player:getMaxHealth())
return true
end
return false
end