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

Lua Blessing in creaturescripts

Phemus

Member
Joined
Jun 16, 2012
Messages
149
Solutions
2
Reaction score
12
Hello, i have a script where fs you are certain level, you do not lose any items or skills level when you die, however, if you are above that level you lose everything like a normal character. This is the script
Code:
local array = {    
    PLAYERLOSS_EXPERIENCE,
    PLAYERLOSS_MANA,
    PLAYERLOSS_SKILLS,
    PLAYERLOSS_FIGHTING,
    PLAYERLOSS_CONTAINERS,
    PLAYERLOSS_ITEMS
}
local array2 = {    
    PLAYERLOSS_CONTAINERS,
    PLAYERLOSS_ITEMS
}

function onPrepareDeath(cid, deathList)
    if getPlayerLevel(cid) < 250 then
        for i = 1, #array do
            doPlayerSetLossPercent(cid, array[i], 0)
        end
    end
    return true
end

function onAdvance(cid, skill, oldLevel, newLevel)
    if skill == SKILL__LEVEL and newLevel == 250 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'From this new level onwards you can lose experience, items and skills if you are killed.')
        for i = 1, #array do
            doPlayerSetLossPercent(cid, array[i], 10)
        end
    end
    return true
end

function onLogin(cid)
    registerCreatureEvent(cid, "lessdeath")
    registerCreatureEvent(cid, "adv500")
    return true
end

The problem is that when somebody dies when they are above that level, they lose like 10+ levels. It is becoming a major problem in my server. In config.lua the deathlosepercent is set at 10
Code:
deathLostPercent = 10
I do not know if that has something to do with the problem.
I hope that someboy could help me. thank you!
 
you need to write some code for onLogin to add back levels, skills, magic if they are below the required minimum, based on vocation(?)
 
I get what you are saying, but the purpose of the script is when a player is level 500+(it is an example), when they die, you lose level, skills, items, etc like a normal player would do. Like a death without bless. If the player is below level 250, they cannot lose any skills. the problem here is that is a player level 500+ dies, they lose skills and everything, but they lose more than 10 or 12 levels. It varies.
 
Back
Top