Issues Referencing Current TP

Surrealistik

Villager
Member
Joined
Apr 2, 2018
Messages
8
Reaction score
0
First Language
English
Primarily Uses
RMVXA
Alright, having a problem getting a character's current TP in a script; specifically this is for Yanfly Engine Ace - Lunatic States v1.02

Of the two variables I have, mhp and tp per the following:

Code:
mhp = self.mhp.to_f
tp = self.tp.to_f
mhp returns the max HP of the character as expected while tp returns 100, or the max TP value, yet elsewhere, such as in Common Events (phrased like this: tp = $game_temp.common_event_user.tp.to_f ) it returns the appropriate current TP value.

What am I missing?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,434
Reaction score
7,713
First Language
German
Primarily Uses
RMMV
TP will always return the current TP value because maxTP is fixed to 100.
However, by default TP is randomized on battlestart and ignored outside battles.
To force the engine to store TP between battles and not to randomize it at battlestart, you need to give the actor the "preserve TP" trait/feature.
 

Surrealistik

Villager
Member
Joined
Apr 2, 2018
Messages
8
Reaction score
0
First Language
English
Primarily Uses
RMVXA
TP will always return the current TP value because maxTP is fixed to 100.
However, by default TP is randomized on battlestart and ignored outside battles.
To force the engine to store TP between battles and not to randomize it at battlestart, you need to give the actor the "preserve TP" trait/feature.
I mean, how do I get the _current_ TP of a character during combat? Whatever the TP happens to be at the time $game_temp.common_event_user.tp.to_f in the Common Event gets it perfectly; if it's 30 it will return 30; if it's 66 it will return 66. In every case during combat by contrast, self.tp.to_f will only return 100 despite referencing the exact same character with the exact same TP at that time.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,434
Reaction score
7,713
First Language
German
Primarily Uses
RMMV
TP should be referenced directly, for example in a damage formula a.tp will return the current TP of the skill user.

You don't give enough context to even guess why it doesn't work for you - it could be anything from the conversion (why convert to float at all??) to the programming content (what object is self at the position where you invoke it?)

If this doesn't help you, please give screenshots showing the entire content of where and how you're invoking that script line.
 

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
579
Reaction score
219
First Language
English
Primarily Uses
RMVXA
If it's for lunatic states, try:
user.tp.to_f
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,675
Reaction score
566
First Language
English
Primarily Uses
RMVXA
When looking through scripts, the only references I see for actors tp is
self.tp
user.tp
member.tp
What base association to use with it, I'm not sure.
$game_battler?
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,048
Messages
1,018,545
Members
137,834
Latest member
EverNoir
Top