Character substitution / temporary summon in battle

Rpg Maker Mv Version 1.0.0


I want to be able to have a character cast a skill that will summon a dragon in his place. After battle , the user should return. Also, the hero should return when the dragons HP is 0, or when the Dragon has expended a certain amount of turns, or a custom skill point.


I currently have set up a skill for the hero 


Summon : calls common event  ( common event only has: remove character "hero", add character "dragon")


and the dragon is


Revert : call common event (common event has reverse commands)


However if I do not use the revert skill, the battle ends with the dragon, and is there until i use a party change event.


I am not familiar with JS. and have not been able to find a solution with searching, perhaps my terms are wrong.


I have a well understanding of algorithms, however not the method nor the syntax for this engine.


I know basically I want a condition loop, any coder will understand me. I just have no idea how to implement this, among a slew of other things.


:if (dragon_HP) <= 0


 remove_character = Dragon


add_character = Hero :


:if (dragon_turns) = 5


remove_character = Dragon


add_character = Hero


:if (battle_end)


 remove_character = Dragon


add_character = Hero:


As I said, I know the syntax is not correct, however the conditions, variables, and solutions should be evident.


I believe this could be implemented and used for a variety of things, another variation is similar to J'eanne D'arc, where the heroes can transform,


or like BOF3 & 4, transform into a dragon form.


Any help would be appreciated, even links to a solid tutorial on JS and using it with RMMV.

Original thread: https://forums.rpgmakerweb.com/threads/character-substitution-temporary-summon-in-battle.55262/