Array in scourge

Easycore

New member
Messages
184
Points
0
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:

Code:
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); 
 
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 == skill_id ) {clif->specialeffect(src, 722, AREA);break;}.EDITING, there is 1 more, wait I dig it out

OK

Code:
int i;ARR_FIND( 0, 5, i, skilleffects[i] == skill_id );if ( i < 5 )clif->specialeffect(src, 722, AREA);
 
Last edited by a moderator:
@@AnnieRuru Thanks for teaching me 
default_smile.png


 
Back
Top