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.
How do you reference an actor's TP value?
Javascript/Plugin SupportYour 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
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:Script:$gameActors.actor(1).tp == 100;
◆Abort Battle
◆
:End
It doesn't seem to want to even Abort Battle.
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
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
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)
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).
@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.
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.
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?
that's what the troop events are for, they work with the span instead of other triggers
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.
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...
Because there are better ways than that...
If you're going to use this roundabout method, instead of adding the event to EVERY troop, you could speed up the process and make things much cleaner by using this:
http://yanfly.moe/2015/10/18/yep-15-base-troop-events/
http://yanfly.moe/2015/10/18/yep-15-base-troop-events/
Original thread: https://forums.rpgmakerweb.com/threads/how-do-you-reference-an-actors-tp-value.74894/