Olá,Nome: Box SystemAutor: Aksz
Versão Testada: Mix YourOts 8.54
Estou começando na área scripting e estou postando um script.
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 then doPlayerSendTextMessage(cid,22,"Você ganhou um Porygon.") doPlayerAddItem(cid,2128,1) elseif r1 == 2 then doPlayerSendTextMessage(cid,22,"Você ganhou um Hitmonchan.") doPlayerAddItem(cid,2129,1) elseif r1 == 3 then 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:
→ Configurando o Script<action itemid="7884" event="script" value="box.lua"/>
Azul - É a quantidade de Pokemons que terá 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 then
doPlayerSendTextMessage(cid,22,"Você ganhou um Porygon.")
doPlayerAddItem(cid,2128,1)
elseif r1 == 2 then
doPlayerSendTextMessage(cid,22,"Você ganhou um Hitmonchan.")
doPlayerAddItem(cid,2129,1)
elseif r1 == 3 then
doPlayerSendTextMessage(cid,22,"Você ganhou um Hitmonlee.")
doPlayerAddItem(cid,2130,1)
end
end
end
end
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 then
doPlayerSendTextMessage(cid,22,"Você ganhou um Porygon.")
doPlayerAddItem(cid,2128,1)
elseif r1 == 2 then
doPlayerSendTextMessage(cid,22,"Você ganhou um Hitmonchan.")
doPlayerAddItem(cid,2129,1)
elseif r1 == 3 then
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 then 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 then doPlayerSendTextMessage(cid,22,"Você ganhou um Hitmonchan.") local t = doPlayerAddItem(cid, 2222) doItemSetAttribute(t, "description", "This is Hitmonchan's pokeball. HP = ["..(10).."/"..(100).."]") elseif r1 == 3 then doPlayerSendTextMessage(cid,22,"Você ganhou um Hitmonlee.") local r = doPlayerAddItem(cid, 2222) doItemSetAttribute(r, "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 then
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 then
doPlayerSendTextMessage(cid,22,"Você ganhou um Hitmonchan.")
local t = doPlayerAddItem(cid, 2222)
doItemSetAttribute(t, "description", "This is Hitmonchan's pokeball. HP = ["..(10).."/"..(100).."]")
elseif r1 == 3 then
doPlayerSendTextMessage(cid,22,"Você ganhou um Hitmonlee.")
local r = doPlayerAddItem(cid, 2222)
doItemSetAttribute(r, "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 then
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 then
doPlayerSendTextMessage(cid,22,"Você ganhou um Hitmonchan.")
local t = doPlayerAddItem(cid, 2222)
doItemSetAttribute(t, "description", "This is Hitmonchan's pokeball. HP = ["..(10).."/"..(100).."]")
elseif r1 == 3 then
doPlayerSendTextMessage(cid,22,"Você ganhou um Hitmonlee.")
local r = doPlayerAddItem(cid, 2222)
doItemSetAttribute(r, "description", "This is Hitmonlee's pokeball. HP = ["..(10).."/"..(100).."]")
elseif r1 == 4
doPlayerSendTextMessage(cid,22,"Você ganhou um Chansey.")
local o = doPlayerAddItem(cid, 2222)
doItemSetAttribute(o, "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.