Classe Cleric

Kamus Dev

Pirate
Registered
LV
0
 
Joined
May 16, 2026
Messages
12
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