• 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!

RevScripts Store blessings scroll

Ciosny

Member
Joined
Aug 16, 2024
Messages
116
Solutions
1
Reaction score
15
Hi !
I found this code, but it's probably for old TFS. Many others take money.

function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 5131 then ---< change
doPlayerAddBlessing(cid, 1)
doPlayerAddBlessing(cid, 2)
doPlayerAddBlessing(cid, 3)
doPlayerAddBlessing(cid, 4)
doPlayerAddBlessing(cid, 5)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid, 1)
end
return true
end



I would like to ask for help because I am looking for a scroll script for the premium shop which, when I buy and use it, gives me 5 blessings but does not take any money. If I already have blessings, it sends information that I have blessings. It disappears after use :)

I have 10.98 TFS 1.4.2
 
LUA:
local config = {
    blessingItemId = 1000,
    blessingCost = 1100,
    
    blessings = {
        {id = 1, text = "The Spiritual Shielding protects you.", effect = CONST_ME_LOSEENERGY},
        {id = 2, text = "The Embrace of the World surrounds you.", effect = CONST_ME_MAGIC_BLUE},
        {id = 3, text = "The Fire of the Suns engulfs you.", effect = CONST_ME_MAGIC_RED},
        {id = 4, text = "The Wisdom of Solitude inspires you.", effect = CONST_ME_MAGIC_GREEN},
        {id = 5, text = "The Spark of the Phoenix emblazes you.", effect = CONST_ME_FIREATTACK}
    }
}

local blessingScroll = Action()

function blessingScroll.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if not player:removeTotalMoney(config.blessingCost) then
        player:say("You do not have enough gold to receive the blessings.", TALKTYPE_MONSTER_SAY)
        return true
    end

    for _, bless in pairs(config.blessings) do
        if not player:hasBlessing(bless.id) then
            player:addBlessing(bless.id)
            player:say(bless.text, TALKTYPE_MONSTER_SAY)
            player:getPosition():sendMagicEffect(bless.effect)
        end
    end
    return true
end

blessingScroll:id(config.blessingItemId)
blessingScroll:register()
 
Using the blessings itself works, but when you remove the scroll, it does not disappear. Additionally, if you already have a blessing, no message informing you about it is displayed. Does anyone know how to add this to the code?
 
gives me 5 blessings but does not take any money.
Removed the check for money.
when you remove the scroll, it does not disappear.
Item is now removed upon use, if a blessing was given.
If I already have blessings, it sends information that I have blessings.
It will now inform the player when they are fully blessed.

LUA:
local config = {
    blessingItemId = 1000,    
    blessings = {
        {id = 1, text = "The Spiritual Shielding protects you.", effect = CONST_ME_LOSEENERGY},
        {id = 2, text = "The Embrace of the World surrounds you.", effect = CONST_ME_MAGIC_BLUE},
        {id = 3, text = "The Fire of the Suns engulfs you.", effect = CONST_ME_MAGIC_RED},
        {id = 4, text = "The Wisdom of Solitude inspires you.", effect = CONST_ME_MAGIC_GREEN},
        {id = 5, text = "The Spark of the Phoenix emblazes you.", effect = CONST_ME_FIREATTACK}
    }
}

local blessingScroll = Action()

function blessingScroll.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local blessingProvided = false
    for i = 1, #config.blessings do
        local bless = config.blessings[i]
        if not player:hasBlessing(bless.id) then
            player:addBlessing(bless.id)
            player:say(bless.text, TALKTYPE_MONSTER_SAY)
            player:getPosition():sendMagicEffect(bless.effect)
            blessingProvided = true
        end
    end
    if not blessingProvided then
        player:say("You are fully blessed.", TALKTYPE_MONSTER_SAY)
        return true
    end
    item:remove(1)
    player:say("You have obtained every available blessing.", TALKTYPE_MONSTER_SAY)
    return true
end

blessingScroll:id(config.blessingItemId)
blessingScroll:register()
 
Back
Top