• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Use bless tfs 1.3

xGustadoIts

New Member
Joined
Apr 13, 2015
Messages
50
Reaction score
0
I would like to make this script work on a single item

Code:
local config = {
    [11260] = {blessId = 5, text = 'The Spiritual Shielding'},
    [11259] = {blessId = 6, text = 'The Embrace of Tibia'},
    [11261] = {blessId = 4, text = 'The Fire of the Suns'},
    [11258] = {blessId = 3, text = 'The Spark of the Phoenix'},
    [11262] = {blessId = 2, text = 'The Wisdom of Solitude'},
    [28036] = {blessId = 7, text = 'Heart of the Mountain'},
    [28037] = {blessId = 8, text = 'Blood of the Mountain'}
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local useItem = config[item.itemid]
    if not useItem then
        return true
    end

    if player:hasBlessing(useItem.blessId) then
        player:say('You already possess this blessing.', TALKTYPE_MONSTER_SAY)
        return true
    end

    player:addBlessing(useItem.blessId,1)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, useItem.text .. ' protects you.')
    player:getPosition():sendMagicEffect(CONST_ME_LOSEENERGY)
    item:remove(1)
    return true
end
 
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if(player:hasBlessing(1) and player:hasBlessing(2) and player:hasBlessing(3) and player:hasBlessing(4) and player:hasBlessing(5) and player:hasBlessing(6)) then
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You already has all blessings.")
        return true
    end
 
    for i = 1,6 do
        player:addBlessing(i)
    end
 
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You received all blessings.")
    player:getPosition():sendMagicEffect(CONST_ME_LOSEENERGY)
    return true
end

If you want the remove be removed after the usage add item:remove(1) above the last return true
 
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if(player:hasBlessing(1) and player:hasBlessing(2) and player:hasBlessing(3) and player:hasBlessing(4) and player:hasBlessing(5) and player:hasBlessing(6)) then
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You already has all blessings.")
        return true
    end
 
    for i = 1,6 do
        player:addBlessing(i)
    end
 
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You received all blessings.")
    player:getPosition():sendMagicEffect(CONST_ME_LOSEENERGY)
    return true
end

If you want the remove be removed after the usage add item:remove(1) above the last return true

is not working, says it added bless but nothing happens.
no erro console
You received all blessings.
No blessings received.
 
sorry for refresh after 3 years but I need it too! how to make it work on 1.3? get only text You received all blessings.
Try with
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if(player:hasBlessing(1) and player:hasBlessing(2) and player:hasBlessing(3) and player:hasBlessing(4) and player:hasBlessing(5) and player:hasBlessing(6)) then
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You already has all blessings.")
        return true
    end
 
    for i = 1,6 do
        player:addBlessing(i, 1)
    end
 
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You received all blessings.")
    player:getPosition():sendMagicEffect(CONST_ME_LOSEENERGY)
    return true
end
 
Try with
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if(player:hasBlessing(1) and player:hasBlessing(2) and player:hasBlessing(3) and player:hasBlessing(4) and player:hasBlessing(5) and player:hasBlessing(6)) then
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You already has all blessings.")
        return true
    end
 
    for i = 1,6 do
        player:addBlessing(i, 1)
    end
 
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You received all blessings.")
    player:getPosition():sendMagicEffect(CONST_ME_LOSEENERGY)
    return true
end
not working, no error, but I add
Lua:
blessbook:id(8983)
blessbookld:register()
, because I'm using otbr for 12.64, now shows some errors:
Code:
[2021-11-05 22:15:07.419] [error] Lua script error: C:\vcpkg\otservbr-global\data\scripts\actions\other\blessbook.lua
...otservbr-global\data\scripts\actions\other\blessbook.lua:16: attempt to index global 'blessbook' (a nil value)
stack traceback:
        [C]: in function '__index'
        ...otservbr-global\data\scripts\actions\other\blessbook.lua:16: in main chunk
> blessbook.lua [error]
^
 
try this:

data/scripts/blessbook.lua
Lua:
local blessings = {
    {blessId = 1}, -- Unknow bless?
    {blessId = 2}, -- The Wisdom of Solitude
    {blessId = 3}, -- The Spark of the Phoenix
    {blessId = 4}, -- The Fire of the Suns
    {blessId = 5}, -- The Spiritual Shielding
    {blessId = 6}, -- The Embrace of Tibia
    {blessId = 7}, -- Heart of the Mountain
    {blessId = 8} -- Blood of the Mountain
}

local blessbookId = 8983
local blessPrice = 10 * 10000 -- 10 crystal coins
local bless = Action()

function bless.onUse(player, item, fromPos, target, toPos, isHotkey)
    for _, blessing in pairs(blessings) do
        if not player:hasBlessing(blessing.blessId) then
            if not player:removeMoney(blessPrice) then
                player:sendCancelMessage(string.format("You need %d gold coins.", blessPrice))
                return true
            end

            for _, blessing in pairs(blessings) do
                player:addBlessing(blessing.blessId, 1)
            end
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You received all blessings.")
            player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_BLUE)
            return true
        end
    end

    player:sendTextMessage(MESSAGE_INFO_DESCR, "You already has all blessings.")
    return true
end

bless:id(blessbookId)
bless:register()
 
Last edited:
try this:

data/scripts/blessbook.lua
Lua:
local blessbookId = 8983
local blessings = 6
local bless = Action()

function bless.onUse(player, item, fromPos, target, toPos, isHotkey)
    for blessing = 1, blessings do
        if not player:hasBlessing(blessing) then
            for blessing = 1, blessings do
                player:addBlessing(blessing)
            end
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You received all blessings.")
            player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_BLUE)
            return true
        end
    end

    player:sendTextMessage(MESSAGE_INFO_DESCR, "You already has all blessings.")
    return true
end

bless:id(blessbookId)
bless:register()
the script working but gives no blessings, it just show text and effect, I can use it many times.

script should gives blessings one time, if u can please make it take xx money from character balance.
Post automatically merged:

try this:

6 blessings for tfs 1.3 and 8 blessings for otservbr
data/scripts/blessbook.lua
Lua:
local blessbookId = 8983
local blessings = 8
local blessPrice = 10 * 10000 -- 10 crystal coins
local bless = Action()

function bless.onUse(player, item, fromPos, target, toPos, isHotkey)
    for blessing = 1, blessings do
        if not player:hasBlessing(blessing) then
            if not player:removeMoney(blessPrice) then
                player:sendCancelMessage(string.format("You need %d gold coins.", blessPrice))
                return true
            end

            for blessing = 1, blessings do
                player:addBlessing(blessing)
            end
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You received all blessings.")
            player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_BLUE)
            return true
        end
    end

    player:sendTextMessage(MESSAGE_INFO_DESCR, "You already has all blessings.")
    return true
end

bless:id(blessbookId)
bless:register()
now takes money but still not giving blessings, I get "You received all blessings." and I am still able to use it over and over again, no error in console..
 
Last edited:

Similar threads

Back
Top