Ir para conteúdo
Entre para seguir isso  
Dean W.

Box (Script Pokemon)

Recommended Posts

Dean W.    0
Dean W.
Nome: Box System

Autor: Aksz

Versão Testada: Mix YourOts 8.54

Olá,

Estou começando na área scripting e estou postando meu primeiro scripting aqui na OTBR.

 

Bom, trouxe hoje aqui para vocês o script Box, para quem ja jogou P.O deve conhecer, você abre por exemplo uma Box 2 e sai um Pokemon.

 

Hoje estou postando um exemplo da Box 3.

Que para abrir ela precisa de level 60.

 

Chega de conversar e vamos pro scripting.

 

Adicione isto com o nome de box.lua na pasta data/actions/scripts:

 

function onUse(cid, item, frompos, item2, topos)
r1 = math.random(1,3)
if getPlayerLevel(cid) >= 60 then
if doPlayerRemoveItem(cid,7884,1) == TRUE then
if r1 == 1
doPlayerSendTextMessage(cid,22,"Você ganhou um Porygon.")
doPlayerAddItem(cid,2128,1)

elseif r1 == 2
doPlayerSendTextMessage(cid,22,"Você ganhou um Hitmonchan.")
doPlayerAddItem(cid,2129,1)

elseif r1 == 3
doPlayerSendTextMessage(cid,22,"Você ganhou um Hitmonlee.")
doPlayerAddItem(cid,2130,1)
end
end
end
end

 

Agora adicione isto no Actions.xml na pasta data/actions:

<action itemid="7884" event="script" value="box.lua"/>
Configurando o Script

 

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

r1 = math.random(1,3)

if getPlayerLevel(cid) >= 60 then

if doPlayerRemoveItem(cid,7884,1) == TRUE then

if r1 == 1

doPlayerSendTextMessage(cid,22,"Você ganhou um Porygon.")

doPlayerAddItem(cid,2128,1)

 

elseif r1 == 2

doPlayerSendTextMessage(cid,22,"Você ganhou um Hitmonchan.")

doPlayerAddItem(cid,2129,1)

 

elseif r1 == 3

doPlayerSendTextMessage(cid,22,"Você ganhou um Hitmonlee.")

doPlayerAddItem(cid,2130,1)

end

end

end

end

Azul - É a quantidade de Pokemons que terá na Box.

Preto - É o level que precisa usar a Box.

Laranja - É o ID da Box.

Vermelho - É o nome do Pokemon que aparecerá na mensagem quando abrir a Box.

Roxo - ID da Pokebola do Pokemon.

 

Obs: Se você for trocar o ID da Box no script terá que trocar na tag também.

[/color][/color]

<action itemid="7884" event="script" value="box.lua"/>

Preto - ID da Box.

 

Adicionando outro Pokemon na Box

 

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

r1 = math.random(1,3)

if getPlayerLevel(cid) >= 60 then

if doPlayerRemoveItem(cid,7884,1) == TRUE then

if r1 == 1

doPlayerSendTextMessage(cid,22,"Você ganhou um Porygon.")

doPlayerAddItem(cid,2128,1)

 

elseif r1 == 2

doPlayerSendTextMessage(cid,22,"Você ganhou um Hitmonchan.")

doPlayerAddItem(cid,2129,1)

 

elseif r1 == 3

doPlayerSendTextMessage(cid,22,"Você ganhou um Hitmonlee.")

doPlayerAddItem(cid,2130,1)

 

elseif r1 == 4

doPlayerSendTextMessage(cid,22,"Você ganhou um Chansey.")

doPlayerAddItem(cid,2131,1)

end

end

end

end

 

Preto - Troque pela quantidade de Pokemons que você colocar.

Vermelho - Mais um pokemon.

Azul - Troque sempre que for adicionar um pokemon.

Exemplo: Em cima está 3, no próximo pokemon coloque 4, no próximo pokemon coloque 5 e vai...

Cinza - Nome do novo pokemon.

Verde - ID da pokebola do novo pokemon.

 

→ Script Box, funciona no Go/Back do MatheusMkalo

 

Adicione isto com o nome de box.lua em data/actions/scripts:

function onUse(cid, item, frompos, item2, topos)
r1 = math.random(1,3)
if getPlayerLevel(cid) >= 60 then
if doPlayerRemoveItem(cid,7884,1) == TRUE then
if r1 == 1
doPlayerSendTextMessage(cid,22,"Você ganhou um Porygon.")
local s = doPlayerAddItem(cid, 2222)
doItemSetAttribute(s, "description", "This is Porygon's pokeball. HP = ["..(10).."/"..(100).."]")

elseif r1 == 2
doPlayerSendTextMessage(cid,22,"Você ganhou um Hitmonchan.")
local s = doPlayerAddItem(cid, 2222)
doItemSetAttribute(s, "description", "This is Hitmonchan's pokeball. HP = ["..(10).."/"..(100).."]")

elseif r1 == 3
doPlayerSendTextMessage(cid,22,"Você ganhou um Hitmonlee.")
local s = doPlayerAddItem(cid, 2222)
doItemSetAttribute(s, "description", "This is Hitmonlee's pokeball. HP = ["..(10).."/"..(100).."]")
end
end
end
end

 

Agora, adicione isto no actions.xml:

<action itemid="7884" event="script" value="box.lua"/>

 

Configurando

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

r1 = math.random(1,3)

if getPlayerLevel(cid) >= 60 then

if doPlayerRemoveItem(cid,7884,1) == TRUE then

if r1 == 1

doPlayerSendTextMessage(cid,22,"Você ganhou um Porygon.")

local s = doPlayerAddItem(cid, 2222)

doItemSetAttribute(s, "description", "This is Porygon's pokeball. HP = ["..(10).."/"..(100).."]")

 

elseif r1 == 2

doPlayerSendTextMessage(cid,22,"Você ganhou um Hitmonchan.")

local s = doPlayerAddItem(cid, 2222)

doItemSetAttribute(s, "description", "This is Hitmonchan's pokeball. HP = ["..(10).."/"..(100).."]")

 

elseif r1 == 3

doPlayerSendTextMessage(cid,22,"Você ganhou um Hitmonlee.")

local s = doPlayerAddItem(cid, 2222)

doItemSetAttribute(s, "description", "This is Hitmonlee's pokeball. HP = ["..(10).."/"..(100).."]")

end

end

end

end

 

Preto - Quantidade de Pokemons

Vermelho - Level que poderá usar a Box

Laranja - ID da Box

Vinho - Nome do Pokemon que aparecerá na mensagem

Roxo - ID da Pokebola que você configurou no script do MatheusMkalo.

Verde - Nome do Pokemon

Azul - HP do Pokemon e HP maxima do Pokemon

Exemplo: Aparecerá in-game [10/100], você tem que colocar o HP de acordo que você configurou no script do MatheusMkalo, coloque [1000/1000], se o pokemon tiver esse HP e o HPMax.

 

Adicionando um novo pokemon

 

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

r1 = math.random(1,4)

if getPlayerLevel(cid) >= 60 then

if doPlayerRemoveItem(cid,7884,1) == TRUE then

if r1 == 1

doPlayerSendTextMessage(cid,22,"Você ganhou um Porygon.")

local s = doPlayerAddItem(cid, 2222)

doItemSetAttribute(s, "description", "This is Porygon's pokeball. HP = ["..(10).."/"..(100).."]")

 

elseif r1 == 2

doPlayerSendTextMessage(cid,22,"Você ganhou um Hitmonchan.")

local s = doPlayerAddItem(cid, 2222)

doItemSetAttribute(s, "description", "This is Hitmonchan's pokeball. HP = ["..(10).."/"..(100).."]")

 

elseif r1 == 3

doPlayerSendTextMessage(cid,22,"Você ganhou um Hitmonlee.")

local s = doPlayerAddItem(cid, 2222)

doItemSetAttribute(s, "description", "This is Hitmonlee's pokeball. HP = ["..(10).."/"..(100).."]")

elseif r1 == 4

doPlayerSendTextMessage(cid,22,"Você ganhou um Chansey.")

local s = doPlayerAddItem(cid, 2222)

doItemSetAttribute(s, "description", "This is Chansey's pokeball. HP = ["..(1000).."/"..(1000).."]")

end

end

end

end

 

Preto - A quantidade de Pokemons

Vermelho - Novo script do pokemon

Azul - Mude sempre que for adicionar um pokemon

Exemplo: Se o de cima for 10 o próximo pokemon tem que ser 11.

Laranja - Nome do novo pokemon que aparecerá na mensagem

Cinza - Nome do novo pokemon

Vinho - HP do novo pokemon

Pronto, acabou.

Dúvidas, Bug's e Erros? Poste aqui.

 

Créditos:

Aksz - Fazer o script da box

Kydrai - Adicionar a função para dar certo o script em uma pokebola só.

 

Att,

Aksz.

Editado por Dean W.

Compartilhar este post


Link para o post
Antharaz    4
Antharaz

 

Vamos lá...

 

if getPlayerLevel(cid) >= 60 then

else

 

Ou seja, se ele tiver level maior ou igual a 60 não acontece nada né? O que você diz no tópico é o seguinte:

 

Hoje estou postando um exemplo da Box 3.

Que para abrir ela precisa de level 60.

 

Mesmo que fosse < ao invés de >= não faz sentido por um else logo embaixo...

 

Acho que nenhum servidor usa 1 pokebola com id diferente para cada pokemon, seria adicionar vários novos itens o que traria muito trabalho...

 

Ficaria melhor com tables...

 

 

Mas enfim, o erro ta o que dise no começo mesmo... quando arrumar eu aprovo.

 

 

 

Aprovado

 

Lembrando que só vai funcionar em servidores que usam 1 pokeball de id diferente por pokemon.(se é que existe algum assim ¬¬)

Editado por Antharaz

Compartilhar este post


Link para o post
perestp    0
perestp

Massa

O problema da pokeball deve dar pra se editar e resolver depois tento se conseguir posto aki

Compartilhar este post


Link para o post
Dean W.    0
Dean W.

Atualizado:

 

  • Adicionado Script que pega no Go/Back do MatheusMkalo

 

Att,

Aksz.

Compartilhar este post


Link para o post
rgreis013    0
rgreis013

Otimo script, quem sabe pode servir para alguem.

Compartilhar este post


Link para o post
Kydrai    0
Kydrai

Boa, mas é como o Antharaz falou.

A versão do MatheusMkalo ta melhorzinha.

Estude sobre tabelas que você conseguirá encurtar e facilitar bastante a edição desse script.

Compartilhar este post


Link para o post
PokemonStart    0
PokemonStart

Script para os novos sistemas do Matheus Mkalo.

 

 

 

local pokes = {
["Pidgey"] = {health = 100, maxhealth = 100},
["Caterpie"] = {health = 100, maxhealth = 100},
["Rattata"] = {health = 100, maxhealth = 100},
["Weedle"] = {health = 100, maxhealth = 100},
}

function onUse(cid, item, frompos, item2, topos)
for i,x in pairs(pokes) do
r1 = math.random(1,4)
if getPlayerLevel(cid) >= 5 then
if doPlayerRemoveItem(cid,7884,1) == TRUE then


if r1 == 1 then
local s = doPlayerAddItem(cid, 2661)
doItemSetAttribute(s, "poke", "This is "..i.."'s pokeball. HP = ["..x.health.."/"..x.maxhealth.."]")
doItemSetAttribute(s, "description", "Contains a "..i.."")
doSendMagicEffect(topos, 29)
doPlayerSendTextMessage(cid,22,"Você ganhou um Pidgey.")

elseif r1 == 2 then
local s = doPlayerAddItem(cid, 2661)
doItemSetAttribute(s, "poke", "This is "..i.."'s pokeball. HP = ["..x.health.."/"..x.maxhealth.."]")
doItemSetAttribute(s, "description", "Contains a "..i.."")
doSendMagicEffect(topos, 29)
doPlayerSendTextMessage(cid,22,"Você ganhou um Caterpie.")

elseif r1 == 3 then
local s = doPlayerAddItem(cid, 2661)
doItemSetAttribute(s, "poke", "This is "..i.."'s pokeball. HP = ["..x.health.."/"..x.maxhealth.."]")
doItemSetAttribute(s, "description", "Contains a "..i.."")
doSendMagicEffect(topos, 29)
doPlayerSendTextMessage(cid,22,"Você ganhou um Rattata.")

elseif r1 == 4 then
local s = doPlayerAddItem(cid, 2661)
doItemSetAttribute(s, "poke", "This is "..i.."'s pokeball. HP = ["..x.health.."/"..x.maxhealth.."]")
doItemSetAttribute(s, "description", "Contains a "..i.."")
doSendMagicEffect(topos, 29)
doPlayerSendTextMessage(cid,22,"Você ganhou um Weedle.")

end
end
end
end
end

Editado por PokemonStart

Compartilhar este post


Link para o post
infernatil    0
infernatil

Muito bom esse script ajudara muito a pessoas que estão querendo criar um server de poketibia.

Compartilhar este post


Link para o post
OlhoHell    1
OlhoHell

Parabéns Bom Aprovado olhohellaproves.gif

Compartilhar este post


Link para o post
Guiminhah    0
Guiminhah

[16/11/2010 16:34:03] [Error - LuaScriptInterface::loadFile] data/actions/scripts/box4.lua:6: 'then' expected near 'doPlayerSendTextMessage'

[16/11/2010 16:34:03] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/box4.lua)

[16/11/2010 16:34:03] data/actions/scripts/box4.lua:6: 'then' expected near 'doPlayerSendTextMessage'

 

 

????????????

 

tipo, eu tive que mudar o script, porque na versão tfs, o sistema de go/back é baseado no setAtributte do nome da pokeball. entao meu script tá assim:

 

[spoiler=BOX.lua]function onUse(cid, item, frompos, item2, topos)

r1 = math.random(1,3)

if getPlayerLevel(cid) >= 60 then

if doPlayerRemoveItem(cid,7891,1) == TRUE then

if r1 == 1

doPlayerSendTextMessage(cid,22,"Você ganhou um Porygon.")

local s = doPlayerAddItem(cid, 2532)

doItemSetAttribute(s, "name", "porygon Pokeball")

 

elseif r1 == 2

doPlayerSendTextMessage(cid,22,"Você ganhou um Raichu.")

local s = doPlayerAddItem(cid, 2532)

doItemSetAttribute(s, "name", "raichu Pokeball")

 

elseif r1 == 3

doPlayerSendTextMessage(cid,22,"Você ganhou um Electabuzz.")

local s = doPlayerAddItem(cid, 2532)

doItemSetAttribute(s, "name", "electabuzz Pokeball")

 

end

end

end

end

 

Editado por Guiminhah

Compartilhar este post


Link para o post
Konkordax    0
Konkordax


local pokes = {
[1] = {name = Pidgey, health = 100, maxhealth = 100},
[2] = {name = Caterpie, health = 100, maxhealth = 100},
[3] = {name = Rattata, health = 100, maxhealth = 100},
[4] = {name = Weedle, health = 100, maxhealth = 100},
}
function onUse(cid, item, frompos, item2, topos)

local s = doPlayerAddItem(cid, 2661)
local rand = pokes[math.random(1,4)]
if getPlayerLevel(cid) >= 5 then
if doPlayerRemoveItem(cid,7884,1) then
	if rand then
		doItemSetAttribute(s, "poke", "This is ".. rand.name .."'s pokeball. HP = ["..rand.health.."/"..rand.maxhealth.."]")
		doItemSetAttribute(s, "description", "Contains a ".. rand.name .."")
		doSendMagicEffect(topos, 29)
		doPlayerSendTextMessage(cid,22,"Você ganhou um ".. rand.name ..")
	end
else
	doPlayerSendCancel(cid, "You do not have required item.")
end
else
doPlayerSendCancel(cid, "You must have level 5.")
end
return true
end  

 

;)

Compartilhar este post


Link para o post
Kuma Bear    33
Kuma Bear

Queria este script que Funfe no Poke Serv 4.1 Edited Family..

Se não for incomodo claro x.X

 

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

×