Passing a Variable to a Scene

● ARCHIVED · READ-ONLY
Started by Rime 6 posts View original ↗
  1. Is there a way to pass a variable or a symbol to a scene without the use of global variables?

    Similar to how Scene_Menu does it with personal commands where it passes the current actor to Scene_Skill, Scene_Equip, or Scene_Status.

    Also, how can you call a Scene's method from a different scene (e.g. Scene_Map)? It gives a NoMethod error. 
  2. Scene_Menu doesn't "pass" the current actor. It either sets a variable in $game_party or $game_temp or another global class, which is then accessed by the other scene, or it calls a method from the other scene which sets the variable.


    Take a look at how Scene_Shop is handled when called from Game_Interpreter.
  3.  

    Shaz said:
    ...it calls a method from the other scene....
    How does one do this?
  4. Shaz said:
    Take a look at how Scene_Shop is handled when called from Game_Interpreter.
  5. On the scene you've made or any exisitng scene, make a method. In Scene_Shop, it named "def prepare()"

    And then, after calling the scene, call the method

    Code:
    SceneManager.call(Scene_Something)SceneManager.scene.prepare(arg1, arg2, etc ...) # <-- This is where you pass the variable into the scene
  6. Thanks. I thought Scene_Shop was using the global variable method. I'll try these out. Thank you :)