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

C++ monsters have more strength depending on the skull / Alterar força do monstro pela skull

NicolasCRP

New Member
Joined
Jul 22, 2022
Messages
3
Reaction score
0
Hello, I want the monster to have more strength depending on its skull, how do I do that?
I know it's from the source code but I don't know where to start.

Olá, quero que o monstro tenha mais força dependendo da sua caveira, como faço isso?
sei que é pelo código fonte mas não sei por onde começar.
 
Lua:
local config = {
[SKULL_RED] = 5, --%
[SKULL_BALCK] = 10,
[SKULL_ORANGE] = 15
}
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if attacker:isMonster() then
        if config[attacker:getSkull()] then
            if primaryDamage > 0 then
                primaryDamage = math.floor(primaryDamage + ( primaryDamage * (config[attacker:getSkull()] / 100 )))
            end
            if secondaryDamage > 0 then
                secondaryDamage = math.floor(secondaryDamage + ( secondaryDamage * (config[attacker:getSkull()] / 100 )))
            end
        end
    end
end

doesn't need source changes (but source change is the best for it to decrease any extra CPU usage)
 
Lua:
local config = {
[SKULL_RED] = 5, --%
[SKULL_BALCK] = 10,
[SKULL_ORANGE] = 15
}
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if attacker:isMonster() then
        if config[attacker:getSkull()] then
            if primaryDamage > 0 then
                primaryDamage = math.floor(primaryDamage + ( primaryDamage * (config[attacker:getSkull()] / 100 )))
            end
            if secondaryDamage > 0 then
                secondaryDamage = math.floor(secondaryDamage + ( secondaryDamage * (config[attacker:getSkull()] / 100 )))
            end
        end
    end
end

doesn't need source changes (but source change is the best for it to decrease any extra CPU usage)
I'm newbie where do I make this change? could you explain me better please
 
Back
Top