[HELP] Custom skill that only work if an effect is active

reds09

New member
Messages
34
Points
0
Github
reds09
I'm trying to make a skill only be performed or take damage when the target is petrified (SC_STONE), but I can not solve.

I used the example of SC_WHITEIMPRISON:

if( sc->data[SC_WHITEIMPRISON] && skill_id != HW_GRAVITATION ) { // Gravitation and Pressure do damage without removing the effect      if( skill_id == MG_NAPALMBEAT ||        skill_id == MG_SOULSTRIKE ||        skill_id == WL_SOULEXPANSION ||        (skill_id && skill->get_ele(skill_id, skill_lv) == ELE_GHOST) ||        (!skill_id && (status->get_status_data(src))->rhw.ele == ELE_GHOST)          ){        if( skill_id == WL_SOULEXPANSION )          damage <<= 1; // If used against a player in White Imprison, the skill deals double damage.        status_change_end(bl,SC_WHITEIMPRISON,INVALID_TIMER); // Those skills do damage and removes effect      }else{        d->dmg_lv = ATK_BLOCK;        return 0;      }    } 



and I did my, but it does not work fot.

if(skill_id == NG_JUTSU_FUNERAL) { // Gravitation and Pressure do damage without removing the effect if(sc->data[SC_STONE]){ damage <<= 1; // If used against a player in White Imprison, the skill deals double damage. }else{ d->dmg_lv = ATK_BLOCK; return 0; } }

Is there some function that checks whether the player is with some active status?

Style the getStatus, however for the enemy.

 
You are checking the source's status. it should be like this:

if(skill_id == NG_JUTSU_FUNERAL) { // Gravitation and Pressure do damage without removing the effect if(tsc && tsc->data[SC_STONE]){ damage <<= 1; // If used against a player in White Imprison, the skill deals double damage. }else{ d->dmg_lv = ATK_BLOCK; return 0; } }
However, as the comment says, you're actually doubling damage if you keep it like this. So, for it doing exactly what you want it to do, it should be like this:

Code:
if(skill_id == NG_JUTSU_FUNERAL && !(tsc && tsc->data[SC_STONE])) {	// Deal damage only when the target is under stone curse status	d->dmg_lv = ATK_BLOCK;	return 0;}
 
You are checking the source's status. it should be like this:

if(skill_id == NG_JUTSU_FUNERAL) { // Gravitation and Pressure do damage without removing the effect if(tsc && tsc->data[SC_STONE]){ damage <<= 1; // If used against a player in White Imprison, the skill deals double damage. }else{ d->dmg_lv = ATK_BLOCK; return 0; } }
However, as the comment says, you're actually doubling damage if you keep it like this. So, for it doing exactly what you want it to do, it should be like this:

if(skill_id == NG_JUTSU_FUNERAL && !(tsc && tsc->data[SC_STONE])) { // Deal damage only when the target is under stone curse status d->dmg_lv = ATK_BLOCK; return 0;}
Mano thank you for being helped me, but it still fails the skill continues to take damage normally, not only when the player is in a state of petrification (sc_stone). Because my idea and make that skill just take damage when the enemy is stunned, proque if not she "misses". I tried other forms within that gave me no success.

 
You are placing it in the wrong place. For SC statuses checks it goes under status_check_skilluse (status.c), right here https://github.com/HerculesWS/Hercules/blob/master/src/map/status.c#L1796

Turn this:

if(tsc && tsc->count) { /* attacks in invincible are capped to 1 damage and handled in batte.c; allow spell break and eske for sealed shrine GDB when in INVINCIBLE state. */ if( tsc->data[SC_INVINCIBLE] && !tsc->data[SC_INVINCIBLEOFF] && skill_id && !(skill_id&(SA_SPELLBREAKER|SL_SKE)) ) return 0; if(!skill_id && tsc->data[SC_TRICKDEAD]) return 0; if((skill_id == WZ_STORMGUST || skill_id == WZ_FROSTNOVA || skill_id == NJ_HYOUSYOURAKU) && tsc->data[SC_FREEZE]) return 0; if(skill_id == PR_LEXAETERNA && (tsc->data[SC_FREEZE] || (tsc->data[SC_STONE] && tsc->opt1 == OPT1_STONE))) return 0; if( ( tsc->data[SC_STEALTHFIELD] || tsc->data[SC_CAMOUFLAGE] ) && !(st->mode&(MD_BOSS|MD_DETECTOR)) && flag == 4 ) return 0; }
To this:

Code:
if(tsc && tsc->count) {		/* attacks in invincible are capped to 1 damage and handled in batte.c; allow spell break and eske for sealed shrine GDB when in INVINCIBLE state. */		if( tsc->data[SC_INVINCIBLE] && !tsc->data[SC_INVINCIBLEOFF] && skill_id && !(skill_id&(SA_SPELLBREAKER|SL_SKE)) )			return 0;		if(!skill_id && tsc->data[SC_TRICKDEAD])			return 0;		if((skill_id == WZ_STORMGUST || skill_id == WZ_FROSTNOVA || skill_id == NJ_HYOUSYOURAKU)			&& tsc->data[SC_FREEZE])			return 0;		if(skill_id == PR_LEXAETERNA && (tsc->data[SC_FREEZE] || (tsc->data[SC_STONE] && tsc->opt1 == OPT1_STONE)))			return 0;		if( ( tsc->data[SC_STEALTHFIELD] || tsc->data[SC_CAMOUFLAGE] ) && !(st->mode&(MD_BOSS|MD_DETECTOR)) && flag == 4 )			return 0;		if (skill_id == NG_JUTSU_FUNERAL && !(tsc->data[SC_STONE])) 			return 0;	}
 
You are placing it in the wrong place. For SC statuses checks it goes under status_check_skilluse (status.c), right here https://github.com/HerculesWS/Hercules/blob/master/src/map/status.c#L1796

Turn this:

if(tsc && tsc->count) { /* attacks in invincible are capped to 1 damage and handled in batte.c; allow spell break and eske for sealed shrine GDB when in INVINCIBLE state. */ if( tsc->data[SC_INVINCIBLE] && !tsc->data[SC_INVINCIBLEOFF] && skill_id && !(skill_id&(SA_SPELLBREAKER|SL_SKE)) ) return 0; if(!skill_id && tsc->data[SC_TRICKDEAD]) return 0; if((skill_id == WZ_STORMGUST || skill_id == WZ_FROSTNOVA || skill_id == NJ_HYOUSYOURAKU) && tsc->data[SC_FREEZE]) return 0; if(skill_id == PR_LEXAETERNA && (tsc->data[SC_FREEZE] || (tsc->data[SC_STONE] && tsc->opt1 == OPT1_STONE))) return 0; if( ( tsc->data[SC_STEALTHFIELD] || tsc->data[SC_CAMOUFLAGE] ) && !(st->mode&(MD_BOSS|MD_DETECTOR)) && flag == 4 ) return 0; }
To this:

if(tsc && tsc->count) { /* attacks in invincible are capped to 1 damage and handled in batte.c; allow spell break and eske for sealed shrine GDB when in INVINCIBLE state. */ if( tsc->data[SC_INVINCIBLE] && !tsc->data[SC_INVINCIBLEOFF] && skill_id && !(skill_id&(SA_SPELLBREAKER|SL_SKE)) ) return 0; if(!skill_id && tsc->data[SC_TRICKDEAD]) return 0; if((skill_id == WZ_STORMGUST || skill_id == WZ_FROSTNOVA || skill_id == NJ_HYOUSYOURAKU) && tsc->data[SC_FREEZE]) return 0; if(skill_id == PR_LEXAETERNA && (tsc->data[SC_FREEZE] || (tsc->data[SC_STONE] && tsc->opt1 == OPT1_STONE))) return 0; if( ( tsc->data[SC_STEALTHFIELD] || tsc->data[SC_CAMOUFLAGE] ) && !(st->mode&(MD_BOSS|MD_DETECTOR)) && flag == 4 ) return 0; if (skill_id == NG_JUTSU_FUNERAL && !(tsc->data[SC_STONE])) return 0; }
great solved

 
Back
Top