Easycore 31 Posted December 6, 2015 Hi,I tried put an array in skill.c (specifically in skill_castend_id) ,that makes certain skills trigger a specialeffect when target received damage. I put the follow: int skilleffects[5] = {7, 5, 8,370, 371}; //skill_id that trigger specialeffect But I don't know how check this array, in my ignorance I tried this: if (skill_id == skillseffects[5])clif->specialeffect(src, 722, AREA); But it is severely wrong. PS: I wrote it after this: int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) { struct map_session_data *sd = NULL; struct status_data *tstatus; struct status_change *sc; if (skill_id > 0 && !skill_lv) return 0; nullpo_retr(1, src); nullpo_retr(1, bl); if (src->m != bl->m) return 1; if (bl->prev == NULL) return 1; sd = BL_CAST(BL_PC, src); Quote Share this post Link to post Share on other sites
0 AnnieRuru 957 Posted December 6, 2015 (edited) cheap method without array if ( skill_id == SM_MAGNUM || skill_id == SM_BASH || skill_id == SM_ENDURE || skill_id == CH_PALMSTRIKE || skill_id == CH_TIGERFIST )clif->specialeffect(src, 722, AREA);this method allows to use constant which makes your code easy to read and the array int i;for ( i = 0; i < 5; ++i )if ( skilleffects[i] == skill_id ) {clif->specialeffect(src, 722, AREA);break;}.EDITING, there is 1 more, wait I dig it out OK int i;ARR_FIND( 0, 5, i, skilleffects[i] == skill_id );if ( i < 5 )clif->specialeffect(src, 722, AREA); Edited December 7, 2015 by AnnieRuru 1 Easycore reacted to this Quote Share this post Link to post Share on other sites
0 Easycore 31 Posted December 6, 2015 @@AnnieRuru Thanks for teaching me Quote Share this post Link to post Share on other sites
Hi,
I tried put an array in skill.c (specifically in skill_castend_id) ,that makes certain skills trigger a specialeffect when target received damage.
I put the follow:
But I don't know how check this array, in my ignorance I tried this:
But it is severely wrong.
PS: I wrote it after this:
Share this post
Link to post
Share on other sites