Falaê galera.
Hoje vou trazer um script do Wise que achei bem interessante e não achei aqui.
O que isso faz?
Faz com que o player necessite se alimentar para parar de perder vida, caso não se alimente, sua vida irá descer até 0. Caso o player morra, quando entrar, ele vai continuar perdendo a porcentagem de HP, até que enfim se alimente. Acredito que seja bom para servidores sérios.
Versões testadas: TFS 0.3.6, mas pelas funções, acho que execute de boa também com TFS 1.0 e com o TFS 0.4.
Bora lá.
Vá em data\creaturescripts\scripts, crie um .lua chamado checkhunger e adicione isso:
-- Developed by Wise
local t = {
hp = 2, -- %
maxTime = 25 * 60, -- minutes * 60
lossInterval = 5, -- seconds
hstor = 98765 -- hunger storage
}
function checkHunger(cid)
local h = getPlayerStorageValue(cid, t.hstor)
local loss = t.lossInterval > 1 and t.lossInterval or 2
if getPlayerFlagValue(cid, PLAYERFLAG_CANNOTBEATTACKED) then
return true
elseif getPlayerFood(cid) < 1 then
if h <= t.maxTime then
if h < 0 then
setPlayerStorageValue(cid, t.hstor, 0)
end
setPlayerStorageValue(cid, t.hstor, getPlayerStorageValue(cid, t.hstor) + 1)
else
addEvent(function()
if isPlayer(cid) then
doCreatureAddHealth(cid, -(t.hp * (getCreatureMaxHealth(cid) / 100)))
end
end, (loss - 1) * 1000)
end
else
if h > 0 then
setPlayerStorageValue(cid, t.hstor, 0)
end
end
addEvent(function()
if isPlayer(cid) then
checkHunger(cid)
end
end, 1000)
return true
end
function onLogin(cid)
return checkHunger(cid) and true
end
Agora vá em data\creaturescripts e abra o creaturescripts.xml, adicione a seguinte tag:
<event type="login" name="checkHunger" event="script" value="checkhunger.lua"/>
Configuração:
local t = {
hp = 2, -- porcentagem de HP que o player perderá
maxTime = 25 * 60, -- tempo máximo para ficar sem se alimentar em minutos * 60 (no caso, seriam 25 minutos, ou seja, 1500 segundos)
lossInterval = 5, -- tempo do intervalo de perda da porcentagem do HP, em segundos (no caso, perderia a porcentagem estipulada a cada 5 segundos)
hstor = 98765 -- storage que faz a contagem do tempo máximo
}
Créditos: Wise
Enjoy it! ![]()



