Nome: Pokémon MOVE (Order System)
Autor: PoRaI ou PoPoRaI
Server: Polska 8.42 - Acho que pode funcionar em versões novas.
Como functiona?
No Pokémon Online funciona da seguinte maneira: Clicando no botão order e em algum local que possa andar, o pokémon vai até o local, então esse sistema funciona igualzinho ao sistema do Pokémon Online.
1º - Adiciona na LIB (Data → lib → functions.lua), você ira adicionar uma função criada pelo DOKMOS, doPushCreature.
------------------ Function doPushCreature(uid,direction,distance,time) by Dokmos ------------------
function doPushCreature(uid,direction,distance,time)
if isCreature(uid) == TRUE then
local rand = (2*math.random(0,1))-1
local rand2 = math.random(-1,0)
if direction == 0 then
signal = {0,rand,-rand,rand,-rand,0,-1,-1,-1,0,0,0}
elseif direction == 1 then
signal = {1,1,1,0,0,0,0,rand,-rand,rand,-rand,0}
elseif direction == 2 then
signal = {0,rand,-rand,rand,-rand,0,1,1,1,0,0,0}
elseif direction == 3 then
signal = {-1,-1,-1,0,0,0,0,rand,-rand,rand,-rand,0}
elseif direction == 4 then
signal = {-1,rand2,(-rand2)-1,0,1,rand2+1,rand2,0}
elseif direction == 5 then
signal = {1,-rand2,-((-rand2)-1),0,1,rand2+1,rand2,0}
elseif direction == 6 then
signal = {-1,rand2,(-rand2)-1,0,-1,(-rand2)-1,rand2,0}
else
signal = {1,-rand2,-((-rand2)-1),0,-1,(-rand2)-1,rand2,0}
end
local pos = getThingPos(uid)
nsig = #signal
nvar = 0
repeat
nvar = nvar+1
newpos = {x=pos.x+(signal[nvar]),y=pos.y+(signal[(nsig/2)+nvar]),z=pos.z}
newtile = {x=newpos.x,y=newpos.y,z=newpos.z,stackpos=0}
until getTileThingByPos(newtile).uid ~= 0 and hasProperty(getTileThingByPos(newtile).uid,3) == FALSE and queryTileAddThing(uid,newpos) == 1 or nvar == (nsig/2)
if distance == nil or distance == 1 then
doTeleportThing(uid,newpos,TRUE)
else
distance = distance-1
doTeleportThing(uid,newpos,TRUE)
if time ~= nil then
addEvent(doPushCreature,time,uid,direction,distance,time)
else
addEvent(doPushCreature,500,uid,direction,distance,500)
end
end
end
end
2º - Em actions.xml coloque:
<action itemid="idaqui" script="move.lua" allowfaruse="1"/>
3º - Cria um arquivo em: Data → Actions → Scripts um novo arquivo chamado move.lua
function onUse(cid, item, frompos, item2, toPosition)
function doOrderMove(cid) -- By PoRaI.
local creature = getCreatureSummons(cid)[1]
local pokepos = getCreaturePosition(creature)
local ir = toPosition
if pokepos.x == ir.x and pokepos.y == ir.y then
return TRUE
end
if pokepos.x ~= ir.x or pokepos.y ~= ir.y then
if(pokepos.y - ir.y) >= 1 then
addEvent(doPushCreature, 300, creature, NORTH, pokepos.y - ir.y)
end
if(ir.y - pokepos.y) >= 1 then
addEvent(doPushCreature, 300, creature, SOUTH, ir.y - pokepos.y)
end
if(pokepos.x - ir.x) >= 1 then
doPushCreature(creature, WEST, pokepos.x - ir.x)
end
if(ir.x - pokepos.x) >= 1 then
addEvent(doPushCreature, 300, creature, EAST, ir.x - pokepos.x)
end
return FALSE
end
end
if #getCreatureSummons(cid) == 1 then
doOrderMove(cid)
end
end
Créditos ao PoRaI & DOKMOS
Só estou divulgando!