Ir para conteúdo

Featured Replies

Postado

Olá pessoal!
Tenho esse script de colheita no meu server, funciona assim:
Tem a árvore com frutos, dou use e ganho uma quantia aleatória de frutas configuradas no math.random, a árvore com frutos se transforma numa sem frutos.

 

local cfg = {


soul = 0,
level = 1
}
local t = {
[{11419}] = {fruit = 2675, NFTree = 4008, fName = "Orange"},
[{5094}] = {fruit = 2676, NFTree = 5092, fName = "Banana"},
[{5096}] = {fruit = 2678, NFTree = 2726, fName = "Coconut"},
[{5157}] = {fruit = 5097, NFTree = 5156, fName = "Mango"}
}
function onUse(cid, item, frompos, item2, topos)
local S = getPlayerSoul(cid)
local L = getPlayerLevel(cid)
for i, k in pairs(t) do
if (isInArray(i, item.itemid) == true) and (S >= cfg.soul) and (L >= cfg.level) then
doTransformItem(item.uid, k.NFTree)
doPlayerAddItem(cid, k.fruit, math.random(1, 10))
doPlayerAddSoul(cid, -cfg.soul)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got some "..k.fName..".")
elseif (S < cfg.soul) then
doPlayerSendCancel(cid, "You do not have soul to harvest the plant.")
elseif (L < cfg.level) then
doPLayerSendCancel(cid, "You are not in the requiered level to harvest.")
end
end
end

 

 

Gostaria que configurassem pra mim para que depois de 3600 segundos, a árvore sem frutos se transforme numa com frutos novamente

 

então ficará assim:
terá a árvore com frutos, eu dou use nela para colher e ganho frutos aleatórios, a árvore com frutos se transforma na sem frutos e depois de 3600 segundos ela se transforma na com frutos novamente.

 

 

~~ klipstyle  - grato pelo math.random, não sabia que poderia ser feito dessa forma mas funcionou!

 

grato!

Editado por biel.stocco (veja o histórico de edições)

Resolvido por zipter98

Ir para solução
  • Respostas 15
  • Visualizações 743
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • vou tentar ajudar primeiro com a quantia aleatória, até porque sou meio amador na área.

  • http://www.tibiaking.com/forum/forum/220-aulas-de-scripting/

  • local cfg = {     soul = 0,     time = 3600,     level = 1 } local t = {     [{11419}] = {fruit = 2675, NFTree = 4008, fName = "Orange"},     [{5094}] = {fruit = 2676, NFTree = 5092, fName = "Banana"}

Postado

não sei se pode se usar math.ramdom dessa forma porem se não der erro acredito que a quantia sera aleatória.

 

local cfg = {


soul = 0,
level = 1
}
local t = {
[{11419}] = {fruit = 2675, NFTree = 4008, amount = math.random(1, 10), fName = "Orange"},
[{5094}] = {fruit = 2676, NFTree = 5092, amount = math.random(1, 10), fName = "Banana"},
[{5096}] = {fruit = 2678, NFTree = 2726, amount = math.random(1, 10), fName = "Coconut"},
[{5157}] = {fruit = 5097, NFTree = 5156, amount = math.random(1, 10), fName = "Mango"}
}
function onUse(cid, item, frompos, item2, topos)
local S = getPlayerSoul(cid)
local L = getPlayerLevel(cid)
for i, k in pairs(t) do
if (isInArray(i, item.itemid) == true) and (S >= cfg.soul) and (L >= cfg.level) then
doTransformItem(item.uid, k.NFTree)
doPlayerAddItem(cid, k.fruit, k.amount)
doPlayerAddSoul(cid, -cfg.soul)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got some "..k.fName..".")
elseif (S < cfg.soul) then
doPlayerSendCancel(cid, "You do not have soul to harvest the plant.")
elseif (L < cfg.level) then
doPLayerSendCancel(cid, "You are not in the requiered level to harvest.")
end
end
end

www.pokemiw.com
24 Horas Online - 1º 2º 3º 4º 5º 6º 7º gerações 100%
 

Postado
  • Autor

não sei se pode se usar math.ramdom dessa forma porem se não der erro acredito que a quantia sera aleatória.

 

local cfg = {

soul = 0,

level = 1

}

local t = {

[{11419}] = {fruit = 2675, NFTree = 4008, amount = math.random(1, 10), fName = "Orange"},

[{5094}] = {fruit = 2676, NFTree = 5092, amount = math.random(1, 10), fName = "Banana"},

[{5096}] = {fruit = 2678, NFTree = 2726, amount = math.random(1, 10), fName = "Coconut"},

[{5157}] = {fruit = 5097, NFTree = 5156, amount = math.random(1, 10), fName = "Mango"}

}

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

local S = getPlayerSoul(cid)

local L = getPlayerLevel(cid)

for i, k in pairs(t) do

if (isInArray(i, item.itemid) == true) and (S >= cfg.soul) and (L >= cfg.level) then

doTransformItem(item.uid, k.NFTree)

doPlayerAddItem(cid, k.fruit, k.amount)

doPlayerAddSoul(cid, -cfg.soul)

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got some "..k.fName..".")

elseif (S < cfg.soul) then

doPlayerSendCancel(cid, "You do not have soul to harvest the plant.")

elseif (L < cfg.level) then

doPLayerSendCancel(cid, "You are not in the requiered level to harvest.")

end

end

end

 

 

 

não sei o motivo, mas só vem de 6 em 6 com esse script, e nele não foi configurado para depois de 3600 segundos a árvore sem frutos se transformar na com frutos ;x

 

mas se conseguir apenas 1 das ações, eu dou rep+

Postado

vou tentar ajudar primeiro com a quantia aleatória, até porque sou meio amador na área.

local cfg = {


soul = 0,
level = 1
}
local t = {
[{11419}] = {fruit = 2675, NFTree = 4008, fName = "Orange"},
[{5094}] = {fruit = 2676, NFTree = 5092, fName = "Banana"},
[{5096}] = {fruit = 2678, NFTree = 2726, fName = "Coconut"},
[{5157}] = {fruit = 5097, NFTree = 5156, fName = "Mango"}
}
function onUse(cid, item, frompos, item2, topos)
local S = getPlayerSoul(cid)
local L = getPlayerLevel(cid)
for i, k in pairs(t) do
if (isInArray(i, item.itemid) == true) and (S >= cfg.soul) and (L >= cfg.level) then
doTransformItem(item.uid, k.NFTree)
doPlayerAddItem(cid, k.fruit, math.random(1, 10))
doPlayerAddSoul(cid, -cfg.soul)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got some "..k.fName..".")
elseif (S < cfg.soul) then
doPlayerSendCancel(cid, "You do not have soul to harvest the plant.")
elseif (L < cfg.level) then
doPLayerSendCancel(cid, "You are not in the requiered level to harvest.")
end
end
end

www.pokemiw.com
24 Horas Online - 1º 2º 3º 4º 5º 6º 7º gerações 100%
 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo