Make variable X equal to Actor or Enemy Y's current TP?

sabatadarkness

Villager
Member
Joined
Nov 13, 2014
Messages
10
Reaction score
1
First Language
English
Primarily Uses
Ultimately, I'll want to make that actor or enemy be affected by a state if that variable is equal to 100, but this can be done without extra scripting.  Unfortunately, TP is not, by default, an option you can choose when making a variable equal to an actor's parameter.  I'd like to get a simple script to attach to a Control Variables event that calls for actor X's current TP and another that calls for enemy X's current TP.  If it affects anything, I have changed TP's name to SP in this case.
 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,440
First Language
French
Primarily Uses
RMMV
Ultimately, I'll want to make that actor or enemy be affected by a state if that variable is equal to 100, but this can be done without extra scripting.  Unfortunately, TP is not, by default, an option you can choose when making a variable equal to an actor's parameter.  I'd like to get a simple script to attach to a Control Variables event that calls for actor X's current TP and another that calls for enemy X's current TP.  If it affects anything, I have changed TP's name to SP in this case.
tape in console


$gameActors.actor(1)


to found tp state
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
823
First Language
Hungarian
Primarily Uses
RMVXA
For actors:


$game_actors[ID].tp


The ID is the database ID of the actors.


For enemies (only in battle):


$game_troop.members[index].tp


The index is the troop index of the enemy in the battle.


If you use an ABS, you must get the enemy assigned to the event and call the tp method on that.


You can use these in Control Variables event commands.
 

sabatadarkness

Villager
Member
Joined
Nov 13, 2014
Messages
10
Reaction score
1
First Language
English
Primarily Uses
Sixth, I've tried your method, and I get the following error after inputting commands.

Script 'Game_Interpreter' line 543: NoMethodError occurred.


unidentified method 'tp' for nil:NilClass


This is my first time scripting in RPG Maker VX Ace, so I'm not sure what I may have done wrong, but here's a screenshot of the event.


State 26 Check.png
 
Last edited by a moderator:

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
823
First Language
Hungarian
Primarily Uses
RMVXA
You did not use the brackets I used, these ones: [ ] .


The ID of the actors and index of the enemies must be inside those brackets.
 

sabatadarkness

Villager
Member
Joined
Nov 13, 2014
Messages
10
Reaction score
1
First Language
English
Primarily Uses
Yeah, I tried it that way, too.  I did that first, actually.  Got the same error.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
823
First Language
Hungarian
Primarily Uses
RMVXA
If that event is run on the map, you will get a NoMethodError.


There are no enemies on the map at all, so trying to get a member from $game_troop will yield a nil, and nil got no tp method/variable defined, and the error triggers.


You can't use $game_troop at all on the map, only in battles.
 

sabatadarkness

Villager
Member
Joined
Nov 13, 2014
Messages
10
Reaction score
1
First Language
English
Primarily Uses
Could the fact I did the battle in a Troop test be the cause?
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
823
First Language
Hungarian
Primarily Uses
RMVXA
Ahh, I see, you counted the troop members from 1 instead of 0.


If we talk about indexes (mostly anywhere in scripting), they start from 0 instead of 1.


So change the troop member indexes to 0, 1 and 2, and it should work, assuming your troop got at least 3 members in it.
 

sabatadarkness

Villager
Member
Joined
Nov 13, 2014
Messages
10
Reaction score
1
First Language
English
Primarily Uses
And that did it!  Thanks so much for sticking with me through this whole thing.
 

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

Latest Threads

Latest Posts

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,047
Messages
1,018,540
Members
137,834
Latest member
EverNoir
Top