Skill that is unable to target the user

I have an MP recovery skill but the problem is that it is easily exploitable. The mage can use it over and over again the always have full MP (or at least more than he started with), especially the "all-party" variant. How can I make this a skill that cannot target the one who is using it? Naturally, a wizard being able to restore his own magical ability with his magic doesn't make a whole lot of sense.
Yanfly target core and selection control. Target core has a notetag that targets all allies but user. And selection control has 'not user' condition.
Yanfly target core and selection control. Target core has a notetag that targets all allies but user. And selection control has 'not user' condition.
Hmm, apparently it doesn't work outside of battles. The caster can still target themselves outside of battles. That would essentially mean that the mage could recover all of their MP after a battle as long as they had enough of it left to use the spell.

I was thinking perhaps if there was a way to save the caster's current MP value into a variable, have the spell take place, and then set the caster's MP back to that variable minus the cost for the spell. Maybe there's something I could do with common events or the damage formula but I'm not quite sure how to store the caster's MP into a variable that way. It would be easier if I just had one mage, but I have two that could be in the party at once technically.

This would have the obvious downside of wasting a turn if one tried to use it on themselves. Not sure how I'd work around that other than saying "sucks to suck don't try something stupid like that" lol. Maybe I could add a little pop-up message that would say something to the tune of "The spell had no effect" if the caster tries using it on themselves.
Maybe there's something I could do with common events or the damage formula but I'm not quite sure how to store the caster's MP into a variable that way
how does the mp recovery happen? if it does it by the damage formula then you dont need to store it. you could have it only recover the spell's mp cost for the target if the target and the user are the same, and use the regular formula if theyre not.
something like "a == b ? 10: a.mat+b.mdf"
how does the mp recovery happen? if it does it by the damage formula then you dont need to store it. you could have it only recover the spell's mp cost for the target if the target and the user are the same, and use the regular formula if theyre not.
something like "a == b ? 10: a.mat+b.mdf"
Currently it is in the damage formula, yeah. Right now I'm using "a.mdf * 2" for one of them, for instance. I'm still not too familiar with the formula box and everything it can do.

I replaced it with "a == b ? 10: a.mdf" and it definitely doesn't let the caster recover MP now, so thank you for that! They do lose the MP though instead, and in an ideal world I'd like it to cancel out if they were using it on themselves. This method would be perfect for the one that recovers everybody's MP, though.

EDIT: Disregard! I understand now that the "10" is supposed to resemble the amount of MP they get back if the caster is the same as the target. Thank you! I also now know that this spell cannot have any variance otherwise mashing it will refill them to max xD
I also now know that this spell cannot have any variance otherwise mashing it will refill them to max xD
I forgot about variance. if you use yanfly's skill core plugin you can still have it.
youd have the formula box contain the regular formula, and then you can use a pre-damage eval tag to force the recovery to be the skill's mp cost if the target is the user. damage values set by that note tag dont have variance applied unless you add it in manually
I forgot about variance. if you use yanfly's skill core plugin you can still have it.
youd have the formula box contain the regular formula, and then you can use a pre-damage eval tag to force the recovery to be the skill's mp cost if the target is the user. damage values set by that note tag dont have variance applied unless you add it in manually
You wouldn't happen to have an example for that one, would you? 🙂 I set it to this but it's not working so I'm sure I've done something wrong.

Code:
<Pre-Damage Eval>
<Custom MP Cost>
a == b ? cost = 423
</Custom MP Cost>
</Pre-Damage Eval>

Oh man I just realized it's not the MP Cost I want, it's the recovery lol. It's way too late for devving at this point xD Still, that's something I'm not sure how to do, override the recovery like that. Would appreciate just a bit more help 😀
I've done something wrong
Nesting tags is a no-go 😛
also the ternary operation needs an "else" to run, but itll be a touch easier just using a regular if statement now since you dont need it to return a value.

Code:
<Pre-Damage Eval>
if (a==b) value = -423;
</Pre-Damage Eval>
keep in mind, the value for this should should be negative
Nesting tags is a no-go 😛
also the ternary operation needs an "else" to run, but its be a touch easier just using a regular if statement now since you dont need it to return a value.

Code:
<Pre-Damage Eval>
if (a==b) value = -423;
</Pre-Damage Eval>
keep in mind, the value for this should should be negative
I see, thank you! It works pretty perfectly now! The only downside is wasting a turn in combat, but I suppose that's a very small price to pay when it works in every other way I want it to. Players will hopefully learn quickly enough that it won't recover a mage's own MP pool.

Just to learn exactly what is happening here... my guess is that MV sets the value of the formula box to negative if you select "MP/HP Recover" and this method overwrites that, so you have to set it to a negative value. Is that correct?
Just to learn exactly what is happening here... my guess is that MV sets the value of the formula box to negative if you select "MP/HP Recover" and this method overwrites that, so you have to set it to a negative value. Is that correct?
yeah. its a part of the steps the engine takes when its dealing damage through formulas.

healing and damage are both done through gainHp(), and the only real distinction is that damage is negative and healing is positive. one of the first parts of the damage calculation is to check if the skill is a recovery type. if it is, the value is inverted. but then when its time to deal the damage via gainHp(), its flipped again. when using that notetag to overwrite the value, you bypass the first flip, but not the second.
I see, thank you! It works pretty perfectly now! The only downside is wasting a turn in combat, but I suppose that's a very small price to pay when it works in every other way I want it to.
If you use the original reply from rpgLord, you won't be able to target yourself and waste a turn in combat.

Original thread: https://forums.rpgmakerweb.com/threads/skill-that-is-unable-to-target-the-user.168405/