AK

[Actions]Box System

Por Aksz, 12 de nov. de 2010 em Actions e Talkactions

script
20
6.7k
AkszA
12 de novembro de 2010 às 12:44
Nome: Box System

Autor: Aksz

Versão Testada: Mix YourOts 8.54

Olá,

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:

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

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

Editado Novembro 12 por Aksz

tinferT
12 de novembro de 2010 às 13:06

Gostei dos seus scripts cara,mais da para melhorar usando tabbles,irá diminuir muitos eles...

 

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

local box = {
[1] ={item = 7884,msg = "Você ganhou um Porygon."},
[2] ={item = 2129,msg = "Você ganhou um Hitmonchan."},
[3] ={item = 2130,msg = "Você ganhou um Hitmonlee."}
}
local level = 60
local e = box[math.random(1,3)]

if getPlayerLevel(cid) >= level then
doPlayerSendTextMessage(cid,22,e.msg) 
doPlayerAddItem(cid, e.item, 1) 
doRemoveItem(item.uid, 1)
else
doPlayerSendCancel(cid, "Você deve ter level "..level.." ou mais para abriar esta box.") 
end 
return TRUE
end

AkszA
12 de novembro de 2010 às 13:16

@Spits

Valeu, to começando em scripting e você me ajudou bastante '-'

add.pngREP

thequestionT
12 de novembro de 2010 às 16:37

Pois é, todos fazendo scripts para Pokemon, espero que inovem também, e não só copiem...

Parabéns

Editado Novembro 12 por TheQuestion

brunin86B
12 de novembro de 2010 às 19:42

Você podia me ajudar?

Queria assim : Ao usar o item 7884 ( no caso : pokeball ) adicionasse o item equivalente ao id 2653 ( até ai eu sei fazer ) mas queria que ao invés de adicionar a descrição no item:

 

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

 

Adicionar sim, um actionid.

Que no meu caso, é 1 id para todas as pokeballs só que cada uma com o actionid diferente.

tinferT
12 de novembro de 2010 às 20:57

@UP

 

ve se é isso q vc quer:

 

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

local box = { 
[1] ={msg = "Você ganhou um Porygon.",action_id = 10}, 
[2] ={msg = "Você ganhou um Hitmonchan.",action_id = 11}, 
[3] ={msg = "Você ganhou um Hitmonlee.",action_id = 12},
[4] ={msg = "Você ganhou um Chansey.",action_id = 13} 
} 
local level = 60 -- level para usar
local item = 2222 -- do seu item
local e = box[math.random(1,4)] 

if getPlayerLevel(cid) >= level then 
doPlayerSendTextMessage(cid,22,e.msg)  
b = doPlayerAddItem(cid, item, 1)
doItemSetAttribute(b, "aid", e.action_id)  
doRemoveItem(item.uid, 1) 
else 
doPlayerSendCancel(cid, "Você deve ter level "..level.." ou mais para abriar esta box.")  
end  
return TRUE 
end

Editado Novembro 12 por Spits

RodrigoScR
13 de novembro de 2010 às 01:29

Alguem pode hacer este script para Pokemon Server V.41 Edited FAMILIAR?

queria que ao invés de adicionar a descrição no item Adicionar um name com /attr set name "pidgey Pokeball

Editado Novembro 13 por RodrigoSigrist

LaisDosOtsL
13 de novembro de 2010 às 09:32

Muito legal, já havia visto seu post em outro forum =]

brunin86B
13 de novembro de 2010 às 09:45

@Spits, vlw isso msm REP+

papamixP
14 de novembro de 2010 às 02:32

Bom script de box,eu tava procurano um desses pro meu serv. Vlw

Assim que eu puder do Rep+ pra vc.

15 de novembro de 2010 às 12:29

So uma observacao, o legal da box e que ela nao diz que pokemon.



Ai fica o misterio, entao se tiver como tire a mensagem.

lucas760895L
16 de novembro de 2010 às 11:37

eu queria saber como faz pra por no poke v4.1 eu coloquei tudo certinho do use no item mas nao vai, nem se quer se mexe o item alguem pode me ajudar?!

gluglugugaG
16 de novembro de 2010 às 16:41

Para funcionar no pokeserver v4.1 EDIT BY FAMILIA...

 

Ao invés de

 

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

 

trocar por

 

doItemSetAttribute(r, "name", "pidgey Pokeball")

 

o script ficando então assim:

 

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, 2532)

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

 

elseif r1 == 2 then

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

local t = doPlayerAddItem(cid, 2532)

doItemSetAttribute(t, "name", "hitmonchan Pokeball")

 

elseif r1 == 3 then

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

local r = doPlayerAddItem(cid, 2532)

doItemSetAttribute(r, "name", "hitmonlee Pokeball")

end

end

end

end

RodrigoScR
16 de novembro de 2010 às 19:05

+REP glugluguga :D

lucas760895L
17 de novembro de 2010 às 10:01

vlw :) rep+!