Giving TPback even if the Attack misses?

Hello. I have a question. I have made those two skills:

Skill#1 (100% Accuracy, costs 2 TP, gives 2 TP back) = Since its 100%, the user will always have the same TP amount after performing this attack.

Skill#2 (50% Accuracy, costs 2TP, gives 2TP back) = Now that the user can fail this attack and ends up with 2TP less than before, how can i make sure that the user still gets 2TP back, even if the skill misses?

Hope someone can help me there 🙂
...why would you even have a skill that gives back the same amount it costs? At that point you'd be as well just making it free.
Please show a screenshot of those skills to show us how you give back TP, there seems to be something wrong in your way.
Its similiar to the energy card system in Pokemon TCG. For example, if you put 2 energy cards on your pokemon card, you can perform a attack that costs 2 energy. However, those costs are not getting substracted so even after performing the attack that pokemon card would still have two energy cards attached to it. Some attacks might force the player to discard one of the attached energy cards.
Ah, I see. Yeah, what Andar said then. Show us how you've set up the skills.
ember7en5vs906q.png


fire1pjlvfib24.png


So when i perform that Ember attack and it misses because of 50% accuracy i am not getting that 1TP back, but i would like to.^^ Unfortunately maker is in german but i am sure you can figure out what is what. 🙂
What you could do is put a._tp += 1 before the damage formula so that when using the skill you gain a TP and then use 1. This will make it happen regardless of whether the skill hits.
Oh thats brilliant. Didnt knew its possible to give TP back in the formula. Thanks a lot. 🙂

So it would be something like this?
a._tp += 1 a.atk * 1.1?
the damage formula only gets executed in case of a hit, not in case of a miss, so that doesn't help here...
Crap, that's a good point actually.
I'm new to RPG Maker and I'm not sure how exactly you could do this, but you could go about it in the following way, if there's no way to manipulate "misses":
If the damage to the target is equal to "0", then TP+1, using conditional branches and variables and maybe even combining them with small scripts that deal with damage inputs.
Or something of that sort.
Well I don't think there is a way to do it in editor that gives tp back even on misses without a bit of javascript.

You can do it with a common event, a call to get the caster and then increase tp.

If you want to take a look at plugins, I think there's a default plugin in the dlc folder that provides you with variables that store the caster actor id or enemy index.

Else if you use yanfly plugins a simple user.gainTp(1) in an after eval (skill core) or even a small action sequence can do the job quite easily.


Doing it with a common event:
You'll need the script call below;
BattleManager._subject._actorId

Beware that this will only work if the skill is cast by an actor and will crash the game if the skill is cast by an enemy.

So:
-Have the skill call a common event
-In the common event set a variable to the above script call using the script box at the very end.
-increase tp by 1 to whatever variable id you used above.

Original thread: https://forums.rpgmakerweb.com/threads/giving-tpback-even-if-the-attack-misses.75604/