Can't get TP to work as a variable

● ARCHIVED · READ-ONLY
Started by Aurorain 9 posts View original ↗
  1. 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.

    Spoiler
    TPProblem_zpsd68e67de.png
    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?  :(
  2. 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.
  3. 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.
  4. 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.
  5. 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:
  6. show us the set-up. :)
  7. Engr. Adiktuzmiko said:
    show us the set-up. :)
    Ah, whoops! Here it is, sorry about that.

    Spoiler
    TPProblem1_zpsefa0ef30.png
    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?
  8. 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
  9. Alright, that did it! I can't thank both of you enough for helping me with this, it's working good now!  ;_;