muito bom, isso vai ser util para min futuramente
- Fórum
- OTServ
- Recursos
- Scripting
- Actions e Talkactions
- Fruit Picking (Colheita de fruta)
Fruit Picking (Colheita de fruta)
Por RigBy, 02 de jul. de 2015 em Actions e Talkactions
info
Grupo: Visconde
Registrado: 28/02/14
Posts: 416
Reputação: +90
Gênero: Masculino

info
Grupo: Visconde
Registrado: 05/02/14
Posts: 411
Reputação: +285
Gênero: Masculino
Char no Tibia: Zeh Sergipano

obrigado.
info
Grupo: Visconde
Registrado: 07/01/12
Posts: 495
Reputação: +48
Gênero: Masculino
Char no Tibia: 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
Grupo: Visconde
Registrado: 05/02/14
Posts: 411
Reputação: +285
Gênero: Masculino
Char no Tibia: 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
Grupo: Visconde
Registrado: 07/01/12
Posts: 495
Reputação: +48
Gênero: Masculino
Char no Tibia: Nem Tenho

Não posso testar agora, mais com certeza deve funcionar, REP+ novamente, obrigado.
info
Grupo: Visconde
Registrado: 20/06/15
Posts: 331
Reputação: +205
Gênero: 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
Grupo: Visconde
Registrado: 05/02/14
Posts: 411
Reputação: +285
Gênero: Masculino
Char no Tibia: 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
Grupo: Lorde
Registrado: 22/07/12
Posts: 2.2k
Reputação: +453
Char no Tibia: Kissy

Parabéns cara muito foda ![]()
info
Grupo: Visconde
Registrado: 05/02/14
Posts: 411
Reputação: +285
Gênero: Masculino
Char no Tibia: 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
Grupo: Campones
Registrado: 21/06/15
Posts: 36
Reputação: +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
Grupo: Visconde
Registrado: 05/02/14
Posts: 411
Reputação: +285
Gênero: Masculino
Char no Tibia: 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.
Editado Julho 2 por RigBy