Checking for a variable when accessing window commands

● ARCHIVED · READ-ONLY
Started by Dymdez 8 posts View original ↗
  1. Hi all,

    not a specific script question, but how do I make it so when a player accesses the "status" screen the game checks if a variable is greater than 0 and if it is, turns on a switch?
  2. You would have to insert into the appropriate place in the appropriate scripts ...

    Code:
    $game_switches[switch_id] = $game_variables[var_id] > 0
    Then it will turn the switch on if the variable is > 0, or off if it's 0 or less.
  3. Shaz, thank you.

    Where does the game check if you are accessing the Status screen? (I am using Yanfly core if that matters?)
  4. What is your purpose in turning on a switch when you enter the status screen? Couldn't you just do what you want to do based on what's in the variable instead of having to bring a switch into it? What does it do?


    Do a global search through the scripts for Scene_Status. Wherever it's called from, just add the line in there. Or if there are multiple places, find the Scene_Status.show method and add it in there.
  5. Hahaha, alright, here goes nothing.

    I am setting up my own stat leveling up system. I have Tsukihime's Scene Interpreter script which is going to run a common event (hence why I need the switch turned on). When the actor in my game levels up, I have set a variable to go up by 2 (these are the stat points). So basically, when the character levels up, if there are stat points, when the player chooses the "status" command, it will call the common event which will allow the player to allocate stat points with the status menu in the background.
  6. ah, gotcha. Yeah, I guess just try it out and see if it works.
  7. Yea, I can't wait lol. Do you by chance know exactly where in any of the window/menu/character scripts or wherever to place the code? I just need to put it exactly in the place that gets processed right when the status command is chosen.

    Ahh nvmd, doesn't work....It won't call the common event until after I exit the Status window, which seems to defy the entire purpose of the script but oh well.
  8. Well, by default, common events only run on the map or when you call them in battle. I thought Hime's script DID allow you to run common events within other scenes (menus). Maybe you're not calling it correctly - what's the call you're using and where did you put it?