sestorme
Member
Code:
local thing = getThingFromPos(cpos)
if thing.uid > 0 and isCreature(thing.uid) and thing.uid ~= cid then
doChangeSpeed(thing.uid, -130)
doSendMagicEffect(getThingFromPos(cpos), 20)
doCreatureSetStorage(thing.uid, 2000, 8)
function run(left)
if (left > 0) then
if isCreature(thing.uid) then
doSendMagicEffect(getCreaturePosition(thing.uid),7)
if getCreatureStorage(thing.uid, 2000) <= 0 then
doChangeSpeed(thing.uid, 130)
elseif getCreatureStorage(thing.uid, 2000) >= 0.5 then
doCreatureSetStorage(thing.uid, 2000, (getCreatureStorage(thing.uid, 2000) - 1))
addEvent(run, 500, left)
end
end
end
end
run(1)
Quick explanation what it is. On certain position target unit gets slowed by -130 movement speed. Then addEvent is started to create fancy animation of this effect. I need to have current time of slow stored as it's time is crucial and could be extended by various set of actions, that's why I need to keep a track of how much of slow is remaining on CreatureStorage. Problem appears when I get in touch with two units marked as thing.uid, one remains slowed and another one that is affected by the same spell before the end of the previous one's duration has it's movement speed increased. That only happens because spell's cooldown is lower than it's slow duration. There are absolutely no problems otherwise. Anyone could have a suggestion how to sort it out? Thanks, rep'd.