Demonstraçao:
data/movements/questname.lua:
local route = { {0,0,0,0,0,1,0,0,0}, {0,0,0,0,1,0,1,0,0}, {1,0,0,1,0,0,0,1,1}, {0,1,1,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0} } local extrtilepos = {x=88, y=310, z=7} -- Posiçao do tile << /\ local start = {x=87, y=312, z=7} -- Posiçao do tile que o cara vai estar antes de começar a pisar nos tiles pretos. local final = {x=97, y=312, z=7} -- Posiçao do tile que o cara vai estar dps de ter passado pelo percurso function isPosInRoute(tilesroutepos, tilepos) for i,s in pairs(tilesroutepos) do if s.x == tilepos.x and s.y == tilepos.y and s.z == tilepos.z then return TRUE end end return FALSE end function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition) local tilesroutepos = {} for i, t in pairs(route) do for s, p in pairs(t) do if p == 1 then table.insert(tilesroutepos, {x=extrtilepos.x+s-1, y=extrtilepos.y+i-1, z=extrtilepos.z}) end end end if toPosition.x == final.x and toPosition.y == final.y and toPosition.z == final.z then for i,x in pairs(tilesroutepos) do x.stackpos = 0 doTransformItem(getThingFromPos(x).uid, 407) end return TRUE end if toPosition.x == start.x and toPosition.y == start.y and toPosition.z == start.z then for i,x in pairs(tilesroutepos) do x.stackpos = 0 doTransformItem(getThingFromPos(x).uid, 407) end return TRUE end if fromPosition.x == final.x and fromPosition.y == final.y and fromPosition.z == final.z then doTeleportThing(cid, fromPosition) return doPlayerSendCancel(cid, "Enter in the teleport.") end if isPosInRoute(tilesroutepos, toPosition) then local tilepos = toPosition tilepos.stackpos = 0 doTransformItem(getThingFromPos(tilepos).uid, 406) else doTeleportThing(cid, start) for i,x in pairs(tilesroutepos) do x.stackpos = 0 doTransformItem(getThingFromPos(x).uid, 407) end end return TRUE end
data/movements/movements.xml:
<movevent type="StepIn" actionid="123666" event="script" value="questname.lua"/>
Em quais tiles botar o actionid 123666:
Editar a rota que o player tem que fazer:
local route = { {0,0,0,0,0,1,0,0,0}, {0,0,0,0,1,0,1,0,0}, {1,0,0,1,0,0,0,1,1}, {0,1,1,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0} }
So mudar essa table. Aonde eh 1 eh por onde o player tem que passar.