Jump to content
  • 0

Modifying heal skill


trickzjen23

Question


  • Group:  Members
  • Topic Count:  37
  • Topics Per Day:  0.01
  • Content Count:  53
  • Reputation:   0
  • Joined:  11/25/11
  • Last Seen:  

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.

 

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Developer
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  790
  • Reputation:   225
  • Joined:  01/30/13
  • Last Seen:  

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.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  37
  • Topics Per Day:  0.01
  • Content Count:  53
  • Reputation:   0
  • Joined:  11/25/11
  • Last Seen:  

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.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  37
  • Topics Per Day:  0.01
  • Content Count:  53
  • Reputation:   0
  • Joined:  11/25/11
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  790
  • Reputation:   225
  • Joined:  01/30/13
  • Last Seen:  

If I'm not completely mistaken, a much easier way to check would be:

sd->status.class_ == JOB_HIGH_PRIEST

 

Link to comment
Share on other sites

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.

×
×
  • Create New...