Ir para conteúdo
Entre para seguir isso  
Akley

New Trainer System v1.0

Recommended Posts

Akley    0
Akley
Informações:

Nome: Trainer System

Autor: Dener Diegoli

Versão: 1.0

~ Funciona em todos os distros 8.10 ~ 8.7x + ~

 

Como funciona:.

Este Sistema funciona da seguinte forma, quando você entra no trainer, os dois trainer aparece, e quando você sai, eles desaparecem, e quando você tenta entrar em uma sala que já tem um player, fala que a sala já está ocupada.

 

Este Script consiste em dois prefixos:. Actions e Movements.

 

Configure os Action ID no seus Trainers como o da imagem abaixo:

2z5w00z.png

 

 

Explicando:

 

ActionsIds dos Tiles.

9000 = Norte

9001 = Sul

9002 = Esquerda

9003 = Direita

 

ActionsIds das Doors.

4211 = Norte

4212 = Sul

4213 = Esquerda

4214 = Direita

 

 

Feito isso, vamos na pasta Actions/Scripts, crie um arquivo chamado training_room.lua e adicione esse código:

[spoiler=Código]

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

 

-- <beginning> Trainer System by Dener Diegoli.

-- Version 1.0

 

-- Beginning of editable Variabels

aidNor = 4211 -- Action id for door where training room is north of door

aidSou = 4212 -- Action id for door where training room is south of door

aidWes = 4213 -- Action id for door where training room is west of door

aidEas = 4214 -- Action id for door where training room is east of door

-- End of editable Variabels

 

emptyRoom = true

charPos = getPlayerPosition(cid)

 

if (item.actionid == aidNor) then

if (charPos.y < frompos.y) then

othersidePos = {x=frompos.x, y=frompos.y+1, z=frompos.z}

else

othersidePos = {x=frompos.x, y=frompos.y-1, z=frompos.z, stackpos=253}

things = getThingfromPos(othersidePos)

if (things.itemid == 1) then

if (getPlayerLevel(things.uid) > 0) then

emptyRoom = false

end

end

end

 

elseif (item.actionid == aidSou) then

if (charPos.y > frompos.y) then

othersidePos = {x=frompos.x, y=frompos.y-1, z=frompos.z}

else

othersidePos = {x=frompos.x, y=frompos.y+1, z=frompos.z, stackpos=253}

things = getThingfromPos(othersidePos)

if (things.itemid == 1) then

if (getPlayerLevel(things.uid) > 0) then

emptyRoom = false

end

end

end

 

elseif (item.actionid == aidEas) then

if (charPos.x > frompos.x) then

othersidePos = {x=frompos.x-1, y=frompos.y, z=frompos.z}

else

othersidePos = {x=frompos.x+1, y=frompos.y, z=frompos.z, stackpos=253}

things = getThingfromPos(othersidePos)

if (things.itemid == 1) then

if (getPlayerLevel(things.uid) > 0) then

emptyRoom = false

end

end

end

 

elseif (item.actionid == aidWes) then

if (charPos.x < frompos.x) then

othersidePos = {x=frompos.x+1, y=frompos.y, z=frompos.z}

else

othersidePos = {x=frompos.x-1, y=frompos.y, z=frompos.z, stackpos=253}

things = getThingfromPos(othersidePos)

if (things.itemid == 1) then

if (getPlayerLevel(things.uid) > 0) then

emptyRoom = false

end

end

end

 

end

 

if (emptyRoom == true) then

doTeleportThing(cid, othersidePos)

doSendMagicEffect(charPos, 2)

doSendMagicEffect(frompos, 12)

doSendMagicEffect(othersidePos, 10)

 

else

doPlayerSendTextMessage(cid, 22, "Esta sala já está ocupada.")

end

-- <end> Trainer System script by Dener diegoli.

 

return 1

end

 

 

E em actions.xml adicione essa tag:.

[spoiler=Código]

<!-- training room-doors, beginning -->

<action actionid="4211" script="training_room.lua" />

<action actionid="4212" script="training_room.lua" />

<action actionid="4213" script="training_room.lua" />

<action actionid="4214" script="training_room.lua" />

 

 

OK, agora vamos na pasta Movements/Scripts e crie um arquivo chamado Treiners.lua e adicione o seguinte código:

[spoiler=Código]

function onStepIn(cid, item, pos)

local charPos = getCreaturePosition(cid)

local monkOne

local monkTwo

 

if(item.actionid == 9000) then

monkOne = {x = charPos.x - 1, y = charPos.y - 1, z = charPos.z}

monkTwo = {x = charPos.x + 1, y = charPos.y - 1, z = charPos.z}

 

elseif(item.actionid == 9001) then

monkOne = {x = charPos.x - 1, y = charPos.y + 1, z = charPos.z}

monkTwo = {x = charPos.x + 1, y = charPos.y + 1, z = charPos.z}

 

elseif(item.actionid == 9002) then

monkOne = {x = charPos.x - 1, y = charPos.y - 1, z = charPos.z}

monkTwo = {x = charPos.x -1, y = charPos.y + 1, z = charPos.z}

 

elseif(item.actionid == 9003) then

monkOne = {x = charPos.x + 1, y = charPos.y - 1, z = charPos.z}

monkTwo = {x = charPos.x + 1, y = charPos.y + 1, z = charPos.z}

 

else

return true

end

 

doSummonCreature("Training Monk", monkOne)

doSummonCreature("Training Monk", monkTwo)

return true

end

 

function onStepOut(cid, item, pos)

local charPos = getCreaturePosition(cid)

local monkOne

local monkTwo

 

if(item.actionid == 9000) then

monkOne = {x = charPos.x - 1, y = charPos.y - 3, z = charPos.z}

monkTwo = {x = charPos.x + 1, y = charPos.y - 3, z = charPos.z}

 

elseif(item.actionid == 9001) then

monkOne = {x = charPos.x - 1, y = charPos.y + 3, z = charPos.z}

monkTwo = {x = charPos.x + 1, y = charPos.y + 3, z = charPos.z}

 

elseif(item.actionid == 9002) then

monkOne = {x = charPos.x - 3, y = charPos.y - 1, z = charPos.z}

monkTwo = {x = charPos.x -3, y = charPos.y + 1, z = charPos.z}

 

elseif(item.actionid == 9003) then

monkOne = {x = charPos.x + 3, y = charPos.y - 1, z = charPos.z}

monkTwo = {x = charPos.x + 3, y = charPos.y + 1, z = charPos.z}

 

else

return true

end

 

doRemoveCreature(getThingfromPos({x = monkOne.x, y = monkOne.y, z = monkOne.z, stackpos = 253}).uid)

doRemoveCreature(getThingfromPos({x = monkTwo.x, y = monkTwo.y, z = monkTwo.z, stackpos = 253}).uid)

doSendMagicEffect(monkOne, 2)

doSendMagicEffect(monkTwo, 2)

return true

end

 

 

A onde está em azul, é onde você tem que colocar o nome do seu trainer, isso é muito importante, não esqueça :pega-el:

 

E em Movements.xml adicione a seguinte Tag:

[spoiler=Código]

<movevent type="StepIn" actionid="9000" event="script" value="treiners.lua"/>

<movevent type="StepOut" actionid="9000" event="script" value="treiners.lua"/>

<movevent type="StepIn" actionid="9001" event="script" value="treiners.lua"/>

<movevent type="StepOut" actionid="9001" event="script" value="treiners.lua"/>

<movevent type="StepIn" actionid="9002" event="script" value="treiners.lua"/>

<movevent type="StepOut" actionid="9002" event="script" value="treiners.lua"/>

<movevent type="StepIn" actionid="9003" event="script" value="treiners.lua"/>

<movevent type="StepOut" actionid="9003" event="script" value="treiners.lua"/>

 

 

É isso pessoal, espero que gostem e façam bom proveito, obrigado.

 

PS:. Esse script é exclusivo da OTnet,

se encontrar em outro fórum por favor avise.

 

Bugs, Dúvidas e Sugestões

Me adicione no msn:. [email protected]

 

~Comentem

Editado por Akley

Compartilhar este post


Link para o post
Oneshot    24
Oneshot

É um script interessante e simples. Se você ler algumas aulas na seção de tutoriais, poderá aprender a usar algumas funções LUA afim de otimizar o tamanho do código em si.

 

Criatividade: 55

Organização: 40

Tamanho: 40

Utilidade: 45

 

Nota Final: 43 ou C+

Remuneração Total: 30V$

Compartilhar este post


Link para o post
nippo_ot    0
nippo_ot

muito bom cara, estava atras desse script a tempos, ateh tinha achado mais nao funfava direito, o seu funfo legal, vlws ae :D

Compartilhar este post


Link para o post
malukae    0
malukae

Bom script,

mas o sistema é inútil. Igual a ter dois Monk's normalmente...

 

Mas mesmo assim bom script!

Compartilhar este post


Link para o post
Jhonts    0
Jhonts

sempre procurei um assim e nao achava, muito obrigado e parabens cara!

Compartilhar este post


Link para o post
itallovr    0
itallovr

Tme como coloca a imagem de novo ?? sem querer reviver o tópico ;x

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.

×