I haven't looked at Yanfly's menu script you posted yet, so I couldn't take it into account. Andar already posted a solution, but I hope this post at least offers some explanation for the experienced issues:
Q2:
For short, you need to include a
super call in your update method:
Each scene is processed by calling their "start" method to set them up, calling "update" in a loop while the scene is active, and then calling "terminate" to finish them
(see Scene_Base, line 11ff.). All of these methods have a basic implementation in Scene_Base, which should usually be included in their child classes implementations.
The update method in particular handles frame timing, update of all pressed keys and update of your scenes Window objects, so usually update is called once per frame. In your case, skipping this turns your update process into an infinite loop.
@menu1.set_handler
🙂task, method
🙂start))
Calling
start again after the scene has already been set up is usually a bad idea. The method is used to set up windows and other graphic related objects that should be disposed once they are no longer needed
(as usually done in the terminate method), and recreating those may leave undisposed windows/viewports behind that may cause problems later.
If you want to recreate specific objects or reset something, you should do that in a separate method.
Q3:
Fibers are used to run code in several steps separated by Fiber.yield. For example:
Spoiler
fiber = Fiber.new {
print "A"
Fiber.yield
print "B"
print "C"
Fiber.yield
SceneManager.goto(Scene_Gameover)
}
fiber.resume
fiber.resume
fiber.resume
The first time you call fiber.resume afterwards, "A" would be printed to the console. The second time "B" and "C" would be printed. The third time you call fiber.resume , the game would go to the gameover-screen.
While an interpreter internally uses a fiber to break parts of the event execution into steps, the main process
(where Scenes are usually executed) is not handled as a fiber, and thus Fiber.yield does not work here.
Wait periods in a scene are usually achieved by just doing nothing for a certain amount of update cycles. Scenes like
Scene_Battle achieve this by directly calling
update_basic, which - like update - advances your game by one frame, but does not execute anything else you put into your update method.
If you want to end a scene, you can usually do that by going to or calling another scene or returning to the previous scene where this was called from
(for ending a menu screen):
SceneManager.goto( Scene_XXX )
SceneManager.call( Scene_XXX )
return_scene
Calling a new scene allows you to later return to your previous scene by using
return_scene (used for menus and for temporary leaving the map screen) whereas goto does not remember the old scene and is used to transfer to a successing scene without the intention to go back
(like the transition to the gameover- or title screen).
Summarizing:
- You should add
super at the start of your update-method.
- Instead of
Fiber.yield , you can use
update_basic to wait for one frame in a Scene object. In non-scene update methods, you have to use if-statements to skip unwanted code.
- You should not call the
start method of a scene without
terminate-ing the scene first. And even then there probably is a better solution.
As far as event commands go, the scene may need to support some of them. Message commands require the scene to maintain a
Window_Message object that can process the messages set up by the event. Also, using map related commands like "Set Move Route" won't have an immediate effect since the map processing is probably paused in your menu, so waiting for it's completion would take forever if you chose that option.
However, apart from "Wait for XY to finish", some script commands that require you to be on the map and the fact that you have to take into account your scene might get terminated after any frame you updated the interpreter in due to possible "Call Menu" event commands, event execution in your menu should work fine in VXAce if I'm not mistaken.