BR
pedido

Script de Fome :O

Por BrenoNeto, 13 de mar. de 2013 em Scripts

tibia
script
otserv
50
5.5k
SkymagnumS
14 de março de 2013 às 15:02

Se você estiver usando o do OrochiElf o erro e porque ele não declarou a tabela, só mudar pra esse.

 

 

local limite = 100
local food = {
[2362] = {80, "Crunch."},
[2666] = {50, "Munch."},
[2667] = {100, "Munch."},
[2668] = {100, "Mmmm."},
[2669] = {100, "Munch."},
[2670] = {40, "Gulp."},
[2671] = {100, "Chomp."},
[2672] = {100, "Chomp."},
[2673] = {50, "Yum."},
[2674] = {60, "Yum."},
[2675] = {100, "Yum."},
[2676] = {80, "Yum."},
[2677] = {10, "Yum."},
[2678] = {100, "Slurp."},
[2679] = {10, "Yum."},
[2680] = {20, "Yum."},
[2681] = {90, "Yum."},
[2682] = {100, "Yum."},
[2683] = {100, "Munch."},
[2684] = {80, "Crunch."},
[2685] = {60, "Munch."},
[2686] = {90, "Crunch."},
[2687] = {20, "Crunch."},
[2688] = {90, "Munch."},
[2689] = {100, "Crunch."},
[2690] = {30, "Crunch."},
[2691] = {80, "Crunch."},
[2792] = {60, "Munch."},
[2793] = {90, "Munch."},
[2695] = {60, "Gulp."},
[2696] = {90, "Smack."},
[2787] = {90, "Munch."},
[2788] = {40, "Munch."},
[2789] = {100, "Munch."},
[2790] = {100, "Munch."},
[2791] = {100, "Munch."},
[2792] = {60, "Munch."},
[2794] = {30, "Munch."},
[2795] = {100, "Munch."},
[2796] = {50, "Munch."},
[2793] = {90, "Munch."},
[5097] = {40, "Yum."},
[6125] = {80, "Gulp."},
[6278] = {100, "Mmmm."},
[6279] = {100, "Mmmm."},
[6393] = {100, "Mmmm."},
[6394] = {100, "Mmmm."},
[6501] = {100, "Mmmm."},
[6541] = {60, "Gulp."},
[6542] = {60, "Gulp."},
[6543] = {60, "Gulp."},
[6544] = {60, "Gulp."},
[6545] = {60, "Gulp."},
[6569] = {10, "Mmmm."},
[6574] = {40, "Mmmm."},
[7158] = {100, "Munch."},
[7159] = {100, "Munch."},
[7372] = {70, "Yum."},
[7373] = {70, "Yum."},
[7374] = {70, "Yum."},
[7375] = {70, "Yum."},
[7376] = {70, "Yum."},
[7377] = {70, "Yum."},
[7909] = {40, "Crunch."},
[8838] = {70, "Gulp."},
[8839] = {50, "Yum."},
[8840] = {20, "Yum."},
[8841] = {30, "Urgh."},
[8842] = {30, "Munch."},
[8843] = {30, "Crunch."},
[8844] = {30, "Gulp."},
[8845] = {20, "Munch."},
[8847] = {100, "Yum."},
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(food[item.itemid] == true) then
if(getPlayerFood(cid) + food[item.itemid][1]) >= limite then
doPlayerSendCancel(cid, "You are full.")
else
doPlayerFeed(cid, food[item.itemid][1] /2.7)
doCreatureSay(cid, food[item.itemid][2], TALKTYPE_ORANGE_1)
doRemoveItem(item.uid, 1)
end
return TRUE
end
return FALSE
end

 

BrenoNetoB
14 de março de 2013 às 16:34

Resolvido :D estou usando o sistema do notle12, o unico que funcionou '-'

SlicerS
14 de março de 2013 às 17:09

@breno

da pra por no otclient concerteza...

notle2012N
14 de março de 2013 às 17:22

@BrenoNeto

só não crio cool down bar no otclient

pq não mexo nessas paradas :)

 

se quiser usa esse

data\globalevents\scripts\death.lua

 

 

function onThink(interval, lastExecution)
time = 1100 -- (tempo 1000 por segundos)
sto = 15725 --
--{de = 500, ate = 400, perde 25 de life}
t = {{limin = 500, limim = 400,life = 25},
{limin = 399, limim = 300,life = 35},
{limin = 299, limim = 200,life = 50},
{limin = 199, limim = 100,life = 80},
{limin = 99, limim = 0,life = 160}}
death()   -- não mexe
return 1
end
function death()
for _, name in ipairs(getOnlinePlayers()) do
if getPlayerStorageValue(getPlayerByName(name), sto) >= os.time() then return true end
if isCreature(getPlayerByName(name)) then
for i = 1,#t do
if getPlayerFood(getPlayerByName(name)) <= t[i].limin and getPlayerFood(getPlayerByName(name)) >= t[i].limim  then
doCreatureAddHealth(getPlayerByName(name), -t[i].life)
doSendAnimatedText(getPlayerPosition(getPlayerByName(name)),""..t[i].life.."", math.random(144,145))
addEvent(death,time,getPlayerByName(name))
setPlayerStorageValue(getPlayerByName(name), sto, os.time() + time / 1000)
end
end
end
end
end

 

 

 

tem que edita os red

{de = 500, ate = 400, perde 25 de life}

{{limin = 500, limim = 400,life = 25},

Editado Março 14 por notle2012

RoksasR
14 de março de 2013 às 17:25

Tópico movido para pedidos e dúvidas resolvidos.

BrenoNetoB
14 de março de 2013 às 17:31

Ei ei, só mais uma coisa, quando morre de fome, o player volta, e continua morrendo, como mudo isso ? :D

RoksasR
14 de março de 2013 às 17:37

Tenta ai:

 

 

function onThink(interval, lastExecution)

morre = 600 -- com mas ou menos 600 ja começa a morrer

life = 25 -- quanto de life player vai perdendo

time = 1100 -- (tempo 1000 por segundos)

sto = 15725 --

if death() then -- não mexe

doPlayerSendCancel(cid,"Death noob!")

end

return 1

end

function death()

for _, name in ipairs(getOnlinePlayers()) do

if getPlayerStorageValue(getPlayerByName(name), sto) >= os.time() then return true end

if isCreature(getPlayerByName(name)) then

if getPlayerFood(getPlayerByName(name)) <= morre then

doCreatureAddHealth(getPlayerByName(name), -life)

addEvent(death, 2000,getPlayerByName(name))

doSendAnimatedText(getPlayerPosition(getPlayerByName(name)),""..life.."", math.random(144,145))

setPlayerStorageValue(getPlayerByName(name), sto, os.time() + time / 1000)

end

end

return true

end

end

 

BrenoNetoB
14 de março de 2013 às 18:05

Tentei, e quando morre, e revive, o a fome continua no 0, acho que isso muda em actions, pra quando reviver a "fome" ficar novamente no maximo.

RoksasR
14 de março de 2013 às 18:09

Não entendi, é um item? Que muda a fome?

SlicerS
14 de março de 2013 às 18:14

alguem faz um onDeath botando a food no maximo denovo... ;x

 

vo deletar n.. vai continuar full... n do mais suporte por PM... crie um topico na area de pedidos e duvidas de clientes... good luck

\/

Editado Março 14 por Slicer

BrenoNetoB
14 de março de 2013 às 18:14

Sim, você da use na food, e sua fome "sobe" por exemplo, come um meat, a fome ta 100/1000, apos comer fica 300/1000, e vai caindo 1 por segundo, 299/1000, 298/1000

 

@Slicer- deleta umas mensagens do seu perfil mano, to tentando de enviar um mp com uma duvida sobre o otclient e n to conseguindo kk'

Editado Março 14 por BrenoNeto

RoksasR
14 de março de 2013 às 18:19

Ah entendi, acho que é assim, tenta ai, em data/creaturescripts/scripts, crie um arquivo chamado deathfood.lua e ponha dentro:

 

 

function onDeath(cid, corpse, killer)

if isPlayer(cid) then

doPlayerFeed(cid, 1000)

end

return true

end

 

 

E em creaturescripts.xml coloque essa tag:

 

	<event type="death" name="DeathFood" event="script" value="deathfood.lua"/>

 

Em login.lua, antes da última linha, coloque:

 

registerCreatureEvent(cid, DeathFood)

Editado Março 14 por Roksas

SlicerS
14 de março de 2013 às 18:21

eh pra enxer a fome rok... ;x ja vai ta zero quando morrer...

BrenoNetoB
14 de março de 2013 às 18:31

Continua morrendo após ter morrido. Algo errado na creaturescript,

 

[Error GlobalEvent Interface]

data/globalevents/scripts/death.lua:onThink

Description:

<luaDoPlayerSendCancel>Player Not Found.

Mais está funcionando. menos na parte da fome acabar após morrer.

RoksasR
14 de março de 2013 às 18:38

 

 

function onThink(interval, lastExecution)

morre = 600 -- com mas ou menos 600 ja começa a morrer

life = 25 -- quanto de life player vai perdendo

time = 1100 -- (tempo 1000 por segundos)

sto = 15725 --

if death() then -- não mexe

end

return 1

end

function death()

for _, name in ipairs(getOnlinePlayers()) do

if getPlayerStorageValue(getPlayerByName(name), sto) >= os.time() then return true end

if isCreature(getPlayerByName(name)) then

if getPlayerFood(getPlayerByName(name)) <= morre then

doCreatureAddHealth(getPlayerByName(name), -life)

addEvent(death, 2000,getPlayerByName(name))

doSendAnimatedText(getPlayerPosition(getPlayerByName(name)),""..life.."", math.random(144,145))

setPlayerStorageValue(getPlayerByName(name), sto, os.time() + time / 1000)

end

end

return true

end

end

 

 

 

E

 

 

 

function onDeath(cid, corpse, killer)

if isPlayer(cid) and getPlayerFood(cid) < 1000 then

doPlayerFeed(cid, 1000)

end

return true

end