Set caster id in variable via damage formula

Hi

Let me explain, I'm trying to change the battle system of my game.
My actors begin battle with 1 tp and every action costs 1 tp.
actors gain 1tp every turn.
if a actor wait or use specific abilities, he uses 0tp so, next turn, he would have 2tp. (Max tp is 4)

Anyway, I created an instant skill command called Berserk that active a state to the caster (+100% time action).
After using it, if the actor has more than 2tp, it gives the possibility to use Berserk 2 which has the same effect.

So I need the caster id to check his tp.

I tried to put
$game_variables[50] = a.id;
in the damage formula but it always results 0, That's a first problem.

Next, the command "Berserk" activate a common event :
$game_variables[51] = $game_actors($game_variables[50]).tp;

if $game_variables[51] > 2
hide_actor_command($game_variables[50], "use_skill", 42)
*42 is berserk id*
show_actor_command($game_variables[51], "use_skill", 43) *43 is berserk 2 id*

Else
disable_actor_command($game_variables[50], "use_skill", 42)


But when I use the spell, after the damage dealt, the combat stop and show "game_variables is not defined"

It's been a week I'm trying to fix it but I can't find anything that works on forums.
First problem: How about a.actorId()? Have you tried it yet?

Second: Syntax in MV is different from Ace
- $gameVariables.value(x) returns the value of variable X, while $gameVariables.setValue(x ,y) sets Y to the value of variable X.
- $gameActors.actor(x).tp returns the TP value of actor X, same with HP, MP.

You cannot use Ace syntax in MV, since MV is using Javascript as its language, not Ruby.
Actually I tried a.actorId, but not a.actorId().
I'm a bigginer with scripts and MV is my first rpgmaker program.
I took what I found on forums but I didn't know there was a different syntax.

Thank you for replying so fast.
I'll try it tonight and post if it works or not.
You can ask more about MV syntax here: https://forums.rpgmakerweb.com/inde...ve-their-own-thread.46341/page-43#post-767018

I cannot help you with those "hide_actor_command" and "show_actor_command", since i also have no idea about how it is written in Javascript.
First problem: How about a.actorId()? Have you tried it yet?

Second: Syntax in MV is different from Ace
- $gameVariables.value(x) returns the value of variable X, while $gameVariables.setValue(x ,y) sets Y to the value of variable X.
- $gameActors.actor(x).tp returns the TP value of actor X, same with HP, MP.

You cannot use Ace syntax in MV, since MV is using Javascript as its language, not Ruby.

Just to make sure I understood, would it be like :

Formula :
$gameVariables.setValue(50, a.actorId());

Common event :
$gameVariables.setValue(51, $gameActors.actor($gameVariables.value(50)).tp;

If $gameVariables.value(51) > 2
hide_actor_command(&gameVariables.value(50), "use_skill", 42)
show_actor_command(&gameVariables.value(50), "use_skill", 43)
else
disable_actor_command(&gameVariables.value(50), "use_skill", 42)
You can ask more about MV syntax here: https://forums.rpgmakerweb.com/inde...ve-their-own-thread.46341/page-43#post-767018

I cannot help you with those "hide_actor_command" and "show_actor_command", since i also have no idea about how it is written in Javascript.

hide_actor_command and show_actor_command are related to "actor battle command" plugin
I think your common event should be like this:
Code:
if ($gameVariables.value(51) > 2){
hide_actor_command($gameVariables.value(50), "use_skill", 42)
show_actor_command($gameVariables.value(50), "use_skill", 43)}
else{
disable_actor_command($gameVariables.value(50), "use_skill", 42)}

I have taken a look at that plugin, but haven't seen Hime using any semi-colons at the end of each script call. However, if you experience any issues, press F8 to see console log and try adding semi-colons.
Thank you so much !

Original thread: https://forums.rpgmakerweb.com/threads/set-caster-id-in-variable-via-damage-formula.83436/