Classe Cleric

Kamus Dev

Pirate
Registered
LV
0
 
Joined
May 16, 2026
Messages
21
Reaction score
0
Points
31
Hi everyone, I'm creating a private server and I've run into a problem with the cleric class. When it's taking damage, it's consuming its HP, even though it's in immortal mode where SP should be consumed first and then HP. I don't know what could be causing this. Can anyone give me some insight into how to solve this problem?
 
you have to adjust your function codes
JavaScript:
function Hp_Dmg(role,dmg)-

should have something like this inside it

Code:
    local statelv_mfd = GetChaStateLv ( role , STATE_MFD )
    local hp = Hp(role)
    local sp = Sp(role)
    if dmg <= 0 then
        hp = hp - dmg
        SetCharaAttr(hp, role, ATTR_HP )
        return

--some codes here
at the end
    if statelv_mfd >= 1 then 
        sp_change = statelv_mfd * 0.25 + 0.5
        if getMap == "garner2" then
            if isMonster == 0 then
                sp_change = statelv_mfd * 0.25 + 0.5
            end
        end

        if dmg / sp_change <= sp then 
            sp = math.floor ( sp - dmg/sp_change ) 
        else 
            hp =math.floor ( hp - ( dmg/sp_change - sp ) ) 
            sp = 0 
            RemoveState ( role , STATE_MFD ) 
        end 
    else    
        local ZSExp = GetChaAttr( role , ATTR_CSAILEXP )
        if ZSExp > 0 and ZSExp < 100 then
            dmg = dmg * 0.945
        end
        if ZSExp >= 100 and ZSExp < 12100 then
            dmg = dmg * ( 0.95 - math.floor( math.pow( (ZSExp / 100) , 0.5 )) * 0.005)
        end
        hp = Hp(role) - dmg 
    end 

    SetCharaAttr(sp, role, ATTR_SP ) 
    SetCharaAttr(hp, role, ATTR_HP )  
    end
 
  • Like
Reactions: Kamus Dev
Ei, encontrei! Vou te enviar as informações aqui. Qual parte eu preciso alterar para resolver meu problema?

function Hp_Dmg(role,dmg)
local hp = Hp(role)
local sp = Sp(role)
if dmg <= 0 then
hp = hp - dmg
SetCharaAttr(hp, role, ATTR_HP)
return
end

--Reduce Damage - Chaos Argent
local map_name_DEFER = GetChaMapName (role)
local Can_Pk_Garner2 = Is_NormalMonster (role)
local T = 0.10
if map_name_ATKER == "garner2" or map_name_DEFER == "garner2" then
if Can_Pk_Garner2 == 0 then
dmg = dmg * T
end
elseif map_name_ATKER == "garner3" or map_name_DEFER == "garner3" then
if Can_Pk_Garner2 == 0 then
dmg = dmg * T
end
elseif map_name_ATKER == "PKmap" or map_name_DEFER == "PKmap" then
if Can_Pk_Garner2 == 0 then
dmg = dmg * T
end
elseif map_name_ATKER == "bountyhunter" or map_name_DEFER == "bountyhunter" then
if Can_Pk_Garner2 == 0 then
dmg = dmg * T
end
elseif map_name_ATKER == "chaosicicle" or map_name_DEFER == "chaosicicle" then
if Can_Pk_Garner2 == 0 then
dmg = dmg * T
end
elseif map_name_ATKER == "darkswamp" or map_name_DEFER == "darkswamp" then
if Can_Pk_Garner2 == 0 then
dmg = dmg * T
end
elseif map_name_ATKER == "jialebi" or map_name_DEFER == "jialebi" then
if Can_Pk_Garner2 == 0 then
dmg = dmg * T
end
elseif map_name_ATKER == "puzzleworld" or map_name_DEFER == "puzzleworld" then
if Can_Pk_Garner2 == 0 then
dmg = dmg * T
end
elseif map_name_ATKER == "puzzleworld2" or map_name_DEFER == "puzzleworld2" then
if Can_Pk_Garner2 == 0 then
dmg = dmg * T
end
elseif map_name_ATKER == "leiting2" or map_name_DEFER == "leiting2" then
if Can_Pk_Garner2 == 0 then
dmg = dmg * T
end
elseif map_name_ATKER == "hell4" or map_name_DEFER == "hell4" then
if Can_Pk_Garner2 == 0 then
dmg = dmg * T
end
elseif map_name_ATKER == "hell5" or map_name_DEFER == "hell5" then
if Can_Pk_Garner2 == 0 then
dmg = dmg * T
end
elseif map_name_ATKER == "deathmatch" or map_name_DEFER == "deathmatch" then
if Can_Pk_Garner2 == 0 then
dmg = dmg * T
end
elseif map_name_ATKER == "teampk" or map_name_DEFER == "teampk" then
if Can_Pk_Garner2 == 0 then
dmg = dmg * T
end
elseif map_name_ATKER == "starena13" or map_name_DEFER == "starena13" then
if Can_Pk_Garner2 == 0 then
dmg = dmg * T
end
elseif map_name_ATKER == "starena23" or map_name_DEFER == "starena23" then
if Can_Pk_Garner2 == 0 then
dmg = dmg * T
end
elseif map_name_ATKER == "starena33" or map_name_DEFER == "starena33" then
if Can_Pk_Garner2 == 0 then
dmg = dmg * T
end
elseif map_name_ATKER == "starena43" or map_name_DEFER == "starena43" then
if Can_Pk_Garner2 == 0 then
dmg = dmg * T
end
end


you have to adjust your function codes
JavaScript:
function Hp_Dmg(role,dmg)-

should have something like this inside it

Code:
    local statelv_mfd = GetChaStateLv ( role , STATE_MFD )
    local hp = Hp(role)
    local sp = Sp(role)
    if dmg <= 0 then
        hp = hp - dmg
        SetCharaAttr(hp, role, ATTR_HP )
        return

--some codes here
at the end
    if statelv_mfd >= 1 then
        sp_change = statelv_mfd * 0.25 + 0.5
        if getMap == "garner2" then
            if isMonster == 0 then
                sp_change = statelv_mfd * 0.25 + 0.5
            end
        end

        if dmg / sp_change <= sp then
            sp = math.floor ( sp - dmg/sp_change )
        else
            hp =math.floor ( hp - ( dmg/sp_change - sp ) )
            sp = 0
            RemoveState ( role , STATE_MFD )
        end
    else   
        local ZSExp = GetChaAttr( role , ATTR_CSAILEXP )
        if ZSExp > 0 and ZSExp < 100 then
            dmg = dmg * 0.945
        end
        if ZSExp >= 100 and ZSExp < 12100 then
            dmg = dmg * ( 0.95 - math.floor( math.pow( (ZSExp / 100) , 0.5 )) * 0.005)
        end
        hp = Hp(role) - dmg
    end

    SetCharaAttr(sp, role, ATTR_SP )
    SetCharaAttr(hp, role, ATTR_HP ) 
    end