Por Killua, 31 de jan. de 2011 em Actions e Talkactions
info
Grupo: Conde
Registrado: 29/04/09
Posts: 904
Reputação: +389
Char no Tibia: Jabuti Selvagem
Nome do Sistema ou Script: HarvestNome do Autor: amoeba13 Servidor Testado e/ou Versão do Tibia: Não testei, mas fiz com base no tfs 0.3.6 Descrição e/ou Informações Adicionais: Eu fiz aquele sisteminha de harvest lá que o cara corta as árvores com o pokemon e ganha umas 'berry'.
Nome do Autor: amoeba13
Servidor Testado e/ou Versão do Tibia: Não testei, mas fiz com base no tfs 0.3.6
Descrição e/ou Informações Adicionais: Eu fiz aquele sisteminha de harvest lá que o cara corta as árvores com o pokemon e ganha umas 'berry'.
Eu resolvi fazer meu primeiro script para pokemon, visto que, todo mundo só pensa em fazer servidor de pokemon =S
Vá em data/actions e crie harvest.lua. Nele coloque:
local config = {
premios = {
{id="5901",chance=50},
{id="2677",chance=50},
{id="2679",chance=50}
}
local function doRemoveItemFromPos(position, itemid, count)
local item = getTileItemById(position, itemid)
if(item.uid ~= 0)then
return doRemoveItem(item.uid, count or -1)
end
return false
function onUse(cid, item, fromPos, item2, toPos)
local pokes = {
['Bulbasaur'] = {1},
['Ivysaur'] = {1},
['Venusaur'] = {1},
['Bellsprout'] = {1},
['Vileplume'] = {1},
['Weepinbell'] = {1},
['Victreebel'] = {1},
['Farfetchd'] = {1},
['Exeggutor'] = {1},
['Scyther'] = {1},
['Tangela'] = {1},
local summons = getCreatureSummons(cid)
if #summons < 1 then
return doPlayerSendCancel(cid, 'You need a pokemon to use harvest!')
local pokemon = pokes[getCreatureName(getCreatureSummons(cid)[1])]
local name = getCreatureName(getCreatureSummons(cid)[1])
if not pokes[name] then
return doPlayerSendCancel(cid, "Your pokemon can not use harvest.")
if itemEx.itemid == 2700 then
if os.time()-getPlayerStorageValue(cid, 82941) > 60 then
setPlayerStorageValue(cid, 82941, os.time())
local m = math.random(1,#config.premios)
if math.random(1,100) <= config.premios[m].chance then
doPlayerAddItem(cid, config.premios[m].id)
doSendAnimatedText(getThingPos(itemEx.uid), "SUCCES", 30)
local pos = getThingPos(itemEx.uid)
doRemoveItem(itemEx.uid)
doCreateItem(3872, 1, toPosition)
doCreatureSay(cid, "Harvest, "..getCreatureName(getCreatureSummons(cid)[1]), 1)
addEvent(doRemoveItemFromPos, 15000, toPosition, 3872)
addEvent(doCreateItem, 15005, 2700, 1, pos)
else
doSendAnimatedText(getThingPos(itemEx.uid), "FAIL", 180)
return doPlayerSendCancel(cid, "Você precisa esperar 1 minuto para usar harvest novamente.")
Premios: Coloque o id da berry e a chance de vir. Pode-se adicionar quantos itens quiser, mas sempre deixando o último sem vírgula.
2700: ID da árvore que o pokemon usa harvest.
60: tempo que o player deve esperar para usar harvest outra vez (exhausted).
Agora crie a tag em actions.xml:
<action itemid="2700" event="script" value="harvest.lua" allowfaruse="1"/>
2700: ID da árvore que o pokemon usa harvest (tem que ser o mesmo que usou em harvest.lua).
Testem e me digam o resultado. Se funfar REP+ kk
DÚVIDAS E SUGESTÕES É SÓ POSTAR
NÃO PERMITO QUE POSTEM EM OUTRO LUGAR SEM ME AVISAR
Grupo: Campones
Registrado: 19/03/11
Posts: 40
Reputação: 0
Char no Tibia: Mage Greg
vou testar
para pokemon o script??
Registrado: 09/01/11
Posts: 19
Reputação: +14
Char no Tibia: Não Tenho \O/
@Tartareker
Reported
Causa: Revivendo Topicos
info
Grupo: Conde
Registrado: 29/04/09
Posts: 904
Reputação: +389
Char no Tibia: Jabuti Selvagem
Eu resolvi fazer meu primeiro script para pokemon, visto que, todo mundo só pensa em fazer servidor de pokemon =S
Vá em data/actions e crie harvest.lua. Nele coloque:
local config = {
premios = {
{id="5901",chance=50},
{id="2677",chance=50},
{id="2679",chance=50}
}
}
local function doRemoveItemFromPos(position, itemid, count)
local item = getTileItemById(position, itemid)
if(item.uid ~= 0)then
return doRemoveItem(item.uid, count or -1)
end
return false
end
function onUse(cid, item, fromPos, item2, toPos)
local pokes = {
['Bulbasaur'] = {1},
['Ivysaur'] = {1},
['Venusaur'] = {1},
['Bellsprout'] = {1},
['Vileplume'] = {1},
['Weepinbell'] = {1},
['Victreebel'] = {1},
['Farfetchd'] = {1},
['Exeggutor'] = {1},
['Scyther'] = {1},
['Tangela'] = {1},
}
local summons = getCreatureSummons(cid)
if #summons < 1 then
return doPlayerSendCancel(cid, 'You need a pokemon to use harvest!')
end
local pokemon = pokes[getCreatureName(getCreatureSummons(cid)[1])]
local name = getCreatureName(getCreatureSummons(cid)[1])
if not pokes[name] then
return doPlayerSendCancel(cid, "Your pokemon can not use harvest.")
end
if itemEx.itemid == 2700 then
if os.time()-getPlayerStorageValue(cid, 82941) > 60 then
setPlayerStorageValue(cid, 82941, os.time())
local m = math.random(1,#config.premios)
if math.random(1,100) <= config.premios[m].chance then
doPlayerAddItem(cid, config.premios[m].id)
doSendAnimatedText(getThingPos(itemEx.uid), "SUCCES", 30)
local pos = getThingPos(itemEx.uid)
doRemoveItem(itemEx.uid)
doCreateItem(3872, 1, toPosition)
doCreatureSay(cid, "Harvest, "..getCreatureName(getCreatureSummons(cid)[1]), 1)
addEvent(doRemoveItemFromPos, 15000, toPosition, 3872)
addEvent(doCreateItem, 15005, 2700, 1, pos)
else
doSendAnimatedText(getThingPos(itemEx.uid), "FAIL", 180)
end
else
return doPlayerSendCancel(cid, "Você precisa esperar 1 minuto para usar harvest novamente.")
end
end
end
Premios: Coloque o id da berry e a chance de vir. Pode-se adicionar quantos itens quiser, mas sempre deixando o último sem vírgula.
2700: ID da árvore que o pokemon usa harvest.
60: tempo que o player deve esperar para usar harvest outra vez (exhausted).
Agora crie a tag em actions.xml:
<action itemid="2700" event="script" value="harvest.lua" allowfaruse="1"/>
2700: ID da árvore que o pokemon usa harvest (tem que ser o mesmo que usou em harvest.lua).
Testem e me digam o resultado. Se funfar REP+ kk
DÚVIDAS E SUGESTÕES É SÓ POSTAR
NÃO PERMITO QUE POSTEM EM OUTRO LUGAR SEM ME AVISAR