Can't get TP to work as a variable

Aurorain

Overlord Illumise
Veteran
Joined
Dec 8, 2013
Messages
208
Reaction score
49
First Language
English
Primarily Uses
What I tried doing is having TP set to a variable, and linking it to whoever's in the party. However, I've run into a few problems, and was hoping someone could help me out on this. I want to have each member's TP decrease by 1 each turn, and I've got that little trait setup in the actor tab. And, that does work, but, here's where I seem to be screwing up.

I have each page set up like this(excluding the first page, since that's for something else I have setup); One for each actor in the party, but whenever TP gets altered in any way, even though I have the condition set to less than 1(I also tried just putting it equal to 0), it adds the state to all party members, regardless of their current TP. Another problem, is that if a spot in the active battle party is empty, I get this error message:

Script 'Game_Interpreter' line 543: NoMethodError occurred. Undefined method 'tp' for nil:NilClass.

The script problem I'm not sure how to fix, unless I always have there be a full party...which isn't something I can do, since there won't "always" be a full party. But, anyway, does anyone know how I might fix these two problems?  :(
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
you could always check first if the actor is valid or not, like using $game_actors[$game_variables[11]].nil?, and if that is true, then don't proceed (coz that means the actor doesn't exist).


as for the other one, not sure why it happens. Though one this is sure, since you already set Variable 11 to the TP value, then using that variable as the actor selector for adding/removing the state is not a good idea.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
You set the span of the troop event to battle - which means that it will be executed once per battle and never again.


For something like this, you need the span to be turn (once per turn) or moment (after each action if i remember correctly, might be wrong about this)


Edit, and yes, you cannot use the variable you set to member TP as the member ID without setting it to member ID again - either use two different variables or set the ID again before changing the state.
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
moment means it will happen for every moment that the condition is true, last time I looked at the descriptions


anyway, I would really suggest using a different variable for the Actor ID and the TP value. coz that's bound to give you problems the way it's set up right now.


You could always just reset it, but I do think it's better if you see to it that you use different variables for different things, just to minimize the probability of errors.
 
Last edited by a moderator:

Aurorain

Overlord Illumise
Veteran
Joined
Dec 8, 2013
Messages
208
Reaction score
49
First Language
English
Primarily Uses
Thanks...I must've misunderstood my setup, or something. But, the script error still happens if there's an empty spot in battle. I tried putting $game_actors[$game_variables[11]].nil? in through a conditional branch, but it didn't seem to change anything, unless I didn't set it up right. D:
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
show us the set-up. :)
 

Aurorain

Overlord Illumise
Veteran
Joined
Dec 8, 2013
Messages
208
Reaction score
49
First Language
English
Primarily Uses
show us the set-up. :)
Ah, whoops! Here it is, sorry about that.

I'm a little confused about this. Should I put the .nil? in a variable, or have the conditional branch for it be before the 0 tp check, or something?
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
it would go like this

Code:
Control Variable: Variable #11 = Member #3's Actor IDConditional branch: Script: $game_actors[$game_variables[11]].nil?  Don't put anything hereElse  Do the other things hereEnd
PS: can't see the pic, the internet here is kinda buggy right now
 
Last edited by a moderator:

Aurorain

Overlord Illumise
Veteran
Joined
Dec 8, 2013
Messages
208
Reaction score
49
First Language
English
Primarily Uses
Alright, that did it! I can't thank both of you enough for helping me with this, it's working good now!  ;_;
 
Last edited by a moderator:

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,050
Members
137,571
Latest member
grr
Top