O sistema funciona assim, o player da use em um item, e então toda vez que ele morrer e logar de volta a bless é re-colocada automaticamente. (não precisa dar use novamente no item, ele é para sempre)
Vamos ao código!
Em actions/scripts coloque dentro de um arquivo.lua:
local efeito = {27,28, 29,79}
function onUse(cid, item, frompos, item2, topos)
if getPlayerStorageValue(cid, 89210) == 1 then
doPlayerSendTextMessage(cid,22,"You already used this book!")
else
doPlayerSendTextMessage(cid,22,"Congratulations! From now, you will be blessed automatically.")
setPlayerStorageValue(cid, 89210, 1)
doRemoveItem(item.uid, 1)
doSendMagicEffect(getThingPos(cid), efeito[math.random(#efeito)])
end
end
Em actions.xml coloque:
<!-- Book Of Blessing --> <action itemid="8977" event="script" value="livro_blessing.lua"/>
Eu coloquei o ID de um livro que não é possivel ser pego de loot.
Agora em creaturescripts/scripts coloque:
local cfg = {
message = "You have been blessed automatically!",
bless = {1, 2, 3, 4, 5},
efeito = {27,28, 29,79}
}
function onLogin(cid)
for i = 1, #cfg.bless do
if getPlayerStorageValue(cid, 89210) == 1 and getPlayerBlessing(cid, i) then
doPlayerSendTextMessage(cid,22, "You are blessed!")
return true
end
if getPlayerStorageValue(cid, 89210) == 1 then
doPlayerAddBlessing(cid, i)
doPlayerSendTextMessage(cid,22,cfg.message)
doSendMagicEffect(getThingPos(cid), cfg.efeito[math.random(#cfg.efeito)])
end
end
return true
end
Em creaturescripts.xml:
<!-- Bless Automatica --> <event type="login" name="checkbless" script="checkbless.lua"/>
E está pronto o seu sistema!!!
Esse sistema era exclusivo do Global War!
Créditos:
Keilost 100%





