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

Windows [FIX] Blessings to protect from losing level 100%

Thaiwor

New Member
Joined
Mar 18, 2015
Messages
19
Reaction score
0
I want Blessings to protect people from losing level to 100%
Everything with my scripts is working except that they lose 3 levels on dying.
Config.lua
Code:
    -- Blessings
    -- NOTE: blessingReduction* regards items/containers loss.
    -- eachBlessReduction is how much each bless reduces the experience/magic/skills loss.
    blessingOnlyPremium = true
    blessingReductionBase = 15
    blessingReductionDecreament = 5
    eachBlessReduction = 8
    blessings = true


Creaturescripts/scripts/blessings.lua

Code:
local blessingStorageValue = 12345 -- The storage value you will use to store a players blessings
local blessConfig = {
    [0] = { -- Experience Loss
        lossPercent = 10, -- % of experience a player will lose when dying WITHOUT blessings
        blessPercent = 0 -- % of experience a player will lose when dying WITH blessings
    },
    [1] = { -- Magic Level Loss
        lossPercent = 10, -- % of magic level a player will lose when dying WITHOUT blessings
        blessPercent = 0 -- % of magic level a player will lose when dying WITH blessings
    },
    [2] = { -- Skill Loss
        lossPercent = 10, -- % of skills a player will lose when dying WITHOUT blessings
        blessPercent = 0 -- % of skills a player will lose when dying WITH blessings
    },
    [3] = { -- Container Loss
        lossPercent = 10, -- % chance to lose backpack WITHOUT blessings
        blessPercent = 0 -- % chance to lose backpack WITH blessings
    },
    [4] = { -- Equipment Loss
        lossPercent = 10, -- % chance to lose each individual item equipped on a player WITHOUT blessings
        blessPercent = 0 -- % chance to lose each individual item equipped on a player WITH blessings
    }
}
function onPrepareDeath(cid, deathList)
    for i = 0,1,2,3,4 do
        doPlayerSetLossPercent(cid, i, ((getCreatureStorage(cid, blessingStorageValue) > 0 and blessConfig[i].blessPercent*0) or blessConfig[i].lossPercent*10))
    end
    return true







Talkactions/Scripts/blessings.lua
Code:
  function onSay(cid, words, param, channel)
        if getPlayerBlessing(cid, 5) == FALSE then
                if getPlayerMoney(cid) >= 100000 then
                        for i = 1,5 do
                                doPlayerAddBlessing(cid, i)
                        end
                        doSendMagicEffect(getCreaturePosition(cid), 39)
                        doPlayerRemoveMoney(cid, 100000)
                        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYDAMAGE)
                        doPlayerSendTextMessage(cid, 22, "You have been blessed by the gods!")
                else
                        doPlayerSendCancel(cid, "Sorry, but you dont have 10cc")
                        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
                end
        else
                doPlayerSendCancel(cid, "You have already been blessed.")
                doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        end
return true
end
 
I think theres some info about lessloss inside the vocations.xml, check that.

I found something about including this script into the login.lua:
Code:
local loss = getConfigValue('deathLostPercent')
    if(loss ~= nil) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
        doPlayerSetLossPercent(cid, PLAYERLOSS_SKILLS, loss * 10)
        doPlayerSetLossPercent(cid, PLAYERLOSS_MANA, loss * 10)
    end
try to edit and test, hope it helps!
 
Back
Top