trickzjen23 Posted January 25, 2017 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
0 Playtester Posted January 25, 2017 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
0 trickzjen23 Posted January 25, 2017 Author 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
0 trickzjen23 Posted January 26, 2017 Author 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
0 Playtester Posted January 26, 2017 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
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.
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.