trickzjen23 Posted January 25, 2017 Group: Members Topic Count: 37 Topics Per Day: 0.01 Content Count: 53 Reputation: 0 Joined: 11/25/11 Last Seen: December 6, 2023 Share Posted January 25, 2017 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. Quote Link to comment Share on other sites More sharing options...
0 Playtester Posted January 25, 2017 Group: Developer Topic Count: 33 Topics Per Day: 0.01 Content Count: 790 Reputation: 225 Joined: 01/30/13 Last Seen: 19 hours ago Share Posted January 25, 2017 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. Quote Link to comment Share on other sites More sharing options...
0 trickzjen23 Posted January 25, 2017 Group: Members Topic Count: 37 Topics Per Day: 0.01 Content Count: 53 Reputation: 0 Joined: 11/25/11 Last Seen: December 6, 2023 Author Share Posted January 25, 2017 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. Quote Link to comment Share on other sites More sharing options...
0 trickzjen23 Posted January 26, 2017 Group: Members Topic Count: 37 Topics Per Day: 0.01 Content Count: 53 Reputation: 0 Joined: 11/25/11 Last Seen: December 6, 2023 Author Share Posted January 26, 2017 (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 January 26, 2017 by trickzjen23 Quote Link to comment Share on other sites More sharing options...
0 Playtester Posted January 26, 2017 Group: Developer Topic Count: 33 Topics Per Day: 0.01 Content Count: 790 Reputation: 225 Joined: 01/30/13 Last Seen: 19 hours ago Share Posted January 26, 2017 If I'm not completely mistaken, a much easier way to check would be: sd->status.class_ == JOB_HIGH_PRIEST Quote Link to comment Share on other sites More sharing options...
Question
trickzjen23
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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.