How do you reference an actor's TP value?

Lunarcomplex

Villager
Member
Joined
Oct 3, 2015
Messages
20
Reaction score
5
First Language
English
Primarily Uses
RMMV
There doesn't seem to be a way to set a variable to an actor's TP value. I would like to force an action for an actor based on when the actor's TP is 100 during a battle. $gameActors.actor(1).tp == 100; didn't seem to work in the conditional branch's script condition.
 

Fugama

Means well, but messes up sometimes.
Veteran
Joined
Jun 7, 2014
Messages
158
Reaction score
90
First Language
Fake English
Primarily Uses
RMMV
There doesn't seem to be a way to set a variable to an actor's TP value. I would like to force an action for an actor based on when the actor's TP is 100 during a battle. $gameActors.actor(1).tp == 100; didn't seem to work in the conditional branch's script condition.

Your script call works perfectly in the console, there shouldn't be any reason why it wouldn't work. Or if there is it's something outside of that.

if you want to set an in game variable equal to Actor 1's TP

Code:
var = (Put Variable ID Here)
value = $gameActors.actor(1).tp
$gameVariables.setValue(var, value);

should work fine
 
Last edited:

Lunarcomplex

Villager
Member
Joined
Oct 3, 2015
Messages
20
Reaction score
5
First Language
English
Primarily Uses
RMMV
Still doesn't seem to be functioning correctly. I have a Common Event running Parallel and I've confirmed it's turned on correctly with a text box just to make sure, but within the Common Event I have this:

◆If:Script:$gameActors.actor(1).tp == 100;
◆Abort Battle

:End

It doesn't seem to want to even Abort Battle.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,787
Reaction score
7,876
First Language
German
Primarily Uses
RMMV
As said, the tp call should work - if you place it at the correct moment and in the correct contexts.

And there are several possibility where you can place it wrong.

For example, unless an actor has the "preserve TP"-trait, TP is always deleted at the end of combat and randomized at the beginning of combat. So unless that trait is present, any use outside the battlescreen will return that TP is zero, because it is.

And several other options, so please tell us where and when you want to check TP to get a solution.

EDIT:
Javascript needs === to check for conditions, not ==
Try that in your script box.

And give screenshots if that doesn't help - your structure as described sounds very strange
 

Fugama

Means well, but messes up sometimes.
Veteran
Joined
Jun 7, 2014
Messages
158
Reaction score
90
First Language
Fake English
Primarily Uses
RMMV
Still doesn't seem to be functioning correctly. I have a Common Event running Parallel and I've confirmed it's turned on correctly with a text box just to make sure, but within the Common Event I have this:

◆If:Script:$gameActors.actor(1).tp == 100;
◆Abort Battle

:End

It doesn't seem to want to even Abort Battle.

If you use Yanfly's buffs and states core along with auto passive states you can setup something like that I think. this is the test code I used with the buffs and states core to see if it would run

Code:
<custom regenerate effect>

if (user.tp >= 20){

BattleManager.processAbort();

}

</custom regenerate effect>

I made it greater than or equal to 20 just to speed up the testing process.

Also "==" does check for conditions, basically the way that works is this:

"=" will set a value
"==" will check for the same vaule of the same or different types ("2" is matched with 2)

"===" checks for same type and value ("2" is NOT matched with 2)
 

Lunarcomplex

Villager
Member
Joined
Oct 3, 2015
Messages
20
Reaction score
5
First Language
English
Primarily Uses
RMMV
I was able to use a special tag to preserve tp after battle and using $gameActors.actor(1).tp; I was able to display that number back to the player in a text box. But for some reason I can't seem to get a conditional branch to function during a battle when tp is 100 do something, anything (really need it to force an action like an ultimate ability or something). The branch is in a common event, parallel, and I can confirm it runs fine by testing text boxes with it (but this was only outside of a battle).
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,787
Reaction score
7,876
First Language
German
Primarily Uses
RMMV
@Lunarcomplex Descriptions don't help - we need to see the events as screenshots, especially because parallel processes should not function during battle. And in your description you're missing a lot of details on the events themselves.

So if you want help, you have to post screenshots of the events. If you don't post screenshots, we can only assume that you don't want us to help you.
 

Lunarcomplex

Villager
Member
Joined
Oct 3, 2015
Messages
20
Reaction score
5
First Language
English
Primarily Uses
RMMV
If parallel processes don't function during battle how should I go about forcing my battler to use a skill once they've reached 100 TP?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,787
Reaction score
7,876
First Language
German
Primarily Uses
RMMV
that's what the troop events are for, they work with the span instead of other triggers
 

Lunarcomplex

Villager
Member
Joined
Oct 3, 2015
Messages
20
Reaction score
5
First Language
English
Primarily Uses
RMMV
Alright thank you, I just made it so every single troop always ran a common event, seems like a roundabout way of doing it but it works.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,787
Reaction score
7,876
First Language
German
Primarily Uses
RMMV
yes, that is a rounabout way - but to get better help you would have to provide a screenshot so that we can see what you tried to do.
Because there are better ways than that...
 

Latest Threads

Latest Posts

Latest Profile Posts

I haven't make anything new yet, but I'm back addicted to writing some MZ plugins. Man, I wish I have more free time like I did 5 years ago.
Holy cow... work is demanding and I'm back in college. I'm kind of scared of my dad right now after the incident, but at least I don't live with him all the time. Anyway, working on Fandom Scouts and my FNAF character set. The FNAF sprites are actually going to be used in the game... unfortunately the enemy sprites are FNAF World traces, so no sharing those.
The honeymoon period is over with Cyberpunk 2077, It sadly doesnt live up to the hype, pretty graphics arent everything (especially when I cant even do something as simple as changing the radio station over!). Replaying Breath of the wild has reminded me what a good game really looks like, plus that one has good glitches!....

Forum statistics

Threads
107,690
Messages
1,031,473
Members
139,812
Latest member
staggqueen
Top