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

TFS 1.X+ Kawill and pydar storage bless problem or might be something else.

Felipe93

Ghost Member
Joined
Mar 21, 2015
Messages
1,990
Solutions
9
Reaction score
334
Location
Chile
Hello, As title say, I'm having trouble making these NPCs work. Please help.
Kawill bless code
Lua:
-- Kawill Blessing
local blessKeyword = keywordHandler:addKeyword({'spark of the phoenix'}, StdModule.say, {npcHandler = npcHandler, text = 'The Spark of the Phoenix is given by me and by the great pyromancer in the nearby fire temple. Do you wish to receive my part of the Spark of the Phoenix?'}, function(player) return player:getStorageValue(PlayerStorageKeys.KawillBlessing) ~= 1 end)
    blessKeyword:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, text = 'So receive the blessing of the life-giving earth, pilgrim.', reset = true}, nil, function(player) player:setStorageValue(PlayerStorageKeys.KawillBlessing, 1) player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) end)
    blessKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'Ok. If you don\'t want it...', reset = true})

-- Basic
In game, everything seems to be ok
Code:
09:24 Felxc [40]: hi
09:24 Kawill: Welcome  Felxc ! May earth protect you!
09:24 Felxc [40]: spark of the phoenix
09:24 Kawill: The Spark of the Phoenix is given by me and by the great pyromancer in the nearby fire temple. Do you wish to receive my part of the Spark of the Phoenix?
09:24 Felxc [40]: yes
09:24 Kawill: So receive the blessing of the life-giving earth, pilgrim.
in server console, get this error when I say spark of the phoenix and yes
Code:
nil
nil



with pydar is the same in game, everything seems to be ok (the NPC does not detect the storage thought)
Code:
-- Spark of the Phoenix
local blessKeyword = keywordHandler:addKeyword({'phoenix'}, StdModule.say, {npcHandler = npcHandler, text = 'The Spark of the Phoenix is given by me and by the great geomancer of the local earth temple. Do you wish to receive my part of the Spark of the Phoenix for |BLESSCOST| gold?'})
    blessKeyword:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, text = 'So receive the spark of the phoenix, pilgrim.', cost = '|BLESSCOST|', bless = 4})
    blessKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'Maybe another time.', reset = true})
keywordHandler:addAliasKeyword({'spark'})
Code:
09:26 Felxc [40]: hi
09:26 Pydar: Welcome  Felxc ! May earth protect you!
09:26 Felxc [40]: spark
09:26 Pydar: The Spark of the Phoenix is given by me and by the great geomancer of the local earth temple. Do you wish to receive my part of the Spark of the Phoenix for 4000 gold?
09:26 Felxc [40]: yes
09:26 Pydar: You need the blessing of the great geomancer first.
and in console after say yes and spark
Code:
nil
nil


my modules.lua bless function
Code:
function StdModule.bless(cid, message, keywords, parameters, node)
        local npcHandler = parameters.npcHandler
        if npcHandler == nil then
            error("StdModule.bless called without any npcHandler instance.")
        end

        if not npcHandler:isFocused(cid) then
            return false
        end

        local player = Player(cid)
        local parseInfo = {[TAG_BLESSCOST] = getBlessingsCost(player:getLevel()), [TAG_PVPBLESSCOST] = getPvpBlessingCost(player:getLevel())}
        if player:hasBlessing(parameters.bless) then
            npcHandler:say("You already possess this blessing.", cid)
        elseif parameters.bless == 4 and player:getStorageValue(PlayerStorageKeys.KawillBlessing) ~= 1 then
            npcHandler:say("You need the blessing of the great geomancer first.", cid)
        elseif parameters.bless == 6 and player:getBlessings() == 0 and not player:getItemById(2173, true) then
            npcHandler:say("You don't have any of the other blessings nor an amulet of loss, so it wouldn't make sense to bestow this protection on you now. Remember that it can only protect you from the loss of those!", cid)
        elseif not player:removeMoney(type(parameters.cost) == "string" and npcHandler:parseMessage(parameters.cost, parseInfo) or parameters.cost) then
            npcHandler:say("Oh. You do not have enough money.", cid)
        else
            npcHandler:say(parameters.text or "You have been blessed by one of the five gods!", cid)
            if parameters.bless == 4 then
                player:setStorageValue(PlayerStorageKeys.KawillBlessing, 0)
            end
            player:addBlessing(parameters.bless)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
        end

        npcHandler:resetNpc(cid)
        return true
    end
and inside data/lib/core/storages.lua
Code:
--[[
Reserved storage ranges:
- 300000 to 301000+ reserved for achievements
- 20000 to 21000+ reserved for achievement progress
- 10000000 to 20000000 reserved for outfits and mounts on source
]]--
PlayerStorageKeys = {
    --postmanBoat = 31666,
    annihilatorReward = 30015,
    promotion = 30018,
    delayLargeSeaShell = 30019,
    firstRod = 30020,
    delayWallMirror = 30021,
    madSheepSummon = 30023,
    crateUsable = 30024,
    afflictedOutfit = 30026,
    afflictedPlagueMask = 30027,
    afflictedPlagueBell = 30028,
    nailCaseUseCount = 30031,
    swampDigging = 30032,
    insectoidCell = 30033,
    vortexTamer = 30034,
    mutatedPumpkin = 30035,
    achievementsBase = 300000,
    achievementsCounter = 20000,
    KawillBlessing = 50139,
}

GlobalStorageKeys = {
}

what could be missing? Every other bless work ( taken from orts too)
Code:
09:30 Received blessings:
Spiritual Shielding
Embrace of the World
Fire of the Suns
Wisdom of Solitude
 
Back
Top