Jump to content
  • 0
Sign in to follow this  
Easycore

Array in scourge

Question

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); 

 

 

 

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

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 by AnnieRuru

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.