Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Common Event in the Menu Screen

Is it possible to allow common events to run in the menu screen?

I'm trying to set up a common event that checks the hero's armour and weapon set-up, and then alters his sprite and battler to reflect the equipment he is wearing. Currently this is set up to run in parallel process constantly. But there are two issues here:

1) That's a constantly looping script, running over and over when most of the time it isn't needed. There's a chance it could contribute to lag.
2) It doesn't run in the menu screen. So when you select a new suit of armour to wear in the 'equipment' screen, and then exit back to the menu screen, the sprite on the menu is still shown to be wearing the old armour set, and will remain that way until the menu is exited altogether and then re-opened.

What i'd really like to do is set up the common event to be called when the 'B' button is pressed (mapped to Esc - opening and closing the menu). Since weapons and armour can only be changed from the menu, it's the only time i'd need the event. But although that button press is registered when I first press Esc to open the menu, it isn't registered when I press Esc to move back from the equip screen to the menu screen, or when I press Esc in the menu to return to the field screen. So the sprite is only updated after changing the equipment, exiting the menu, and then re-opening the menu.

Any thoughts? I presume it's possible to script somehow, but I can imagine this being kind of complex.

Thanks for reading :cheers:

-Silver-
 
It's not that complex, though getting an equipment-graphics script might make it easier as a whole.

In the mean time, here's one way of doing it:
Go to Scene_Menu in the script editor (F11), and Ctrl-F search for the line "if Input.trigger?(Input::B)".
Once you find it, put the following line right under it:
Code:
$game_temp.common_event_id = <COMMON EVENT ID>
Replace <COMMON EVENT ID> with the ID of the graphics-changing common event you have. That'll call that common event whenever you exit the menu. If you're using a CMS, you might have to find Scene_Menu elsewhere (in that script).

Good luck!
 
Thanks for the reply Reives!

That solution has the script half working now. It does register the button press and call the common event, but the menu sprite apparently doesn't get refreshed until the menu is exited. So while the game apparently knows that the sprite has changed, it doesn't reflect that in the menu screen until it is closed and re-opened - refreshing the sprites.

Would it be possible to add a line at the end of the common event which forces the menu sprite to refresh? That way when the equipment screen is exited, any changes made to equipment would be registered, and the sprite would be refreshed, so that when the menu screen has loaded it shows the sprite in the new armour set. I'm going to start digging through the script and see if I can find the command used to do this, but any help would be greatly appreciated!

Thanks for reading :cheers:

-Silver-
 
(Bump)

I haven't had any luck getting this to work so far. I've tried adding script to tell the menu graphics to refresh. I've tried making it exit from the equip screen to the field map, redrawing the sprite, then re-entering the menu screen. I even edited the menu to display the character's battler instead of the sprite, and then tried inserting script to redraw the battler. None of these things have worked, so i've pretty much exhausted my limited scripting understanding.

Anyone got any more ideas they can throw my way? I'd really appreciate them.

-Silver-
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top