Crevasse
惡名昭彰
Hey guys,
I'm using OTX3, and I am trying to make a helmet that, when worn, increases the players distance fighting by +50%. I did this by creating a movement script and then adding that item to my movements.xml:
Here is the lua script for mysticturban.lua:
The problem is that it only half works: when I put the helmet on, my distance increases by 50% (e.g. I have 30 distance, put on the helmet, it goes up to 45). However, when I take the helmet off, my distance fighting stays at 45. It does not go back down to 30. I have searched for a while now and I cannot seem to figure out what I am doing wrong. I am not getting any errors in my server console.
Thanks!
I'm using OTX3, and I am trying to make a helmet that, when worn, increases the players distance fighting by +50%. I did this by creating a movement script and then adding that item to my movements.xml:
XML:
<movevent event="Equip" itemid="2663" slot="head" script="mysticturban.lua" /> <!--msytic turban -->
<movevent event="DeEquip" itemid="2663" slot="head" script="mysticturban.lua" />
Here is the lua script for mysticturban.lua:
Lua:
local condition = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_SKILL_DISTANCEPERCENT, 150)
condition:setParameter(CONDITION_PARAM_TICKS, -1)
function onEquip(cid, item)
local player = Player(cid)
player:addCondition(condition)
return true
end
function onDeEquip(cid, item)
local player = Player(cid)
player:removeCondition(condition)
return true
end
The problem is that it only half works: when I put the helmet on, my distance increases by 50% (e.g. I have 30 distance, put on the helmet, it goes up to 45). However, when I take the helmet off, my distance fighting stays at 45. It does not go back down to 30. I have searched for a while now and I cannot seem to figure out what I am doing wrong. I am not getting any errors in my server console.
Thanks!