Jump to content
  • 0

Question

Posted

if( (skill_lv >= battle_config.max_heal_lv) && (sd->status.base_level == 99) && (job_name(sd->status.class_) == "High Priest") )

This is giving segmentation fault to my server when heal is used. I want it so that it checks for the base level and job is High Priest.

 

 

4 answers to this question

Recommended Posts

  • 0
Posted
11 hours ago, Playtester said:

You need to check for "sd" first. sd is NULL when monsters use the skill which will cause a crash when you try to access sd->status.

Thanks! that helps!

This part of the code does not work. (job_name(sd->status.class_) == "High Priest") My job is high priest, but not detecting it.

This is the revise code.

 

        if( (skill_lv >= battle_config.max_heal_lv) && sd )
        {
            if(sd->status.base_level == 99 && (job_name(sd->status.class_) == "High Priest"))
            {
               return 1;
            }

            else
            {
               return 2;
            }
        }

 

It always heals 2. even though I'm level 99, and my job is high priest.

  • 0
Posted (edited)

Got it working. I can't simply compare a string by == "string"

so to compare string in C,

First I have to declare a variable char with value High Priest

Quote

     char *job_compare = "High Priest";

Then compare this to sd->status.class_ by

Quote

(strcmp(job_name(sd->status.class_),job_compare) == 0)

Thanks by the way! 

Edited by trickzjen23

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...