Ir para conteúdo
Entre para seguir isso  
deltonvaz

[Action] Order System com pokemon parado

Recommended Posts

deltonvaz    0
deltonvaz

Opa galerinha!

 

Estou desenvolvendo um pokemon server e resolvi postar o script do order.

 

Eu estou mexendo nos scripts do josejunior23, mas irei apenas postar a função aqui.

 

O script foi baseado nos scripts de [PORAI] e [DOKMOS]

 

Bom vamos começar:

 

Em data/lib/050-function.lua vá até o final do arquivo e adicione as seguintes linhas:

 

-- ORDER System
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, 200)
		end
	if(ir.y - pokepos.y) >= 1 then
		doPushCreature(creature, SOUTH, ir.y - pokepos.y, 200)
	end
	if(pokepos.x - ir.x) >= 1 then
		doPushCreature(creature, WEST, pokepos.x - ir.x, 200)
	end
	if(ir.x - pokepos.x) >= 1 then
		doPushCreature(creature, EAST, ir.x - pokepos.x, 200)
	end
return false
end
end 

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

-- Para o Pet/Pokemon/Summon parar (Edited By Delton)
function returnSpeed(cid)
doChangeSpeed(cid, getCreatureBaseSpeed(cid) - getCreatureSpeed(cid)) 
return true
end	
function stopFor(cid,time)
doChangeSpeed(cid,  0 - getCreatureSpeed(cid))
addEvent(returnSpeed,time,cid)
return true
end

 

Até ai já temos a função, agora vamos ao uso.

 

Vá até actions/scripts e crie um arquivo chamado move.lua, e adicione isso dentro:

 

function onUse(cid, item, fromPosition, itemEx, toPosition)
if itemEx.uid ~= cid and (isCreature(getCreatureSummons(cid)[1])) then
	doCreatureSay(cid, getCreatureName(getCreatureSummons(cid)[1]) .. ', Move!', TALKTYPE_SAY)
	doMoveTo(getPlayerPet(cid), toPosition)
	stopFor(getPlayerPet(cid),5*1000)
else
	returnMessage(cid, "Your must be a summon.")
end
       return true
end

 

Agora em actions.xml adicione a seguinte tag:

 

<action itemid="2693" allowfaruse="yes" event="script" value="move.lua"/>

 

Lembrando que o sistema não é oficial, este é apenas para dar uma ajudinha.

 

Comentários? Dúvida? Postem ae (:

 

Delton~~ :bye:

Editado por deltonvaz
Fix.

Compartilhar este post


Link para o post
Compartilhar em outros sites
Addicted    1
Addicted

Área incorreta e pelo que sei esse script nem é seu.

Compartilhar este post


Link para o post
Compartilhar em outros sites
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.

×