muito bom, isso vai ser util para min futuramente
- Forums
- OTServ
- Recursos
- Scripting
- Actions e Talkactions
- Fruit Picking (Colheita de fruta)
Fruit Picking (Colheita de fruta)
By RigBy, 02 de jul. de 2015 in Actions e Talkactions
info
Group: Visconde
Joined: 28/02/14
Posts: 416
Reputation: +90
Gender: Masculino

info
Group: Visconde
Joined: 05/02/14
Posts: 411
Reputation: +285
Gender: Masculino
Tibia Character: Zeh Sergipano

obrigado.
info
Group: Visconde
Joined: 07/01/12
Posts: 495
Reputation: +48
Gender: Masculino
Tibia Character: Nem Tenho

Amigo, e se no caso eu quisesse que isso fosse usado em um item ? por exemplo, uma tesoura ira coletar os frutos ? REP+, desde já agradeço.
info
Group: Visconde
Joined: 05/02/14
Posts: 411
Reputation: +285
Gender: Masculino
Tibia Character: Zeh Sergipano

Amigo, e se no caso eu quisesse que isso fosse usado em um item ? por exemplo, uma tesoura ira coletar os frutos ? REP+, desde já agradeço.
Ai
.lua
-- Do not remove the credits --
-- [ACTION] Fruit Harvesting --
-- Developed by Rigby --
-- Especially for the Xtibia.com --
local config = {
-- [ID_DA_ARVORE] = {FRUTA, QUANTIDADE{minimo, maximo}, ID_DA_ARVORE_SEM_FRUTO, TEMPO_PARA_ÀRVORE_FICA_COM_FRUTO}
[5157] = {fruit = 5097, quantity = {0,1}, treeWithoutFruit = 5156, timeToGrow = 5},
[4006] = {fruit = 2675, quantity = {0,3}, treeWithoutFruit = 4008, timeToGrow = 20},
[5094] = {fruit = 2676, quantity = {3,6}, treeWithoutFruit = 5092, timeToGrow = 30},
[5096] = {fruit = 2678, quantity = {2,7}, treeWithoutFruit = 2726, timeToGrow = 70},
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
for i, k in pairs(config) do
if itemEx.itemid == i then
random = math.random(k.quantity[1],k.quantity[2])
doTransformItem(itemEx.uid, k.treeWithoutFruit, 1)
doPlayerAddItem(cid,k.fruit,random)
addEvent(function()
doTransformItem(getThingFromPos(toPosition).uid, i)
end, k.timeToGrow * 1000)
if random > 0 then
doPlayerSendTextMessage(cid,27,"Você pego "..random.." "..getItemNameById(k.fruit).."!")
else
doPlayerSendTextMessage(cid,27,"Àrvore não deu nenhum fruto!")
end
end
end
return true
end
<action itemid="ID_DO_ITEM" event="script" value="NOME_DO_SCRIPT.lua"/>
info
Group: Visconde
Joined: 07/01/12
Posts: 495
Reputation: +48
Gender: Masculino
Tibia Character: Nem Tenho

Não posso testar agora, mais com certeza deve funcionar, REP+ novamente, obrigado.
info
Group: Visconde
Joined: 20/06/15
Posts: 331
Reputation: +205
Gender: Masculino

Otimo topico RigBy.
Porem a linha arvore 5094 não existe em meu OTServ mas já resolvi , e também tava crescendo em imediato os frutos.
Mas fora isso tudo funcionou perfeitamente.
Rep +
info
Group: Visconde
Joined: 05/02/14
Posts: 411
Reputation: +285
Gender: Masculino
Tibia Character: Zeh Sergipano

Não posso testar agora, mais com certeza deve funcionar, REP+ novamente, obrigado.
Blz
Otimo topico RigBy.
Porem a linha arvore 5094 não existe em meu OTServ mas já resolvi , e também tava crescendo em imediato os frutos.
Mas fora isso tudo funcionou perfeitamente.
Rep +
Ué, so basta você modifica o tempo em "timeToGrow", da pra adicionar mais, so basta adiciona isso dentro do "local config = {"
[ID_DA_ARVORE] = {FRUTA, QUANTIDADE{minimo, maximo}, ID_DA_ARVORE_SEM_FRUTO, TEMPO_PARA_ÀRVORE_FICA_COM_FRUTO},
Ficando
[5096] = {fruit = 2678, quantity = {2,7}, treeWithoutFruit = 2726, timeToGrow = 70},
info
Group: Lorde
Joined: 22/07/12
Posts: 2.2k
Reputation: +453
Tibia Character: Kissy

Parabéns cara muito foda ![]()
info
Group: Visconde
Joined: 05/02/14
Posts: 411
Reputation: +285
Gender: Masculino
Tibia Character: Zeh Sergipano

Tava testando a TFS 1.2, e acabei adaptando esse script, então ta ai quem quiser.
-- Do not remove the credits --
-- [ACTION] Fruit Harvesting [TFS 1.2]--
-- Developed by Rigby --
-- Especially for the Xtibia.com --
local config = {
-- [ID_DA_ARVORE] = {FRUTA, QUANTIDADE{minimo, maximo}, ID_DA_ARVORE_SEM_FRUTO, TEMPO_PARA_ÀRVORE_FICA_COM_FRUTO}
[5157] = {fruit = 5097, quantity = {0,1}, treeWithoutFruit = 5156, timeToGrow = 5},
[4006] = {fruit = 2675, quantity = {0,3}, treeWithoutFruit = 4008, timeToGrow = 5},
[5094] = {fruit = 2676, quantity = {3,6}, treeWithoutFruit = 5092, timeToGrow = 5},
[5096] = {fruit = 2678, quantity = {2,7}, treeWithoutFruit = 2726, timeToGrow = 5},
}
function onUse(player, item, fromPosition, itemEx, toPosition)
for i, k in pairs(config) do
if item:getId() == i then
random = math.random(k.quantity[1],k.quantity[2])
item:transform(k.treeWithoutFruit)
player:addItem(k.fruit, random)
addEvent(function()
item:transform(i)
end, k.timeToGrow * 1000)
if random > 0 then
player:sendTextMessage(27,"Você pego "..random.." "..ItemType(k.fruit):getName().."!")
else
player:sendTextMessage(27,"Àrvore não deu nenhum fruto!")
end
end
end
return true
end
info
Group: Campones
Joined: 21/06/15
Posts: 36
Reputation: +15

Ola , Script Muito Bom , Mas Poderia Fazer De Tal Forma : Eu Uso Tal Item "tesoura" Na Arvore , E O Player Fica Uns 3 Segundos Com Outra Outfit Sem Poder Se Mecher , Depois Desses 3 Segundos A Arvore Fica Sem Frutos E O Player Volta A Sua Outfit Normal .




info
Group: Visconde
Joined: 05/02/14
Posts: 411
Reputation: +285
Gender: Masculino
Tibia Character: Zeh Sergipano
Fruit Picking
Introdução: é um sistema simples, consiste em você pode colher a fruta da arvore e ela crescer depois de um tempo de novo.
Instalar o script:
em action/script crie: FruitHarvesting.lua
adicione:
-- Do not remove the credits -- -- [ACTION] Fruit Harvesting -- -- Developed by Rigby -- -- Especially for the Xtibia.com -- local config = { -- [ID_DA_ARVORE] = {FRUTA, QUANTIDADE{minimo, maximo}, ID_DA_ARVORE_SEM_FRUTO, TEMPO_PARA_ÀRVORE_FICA_COM_FRUTO} [5157] = {fruit = 5097, quantity = {0,1}, treeWithoutFruit = 5156, timeToGrow = 5}, [4006] = {fruit = 2675, quantity = {0,3}, treeWithoutFruit = 4008, timeToGrow = 20}, [5094] = {fruit = 2676, quantity = {3,6}, treeWithoutFruit = 5092, timeToGrow = 30}, [5096] = {fruit = 2678, quantity = {2,7}, treeWithoutFruit = 2726, timeToGrow = 70}, } function onUse(cid, item, fromPosition, itemEx, toPosition) for i, k in pairs(config) do if (isInArray(i, item.itemid) == true) then random = math.random(k.quantity[1],k.quantity[2]) doTransformItem(item.uid, k.treeWithoutFruit, 1) doPlayerAddItem(cid,k.fruit,random) addEvent(function() doTransformItem(getThingFromPos(toPosition).uid, i) end, k.timeToGrow * 1000) if random > 0 then doPlayerSendTextMessage(cid,27,"Você pego "..random.." "..getItemNameById(k.fruit).."!") else doPlayerSendTextMessage(cid,27,"Àrvore não deu nenhum fruto!") end end end return true endem action/action.xml
adicione a tag:
Se você adicionar mais arvore não esqueça de adiciona o id na tag também.
Edited Julho 2 by RigBy