jimmydunphy
New Member
I'm using tfs 1.2 and wondering if anyone could tell me how to make a book of infinite blessings? One click = 5 blessing but but never runs out? Ty!
Thanks for the replies! I'm wondering how do I give an item blessings? Could you show me an example of an item with blessing?
Thanks!
Look at this: https://github.com/orts/server/blob/master/data/actions/scripts/other/blessingCharms.lua
Make some minor edits, omit item:remove(1)
Gah damn!
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
for i = 1, 5 do
if player:hasBlessing(i) then
return true
end
player:addBlessing(i)
end
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been blessed by the gods.")
player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
return true
end
<!-- YouBlessScript ( Something) -->
<action itemid="XXX" script="other/YouFileName.lua" />
local config = {
[1] = {blessId = 4, text = 'The Spark of the Phoenix'},
[2] = {blessId = 2, text = 'The Embrace of Tibia'},
[3] = {blessId = 1, text = 'The Spiritual Shielding'},
[4] = {blessId = 3, text = 'The Fire of the Suns'},
[5] = {blessId = 5, text = 'The Wisdom of Solitude'}
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
for i=1,5 do
local useItem = config[i]
if player:hasBlessing(useItem.blessId) then
-- player:say('You already possess this blessing.', TALKTYPE_MONSTER_SAY)
else
player:addBlessing(useItem.blessId)
-- player:sendTextMessage(MESSAGE_EVENT_ADVANCE, useItem.text .. ' protects you.')
player:getPosition():sendMagicEffect(CONST_ME_LOSEENERGY)
end
end
return true
end
I know, but if player die. He lose all his bless? Else he should check if not player:hasBlessing(i) then, it should set those which he does not have.REMOVED already anwsered the time i was writing.
;S
Printer Just remove the Return true from the for loop
if he has one of the bless the script will stop.
that mens One who has one bless and never dead cant use it.I know, but if player die. He lose all his bless? Else he should check if not player:hasBlessing(i) then, it should set those which he does not have.
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
for i = 1, 5 do
if not player:hasBlessing(i) then
player:addBlessing(i)
end
end
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been blessed by the gods.")
player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
return true
end