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

Bless

Dogrinha

New Member
Joined
Oct 6, 2019
Messages
206
Solutions
1
Reaction score
2
Hey Guys! My players even with all blesses they're losing items when they die. How do i fix it?
TFS 0.4
 

blessings = true
blessingOnlyPremium = true
blessingReductionBase = 50
blessingReductionDecrement = 5
eachBlessReduction = 10
From line 2257 find
C++:
uint32_t lostSkillTries, sumSkillTries;
replace this class with this one
C++:
        uint32_t lostSkillTries, sumSkillTries;
        for(int16_t i = 0; i < 7; ++i) //for each skill
        {
            lostSkillTries = sumSkillTries = 0;
            for(uint32_t c = 11; c <= skills[i][SKILL_LEVEL]; ++c) //sum up all required tries for all skill levels
                sumSkillTries += vocation->getReqSkillTries(i, c);

            sumSkillTries += skills[i][SKILL_TRIES];
            lostSkillTries = (uint32_t)std::ceil(sumSkillTries * ((double)(percent * lossPercent[LOSS_SKILLS]) / 100.));
            while(lostSkillTries > skills[i][SKILL_TRIES])
            {
                lostSkillTries -= skills[i][SKILL_TRIES];
                skills[i][SKILL_TRIES] = vocation->getReqSkillTries(i, skills[i][SKILL_LEVEL]);
                if(skills[i][SKILL_LEVEL] < 11)
                {
                    skills[i][SKILL_LEVEL] = 10;
                    skills[i][SKILL_TRIES] = lostSkillTries = 0;
                    break;
                }
                else
                    skills[i][SKILL_LEVEL]--;
            }

            skills[i][SKILL_TRIES] = std::max((int32_t)0, (int32_t)(skills[i][SKILL_TRIES] - lostSkillTries));
        }

        blessings = 0;
        loginPosition = masterPosition;
        if(!inventory[SLOT_BACKPACK])
            __internalAddThing(SLOT_BACKPACK, Item::CreateItem(g_config.getNumber(ConfigManager::DEATH_CONTAINER)));

        sendIcons();
        sendStats();
        sendSkills();

        g_creatureEvents->playerLogout(this, true);
        g_game.removeCreature(this, false);
        sendReLoginWindow();
    }
    else
    {
        setLossSkill(true);
        if(preventLoss)
        {
            loginPosition = masterPosition;
            g_creatureEvents->playerLogout(this, true);
            g_game.removeCreature(this, false);
            sendReLoginWindow();
        }
    }

    return true;
}
replace thise also on your config
Lua:
   deathLostPercent = 10
also try this on your talkactions
Lua:
 function onSay(cid, words, param)
    if getPlayerBlessing(cid,5) then ---defending player renewing the existing bless to protect from losing .
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have already been blessed")
          doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MORTAREA)
             else
                            if doPlayerRemoveMoney(cid, 50000) == TRUE then
      for i = 1,5 do
      doPlayerAddBlessing(cid,i)
         end
              doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have received blessings!")
                  doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ENERGYAREA)
         else
           doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need 50,000 gp in backpack for blessings.")
             doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ICEAREA)
                                 end
            end
       end
tested and worked, hope it works for you too .
 
Last edited:
From line 2257 find
C++:
uint32_t lostSkillTries, sumSkillTries;
replace this class with this one
C++:
        uint32_t lostSkillTries, sumSkillTries;
        for(int16_t i = 0; i < 7; ++i) //for each skill
        {
            lostSkillTries = sumSkillTries = 0;
            for(uint32_t c = 11; c <= skills[i][SKILL_LEVEL]; ++c) //sum up all required tries for all skill levels
                sumSkillTries += vocation->getReqSkillTries(i, c);

            sumSkillTries += skills[i][SKILL_TRIES];
            lostSkillTries = (uint32_t)std::ceil(sumSkillTries * ((double)(percent * lossPercent[LOSS_SKILLS]) / 100.));
            while(lostSkillTries > skills[i][SKILL_TRIES])
            {
                lostSkillTries -= skills[i][SKILL_TRIES];
                skills[i][SKILL_TRIES] = vocation->getReqSkillTries(i, skills[i][SKILL_LEVEL]);
                if(skills[i][SKILL_LEVEL] < 11)
                {
                    skills[i][SKILL_LEVEL] = 10;
                    skills[i][SKILL_TRIES] = lostSkillTries = 0;
                    break;
                }
                else
                    skills[i][SKILL_LEVEL]--;
            }

            skills[i][SKILL_TRIES] = std::max((int32_t)0, (int32_t)(skills[i][SKILL_TRIES] - lostSkillTries));
        }

        blessings = 0;
        loginPosition = masterPosition;
        if(!inventory[SLOT_BACKPACK])
            __internalAddThing(SLOT_BACKPACK, Item::CreateItem(g_config.getNumber(ConfigManager::DEATH_CONTAINER)));

        sendIcons();
        sendStats();
        sendSkills();

        g_creatureEvents->playerLogout(this, true);
        g_game.removeCreature(this, false);
        sendReLoginWindow();
    }
    else
    {
        setLossSkill(true);
        if(preventLoss)
        {
            loginPosition = masterPosition;
            g_creatureEvents->playerLogout(this, true);
            g_game.removeCreature(this, false);
            sendReLoginWindow();
        }
    }

    return true;
}
replace thise also on your config
Lua:
   deathLostPercent = 10
also try this on your talkactions
Lua:
 function onSay(cid, words, param)
    if getPlayerBlessing(cid,5) then ---defending player renewing the existing bless to protect from losing .
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have already been blessed")
          doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MORTAREA)
             else
                            if doPlayerRemoveMoney(cid, 50000) == TRUE then
      for i = 1,5 do
      doPlayerAddBlessing(cid,i)
         end
              doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have received blessings!")
                  doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ENERGYAREA)
         else
           doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need 50,000 gp in backpack for blessings.")
             doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ICEAREA)
                                 end
            end
       end
tested and worked, hope it works for you too .
Well, the error isn't happening anymore, but, when people die with bless, they're still losing everything, including AOL. But, when they die without blesses, just using AOL, they don't lose AOL
 
Well, the error isn't happening anymore, but, when people die with bless, they're still losing everything, including AOL. But, when they die without blesses, just using AOL, they don't lose AOL
make sure you added this attributes on items.xml that existing on your id
XML:
<attribute key="preventDrop" value="1"/>
<attribute key="slotType" value="necklace" />
<attribute key="charges" value="1"/>
 
make sure you added this attributes on items.xml that existing on your id
XML:
<attribute key="preventDrop" value="1"/>
<attribute key="slotType" value="necklace" />
<attribute key="charges" value="1"/>
Oh, thanks for the reply, i've been trying to do what you recommended me to do, but, it still doesn't work, the problem don't happen when the players have 4 blesses or less, but, if they're full of blesses, they lose everything, like if they were Red skull...
 
Oh, thanks for the reply, i've been trying to do what you recommended me to do, but, it still doesn't work, the problem don't happen when the players have 4 blesses or less, but, if they're full of blesses, they lose everything, like if they were Red skull...
-- WAITING FOR EDIT
 
Last edited:
I'm sorry if I uploaded the post, it will not be repeated, but I have this serious problem and my server is online, I don't know what to do, I'm losing players. can anybody help me?
As i can see from yesterday using the teamviewer session i bet 100% that your sources actually bugged because it's too old and have many changes on the files also it's outdated version based on otx by "matyx " so i recommend to use another sources based on this tfs like this one Fir3element/3777 (https://github.com/Fir3element/3777) .

Regards.
 
Back
Top