Where is the max value for statelv defined?

Daxter

Pirate
Registered
LV
0
 
Joined
Jul 24, 2026
Messages
7
Reaction score
0
Points
3
I'm working on a skill that consumes all current SP, then deals damage equal to that amount.
I figured I'd use a state on the caster so the game knows how much SP was consumed when it reached the damage dealing stage, eg:


Code:
function Skill_MD_Begin ( role , sklv )
    local sp = Sp(role)
    local sp_reduce = sp
    --print("Current values are sp "..sp.." and sp_reduce "..sp_reduce)
    if sp - sp_reduce < 0 then
        --print("Check NOK")
        SkillUnable(role)   
        return
    else
        --print("Adding STATE MD")
    end
    Sp_Red (role , sp_reduce )
    print("Adding state with level of "..sp_reduce)
    AddState( role , role , STATE_MD, sp_reduce , 1000 )
    local StateLv = GetChaStateLv ( role , STATE_MD )
    print("statelevel of "..StateLv)
end

function Skill_MD_End ( ATKER , DEFER , sklv )

    print("Getting State LV")
    local StateLv = GetChaStateLv ( ATKER , STATE_MD )
    local spr_stat = Sta(ATKER)
    local hpdmg = spr_stat * 6 * StateLv
    print("Dealing "..hpdmg.." damage")
    Hp_Endure_Dmg( DEFER , hpdmg )
    RemoveState(ATKER, STATE_MD)
end

function State_MD_Add ( role , statelv )
    print("State MD has been added")
end

As configured above, I get:

Adding state with level of 138
statelevel of 0
Only when I use values below 10 do I actually get the state to be parsed:

Adding state with level of 7
State MD has been added
statelevel of 7

Is there a way to increase this cap?
 
it called state level , max level in source for them is
Code:
unsigned char uchStateLv{0};
so in best case can be at max 255
you just doing wrong way , if its skill dmg should happen at the end of skill which is Skill_MD_End

and don't need to do addstate,remove state just caste dmg calculated base on current sp * state level = final dmg
 
  • Like
Reactions: Daxter
You're right, I was overcomplicating. Thanks for the help.

In case anyone runs into a similar issue, this is what I'm running:

Code:
function SkillSp_MD ( sklv )                                   
    return 0
end

function Skill_MD_Begin ( role , sklv )
    print("Skill_MD_Begin")
    local sp_reduce = SkillSP_MD(sklv)
    SP_Red (role, sp_reduce)
end

function Skill_MD_End ( ATKER , DEFER , sklv )
    local sp = Sp(ATKER)
    local sp_reduce = sp
    if sp - sp_reduce < 0 then
        SkillUnable(ATKER)   
        return
    else
    end
    local spr_stat = Sta(ATKER)
    local hpdmg = math.floor((spr_stat/8) * sp_reduce)
    Hp_Endure_Dmg( DEFER , hpdmg )
end