Hello guys, recently I started doing my own PoI fire script imitating the real Tibia one. It already increases the damage by 300 on each wrong step by the non-allowed vocations. The thing is that I'm trying to restart the counter whenever you do your first step out of fire, but I can't get to it. I guess I am not using properly the OnStepOut function, but I'll leave my script here. It's for TFS 0.3.6, Tibia client 8.6.
By the way, I make it work by using the purple fires with ID 7465, and then put in movements.xml:
PurpleFireKnight.lua:
[/code]
By the way, I make it work by using the purple fires with ID 7465, and then put in movements.xml:
Code:
<movement type="StepIn" itemid="7465" event="script" value="PurpleFireKnight.lua"/>
PurpleFireKnight.lua:
Lua:
[CODE]local storage = 10199 --storing the damage counter
function onStepIn(cid, item, position, fromPosition)
if not(isPlayer(cid) == TRUE) then
return false
end
local voc = 4
local vocpromo = 8
local PlayerVoc = getPlayerVocation(cid)
if getPlayerStorageValue(cid,storage)<1 then
setPlayerStorageValue(cid,storage,1)
end
if PlayerVoc ~= voc and PlayerVoc ~= vocpromo then
doTargetCombatHealth(0, cid, COMBAT_FIREDAMAGE, -300*getPlayerStorageValue(cid,storage), -300*getPlayerStorageValue(cid,storage), 15)
setPlayerStorageValue(cid,storage,getPlayerStorageValue(cid,storage)+1)
else
doTargetCombatHealth(0, cid, COMBAT_FIREDAMAGE, -300, -300, 15)
end
return true
end
function onStepOut(cid, item, position, fromPosition)
local aux = 0
local fireTilesPos = { -- tiles with purple fire
{x = 32830, y = 32328, z = 11},
{x = 32830, y = 32327, z = 11},
{x = 32830, y = 32326, z = 11},
{x = 32830, y = 32325, z = 11},
{x = 32830, y = 32324, z = 11},
{x = 32830, y = 32323, z = 11},
{x = 32830, y = 32322, z = 11},
{x = 32830, y = 32321, z = 11},
{x = 32829, y = 32321, z = 11},
{x = 32828, y = 32321, z = 11},
{x = 32827, y = 32321, z = 11}
}
for i=1,#fireTilesPos do
if (getDistanceBetween(fireTilesPos[i],position) == 0) then
aux=1
break
end
end
if (aux == 0) then
setPlayerStorageValue(cid,storage,1)
end
end