how would I make this skill?

Hi, I've got an idea for a skill, but I'm not entirely sure how I would do this. I think it'll need to use variables, but I'm not so clued up on them, so that's why I need help.

Basically, what I want to do is this:

When the skill is used, the character can't be controlled for X number of turns. Any damage he takes during that time is stored and then, when he can move again, it's sent back to a random enemy.

So, for example. Let's say while he's uncontrollable, he gets hit for 300 damage in total. Then, at the end he deals back 300 to a random enemy.

How do I make the game record the damage he's taken?
So you're looking for a move like "Bide" from Pokemon?

EDIT: If you give me some time I could figure it out.
So you're looking for a move like "Bide" from Pokemon?
Something like that, yeah. 
Okay, give me a bit I'll send you a project with the finished skill.
Hi, I'm sorry to revive an old topic, but I have interest in this as well, and couldn't find it elsewhere. Is there any way you could send the project with the finished skill too? Thanks in advance
Hi, I'm sorry to revive an old topic, but I have interest in this as well, and couldn't find it elsewhere. Is there any way you could send the project with the finished skill too? Thanks in advance
Sorry to burst your bubble but that skill never came to fruition. As near as I can be informed by more expert users, this kind of skill needs some Scripting behind it to actually work, the variables and finnicking required is mindboggling to say the very least!
This is actually quite possible with a little eventing and the help of a really simple script from a fellow named Kal(it is actually possible without a script as well... but you'd need a second state that lasts 1 turn longer than the first state and adds the second skill as usable and you'd have to rely on the player to select said skill so the script works better.)

http://www.rpgmakervxace.net/topic/16007-common-event-when-state-ends-is-removed/

Alright, basically what you will need is two skills, a state, a variable, and two common events to get this working...

On the first skill you set the scope to 'user' and have it add the id of the custom state and call the first common event.

The second skill you set up everything you want animation wise and such (assuming your using sbs or something), set it to scope of one enemy but in the formula box you would put: $game_variables[variable id] - a.hp, I also tested with ($game_variables[variable id] - a.hp) * 2 to make sure the concept was working correctly.

Ok, for the state: set it for however many turns you want it to last, and set the 'cannot move' restriction. Then in features set [REC] * 0%(this is the one thing you may not like for this skill, but the way I'm doing it if you receive hp healing during the state effect it'll screw it up, why I tried having it deal double the damage to make it a bit of a high risk and high reward type skill...) and put the notetag: <srce SecondEventId> (assuming you got the script linked at top of post)

So all you do for event #1 is set the variable you are using = [ActorId]'s hp and Event #2 just need to have: Force Action, [Actor Id], [secondSkillId], random

That should do it, I tested it with an enemy doing 20 50 and 100 damage per turn to verify that it consistently deals the correct amount of damage, that said this will work as is as long as it is only one actor that can perform this ability, if there is more than one then you will have to check in both common events to verify which actor has the state affiliated with the first skill but that of course is not difficult, merely tedious.

Original thread: https://forums.rpgmakerweb.com/threads/how-would-i-make-this-skill.20936/