Ir para conteúdo
Entre para seguir isso  
PoRaI

Pokémon Move

Recommended Posts

PoRaI    0
PoRaI

Nome: Pokémon MOVE (Order System)

Autor: PoRaI ou PoPoRaI (eu)

Server: Qualquer um.

 

Oi, a muito tempo não posto um SCRIPT legal aqui ._., então resolvi postar um que bastante pessoas procuram, o tal de mover pokémon igual o Pokémon Online... Sim, isto mesmo :D. Agora espero que pelo menos vá para exclusivo :palm:

 

Como functiona?

No Pokémon Online funciona da seguinte maneira: Clicando no botão order e ne algum local que possa andar, o pokémon vai ate 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

 

3º - Em actions.xml coloque:

<action itemid="idaqui" script="move.lua" allowfaruse="1"/>

 

4º - Cria um arquivo em Data → Actions → Scripts um arquivo chamado move.lua

function onUse(cid, item, frompos, item2, toPosition)

function doMoveTo(cid, pos) -- By PoRaI.

local creature = cid

local pokepos = getCreaturePosition(cid)

local ir = pos

 

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

doPushCreature(creature, NORTH, pokepos.y - ir.y)

end

if(ir.y - pokepos.y) >= 1 then

doPushCreature(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

doPushCreature(creature, EAST, ir.x - pokepos.x)

end

return FALSE

end

end

if #getCreatureSummons(cid) == 1 then

doMoveTo(getCreatureSummons(cid)[1], toPosition)

end

end

 

Outros modos de se fazer:

[spoiler=Summon ir ate o player]

function onUse(cid, item, frompos, item2, toPosition)

function doMoveTo(cid, pos) -- By PoRaI.

local creature = cid

local pokepos = getCreaturePosition(cid)

local ir = pos

 

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

doPushCreature(creature, NORTH, pokepos.y - ir.y)

end

if(ir.y - pokepos.y) >= 1 then

doPushCreature(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

doPushCreature(creature, EAST, ir.x - pokepos.x)

end

return FALSE

end

end

if #getCreatureSummons(cid) == 1 then

doMoveTo(getCreatureSummons(cid)[1], getCreaturePosition(cid))

end

end

 

[spoiler=O player ir ao templo ANDANDO]

function onUse(cid, item, frompos, item2, toPosition)

function doMoveTo(cid, pos) -- By PoRaI.

local creature = cid

local pokepos = getCreaturePosition(cid)

local ir = pos

 

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

doPushCreature(creature, NORTH, pokepos.y - ir.y)

end

if(ir.y - pokepos.y) >= 1 then

doPushCreature(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

doPushCreature(creature, EAST, ir.x - pokepos.x)

end

return FALSE

end

end

doMoveTo(cid, {x=getTownTemplePosition(getPlayerTown(cid)).x, y=getTownTemplePosition(getPlayerTown(cid)).y, z=getTownTemplePosition(getPlayerTown(cid)).z})

end

 

 

*Espero ver comentarios.

Breve postarei um video do sistema. ^^

OBS: Podem usar, não se esqueçam dos creditos ;D

Editado por PoRaI

Compartilhar este post


Link para o post
Lwkass    1
Lwkass

Bem feito o script,

 

Aprovado

Compartilhar este post


Link para o post
ruanbaron    0
ruanbaron

Opa!!!! Vlw tava precisando de uma Boa Base ...... Muito Obrigado!!

Compartilhar este post


Link para o post
vyctor17    35
vyctor17

otimo script ^^" deu trabalho mais funciono uheuheuhe

Compartilhar este post


Link para o post
ruanbaron    0
ruanbaron

Meu Servidor tá dando error no OnUe .... e as veses da no end ...... vo postar.. Ajuda ai

 

[Error - LuaScriptInterface::loadFile] data/actions/scripts/move.lua:1: '=' expected near 'onuse'

[10/01/2011 15:52:56] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/move.lua)

[10/01/2011 15:52:56] data/actions/scripts/move.lua:1: '=' expected near 'onuse'

[10/01/2011 15:52:56] [Warning - Actions::registerEvent] Duplicate registered item id: 5791

 

 

Eu uso em Servidor Pokémon Flash 8.54 TFS!

Editado por ruanbaron

Compartilhar este post


Link para o post
PoRaI    0
PoRaI

Você deve ter colocado um simbolo no começo do script tipo:

=function onUse...

Compartilhar este post


Link para o post
allansmidi    0
allansmidi

valew lek, ajudou muito ... obrigado!!

Compartilhar este post


Link para o post
coubel    0
coubel

Script muito bem bolado.... Agradeço a Você pelo Script e Pelo DOKMOS pela LIB ^^

Compartilhar este post


Link para o post
aduekin123    0
aduekin123

N da o montro tenta ir so q ele tem q ficar 2 sqm de distancia do player !

Compartilhar este post


Link para o post
Loira    0
Loira
N da o monstro tenta ir so q ele tem q ficar 2 sqm de distancia do player ! :fuu:

 

sim :/ pode fixar?

Compartilhar este post


Link para o post
PoRaI    0
PoRaI

Ja posto com o bug arrumado :s

Compartilhar este post


Link para o post
Loira    0
Loira
Ja posto com o bug arrumado :s

 

vai arrumar o bug? to perando >.<

Compartilhar este post


Link para o post
Pekelan    0
Pekelan

2 dias e nada... .-. fora que aqui nen 2 skm ando :X

Compartilhar este post


Link para o post
djteam    0
djteam

jeje gogo porai voc pode arrumar o bug :)

Compartilhar este post


Link para o post
PoRaI    0
PoRaI

Desculpem, esse bug so pode ser arrumado pelas source, ou aumente a velocidade do SUMMON:

doPushCreature(creature, EAST, ir.x - pokepos.x, 100) = ex

 

Ou versões mais antigas, por que esse servidor que vocês usam 8.54 é um lixo. risos,

vocês não tem nem vergonha de usar ele ;x, pelo menos se tive-sem capacidade de criar um do 0 sozinhos sem pegar scripts da net. 8.42 Roda perfeito, agora so faltam vocês terem a capacidade de criar um ;D (A preguiça de vocês ganha, eu sei, nunca iriam conseguir :()

Compartilhar este post


Link para o post
deltonvaz    0
deltonvaz

Você poderia dar uma ideia como seria a modificação na source?

Compartilhar este post


Link para o post
Wantedzin    0
Wantedzin

KKKKK na versão TFS 0.3.6 ele funciona perfeitinho testei com um dragon aqui e ele foi só que ele volta para o lado do player é só achar na source a configuração que faz ele voltar pro lado do player....

Compartilhar este post


Link para o post
Ms Gaiden    0
Ms Gaiden

Aqui funfou de boa tb a unica coisa é que ele vai e volta

Compartilhar este post


Link para o post
Hakkan    0
Hakkan

uma pgt tipo o scrpit movimenta e talz mas quando o pokemon eh movimentdo ele retorna pra perdo do player?

Compartilhar este post


Link para o post
Visitante
Este tópico está impedido de receber novos posts.
Entre para seguir isso  
  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×