Script call to evalulate TP to a variable for party members and monsters?

I can't find the script call to return the TP value of a party member or a monster.


The script call to change them is easy enough to find (
[SIZE=100%]ie. $gameTroop.members()[enemyIndex].gainTp(n)😉[/SIZE], but I'd like to be able to update a variable with this value.


The conditional feature in events actually has calls to grab every variable about actors and monsters EXCEPT for TP, sadly... :\
Hi! @JLowther


Try these:


//For an enemy
$gameTroop.members()[enemyIndex]._tp //enemy indexes start at 0
//For an actor
$gameActors.actor(actorId).tp


As a future tip: use the console extensively.


As an example, start a battle test, press f8 to get the console, and type $gameTroop.members(), it will return the array of every monster object in the troop and you can see every property this way. By doing this each time you need a script call, you'll learn much more rapidly than by asking for them ^^.


If you want to see everything in your game just type "window" without the quotes in the console, and you can gradually explore everything.
Perfect! And I will try that in the future, thanks!
Hi! @JLowther


Try these:



//For an enemy
$gameTroop.members()[enemyIndex]._tp //enemy indexes start at 0
//For an actor
$gameActors.actor(actorId).tp


As a future tip: use the console extensively.


As an example, start a battle test, press f8 to get the console, and type $gameTroop.members(), it will return the array of every monster object in the troop and you can see every property this way. By doing this each time you need a script call, you'll learn much more rapidly than by asking for them ^^.


If you want to see everything in your game just type "window" without the quotes in the console, and you can gradually explore everything.



So I was able to use the console to figure out how to call the X,Y coordinates of enemies in battle so I can place numbers over their heads (the screenX, screenY values), but I can't find the same data for actors.


It would appear that, given the more complex nature of actor sprites, their coordinates are located elsewhere. Any idea on the location values of actors sprites in battle?
@JLowther


You have several choices available: Those will refer to the spriteset of the current scene:


SceneManager._scene._spriteset._actorSprites[index]._homeX
SceneManager._scene._spriteset._actorSprites[index]._homeY


But you can also access them via the battle manager. Try window in the console, then expand battle manager and scene manager and you'll find them in no time.
@JLowther


You have several choices available: Those will refer to the spriteset of the current scene:



SceneManager._scene._spriteset._actorSprites[index]._homeX
SceneManager._scene._spriteset._actorSprites[index]._homeY


But you can also access them via the battle manager. Try window in the console, then expand battle manager and scene manager and you'll find them in no time.



Ah, excellent!


Yeah, I would've been searching through the "$"s for a long time without ever finding these.


Again, many thanks. 🙂

EDIT: Just found them under the battle manager: "BattleManager_registeredSprites" was where it was hiding. I'd have NEVER found this on my own...

Original thread: https://forums.rpgmakerweb.com/threads/script-call-to-evalulate-tp-to-a-variable-for-party-members-and-monsters.64875/