Disabling/locking cancel button for a sec to delay the player from exiting menus to Scene_Map

Cerveau

Veteran
Veteran
Joined
Sep 16, 2015
Messages
33
Reaction score
9
First Language
Tagalog
Primarily Uses
Is it possible to literally disable the ":cancel" button's ability to exit/close the Scene_Menu for about 2-3 seconds (or so) in aims to delay the player from returning to Scene_Map on a lightning zap?
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,711
Reaction score
1,785
First Language
Spanish
Primarily Uses
RMVXA
if you're at scene_menu, all map events should be frozen.
there should be no lightning to speak of, since that would be a map event, and the moment you bring up the menu, the menu freezes the map.
 

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
433
Reaction score
170
First Language
English
Primarily Uses
RMXP
You could do 2 things.

Either set any value other than 10 in Scene_Base script:

Ruby:
  def transition_speed
    return 10
  end

Or add that transition_speed method to the menu you're talking about. It will overwrite the default one only on those menu scripts you've altered.
 

Cerveau

Veteran
Veteran
Joined
Sep 16, 2015
Messages
33
Reaction score
9
First Language
Tagalog
Primarily Uses
You could do 2 things.

Either set any value other than 10 in Scene_Base script:

Ruby:
  def transition_speed
    return 10
  end

Or add that transition_speed method to the menu you're talking about. It will overwrite the default one only on those menu scripts you've altered.
This small code does works wonders. It does delay the player from getting back to Scene_Map, and the other way around, unfortunately not that kind of delay I am looking for.
The delay I am aiming for is like putting a code that functions similar to "wait" that can be used to disable :B or the :cancel button in player's menu until the "wait" completes. The idea is to force the player to stay in the Scene_Menu for a given/specific duration before the game allows him/her to exit and go back to Scene_Map. Is this possible?
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,999
Reaction score
1,044
First Language
English
Primarily Uses
RMVXA
If you don't mind using a message box, you could even display a message. this will pause for 4 seconds and then carry on.
$game_message.add('\|\|\|\|\^')
If you find a way to hide the message box then maybe it would not display.
 

Cerveau

Veteran
Veteran
Joined
Sep 16, 2015
Messages
33
Reaction score
9
First Language
Tagalog
Primarily Uses
If you don't mind using a message box, you could even display a message. this will pause for 4 seconds and then carry on.
$game_message.add('\|\|\|\|\^')
If you find a way to hide the message box then maybe it would not display.
Hmm... didn't know $game_message works in Scene_Menus. An must say this is breakthrough! Really kinda dig the idea. I can picture it to work out good somehow, but how and where should I put it to silence the :B or cancel button to trap the player from getting back to Scene_Map?
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,999
Reaction score
1,044
First Language
English
Primarily Uses
RMVXA
What happens that you want the player to not exit? How does that work? What are you doing? Need to understand what you are doing to know where the code can possible be added.
 

Cerveau

Veteran
Veteran
Joined
Sep 16, 2015
Messages
33
Reaction score
9
First Language
Tagalog
Primarily Uses
What happens that you want the player to not exit? How does that work? What are you doing? Need to understand what you are doing to know where the code can possible be added.
I want the Scene_Menu forces the player for a stay for while whenever it is accessed, he is forced to stay there in Scene_Menu at least for a while; he is allowed to go to other scenes, but exit it to Scene_Map at least until the delay is finished.
...
Alternatively, if the former is impossible to achieve, I want the Scene_Map to have a black screen delay before loading it whenever everytime the player exits the Scene_Menu.
...
The idea is to prevent the player from spamming the menu from breaking the game to prevent an exploitable bug (as well as undesirable crash) from transpiring as the result of rapid Scene_Map / Scene_Menu vece-versa spamming.
...
I believe the reason for the said bug/crash was my self-made mouse interactible player menu windows (comprising of Selectables/Commands/etc) that handles inventory / equips / skills / status / huds / etc directly in the Scene_Map. The Scene_Menu that I keep insisting seems redundant, but that traditional Scene_Menu is actually replaced with a Scene_Settings options script from Yanfly.
 
Last edited:

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,999
Reaction score
1,044
First Language
English
Primarily Uses
RMVXA
Having it run from the menu is a challenge. Since exiting returns the scene and game message only runs in the scene map.
All of my attempts to cause a pause when exiting the menu shows the map and plays the message
I'll think about it more later.
 

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
433
Reaction score
170
First Language
English
Primarily Uses
RMXP
Let me ask you a simple question here.

Why can't you just let the player return to the map at once?

I don't see why it is bad at all. A player should be able to do it at will and not feel like you want them to close the game session or anything the like. If the player wants to keep watching the main menu for a minute or over an hour, that's his or her business. You haven't come up with a solid reason for altering the default behavior that would certainly improve the gamer's experience.
 
  • Like
Reactions: Bex

Cerveau

Veteran
Veteran
Joined
Sep 16, 2015
Messages
33
Reaction score
9
First Language
Tagalog
Primarily Uses
Having it run from the menu is a challenge. Since exiting returns the scene and game message only runs in the scene map.
All of my attempts to cause a pause when exiting the menu shows the map and plays the message
I'll think about it more later.

*Sigh* seems the pause is impossible both ways. :(

Let me ask you a simple question here.

Why can't you just let the player return to the map at once?

I don't see why it is bad at all. A player should be able to do it at will and not feel like you want them to close the game session or anything the like. If the player wants to keep watching the main menu for a minute or over an hour, that's his or her business. You haven't come up with a solid reason for altering the default behavior that would certainly improve the gamer's experience.
The truth is, yes, you are absolutely right, the player should be able to do that, and has the freedom and total control about it. But causing the delay to the player was actually the casualty of a much bigger concern in play.
...
The delay is actually pointless in normal sense as is, and I totally get your point... but my intention for it I have in mind is to mitigate the exploitable bug / forced-close crash (mostly the latter) when performing Scene Map and Scene Menu switch spamming. Therefore, the delay is the fix I believe it needs. The delay I am planning to set should last for at least 3 seconds (to 5 seconds worst case scenario) just to break the :B spamming chain; I am fully aware that going beyond the said delay durations is just silly, even insane if it is set to a minute or more. Haha.
...
The said bug/crash (I believe) started ever since I brought my self-made mouse-interactible custom menu running live into existence within Scene_Map. The said menu functions exactly the same as what the Scene_Menu offers. It manages inventory / equips / skills / etc. It is made with bunch of Windows for interface and Window_Selectable/Control objects for interactibilty.
...
The Scene_Map live custom menu runs all and well until the Scene_Menu is called upon with the :B or escape key. It may seem redundant to call the Scene_Menu when there is already a menu running in Scene_Map, but I have replaced it with Scene_Settings (Yanfly's Option Menu), though it was still the original Scene_Menu when I asked the question first, hence why I kept insisting it Scene_Menu. In addition, regardless either scenes, both results the same bug/crash when those scenes are being opened/closed especially in a rapid behavior.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,999
Reaction score
1,044
First Language
English
Primarily Uses
RMVXA
Got it.
Modifying Killozappit's Crossfade script you can do an exit from the menu and specify how long to have the fade image on screen.

I removed everything and set up menu exit crossfade.
Ruby:
#========================================================================
# ** Crossfader, by: KilloZapit
#------------------------------------------------------------------------
# Just a script to tweak the fades to use fancy crossfades like the
# battle transition screens for all fades.
# https://www.rpgmakercentral.com/topic/32575-fancy-pants-crossfade-script/
#------------------------------------------------------------------------

module KZFadeConfig
  # FADE_IMAGE: Transition image used for fades.
  # Works the battle transition image, use "" to use no image.
  FADE_IMAGE = "Graphics/System/Fade"
  # FADE_EDGE: Effects how smooth image fades are.
  FADE_EDGE = 100
  # FADE_TIME: Set to a number to set how long fades take or leave nil for
  # a default value based on the transition_speed method.
  FADE_TIME = 45
  # FADE_TIME_FACTOR: Multiplier for default fade times.
  FADE_TIME_FACTOR = 2
 
end

class Scene_Base
 
  def crossfade_time
    KZFadeConfig::FADE_TIME || transition_speed * KZFadeConfig::FADE_TIME_FACTOR
  end
 
  def perform_cross_transition
    Graphics.transition(crossfade_time, KZFadeConfig::FADE_IMAGE,
                        KZFadeConfig::FADE_EDGE)
  end
 
  def crossfade_to_black
    Graphics.freeze
    sprite = Sprite.new
    sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
    color = Color.new(0, 0, 0)
    sprite.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, color)
    sprite.x = 0
    sprite.y = 0
    sprite.z = 10000
    perform_cross_transition
    Graphics.freeze
    sprite.dispose
  end
 
end

class Scene_Menu < Scene_MenuBase
  alias r2_create_command_window_exit_fade create_command_window
  def create_command_window
    r2_create_command_window_exit_fade
    @command_window.set_handler(:cancel,    method(:exit_menu))
  end
  def exit_menu
    case $game_temp.fade_type
    when 0
      crossfade_to_black
    when 1
      white_fadeout(fadeout_speed)
    end
    return_scene
  end
end
 

Cerveau

Veteran
Veteran
Joined
Sep 16, 2015
Messages
33
Reaction score
9
First Language
Tagalog
Primarily Uses
Got it.
Modifying Killozappit's Crossfade script you can do an exit from the menu and specify how long to have the fade image on screen.

I removed everything and set up menu exit crossfade.
Ruby:
#========================================================================
# ** Crossfader, by: KilloZapit
#------------------------------------------------------------------------
# Just a script to tweak the fades to use fancy crossfades like the
# battle transition screens for all fades.
# https://www.rpgmakercentral.com/topic/32575-fancy-pants-crossfade-script/
#------------------------------------------------------------------------

module KZFadeConfig
  # FADE_IMAGE: Transition image used for fades.
  # Works the battle transition image, use "" to use no image.
  FADE_IMAGE = "Graphics/System/Fade"
  # FADE_EDGE: Effects how smooth image fades are.
  FADE_EDGE = 100
  # FADE_TIME: Set to a number to set how long fades take or leave nil for
  # a default value based on the transition_speed method.
  FADE_TIME = 45
  # FADE_TIME_FACTOR: Multiplier for default fade times.
  FADE_TIME_FACTOR = 2
 
end

class Scene_Base
 
  def crossfade_time
    KZFadeConfig::FADE_TIME || transition_speed * KZFadeConfig::FADE_TIME_FACTOR
  end
 
  def perform_cross_transition
    Graphics.transition(crossfade_time, KZFadeConfig::FADE_IMAGE,
                        KZFadeConfig::FADE_EDGE)
  end
 
  def crossfade_to_black
    Graphics.freeze
    sprite = Sprite.new
    sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
    color = Color.new(0, 0, 0)
    sprite.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, color)
    sprite.x = 0
    sprite.y = 0
    sprite.z = 10000
    perform_cross_transition
    Graphics.freeze
    sprite.dispose
  end
 
end

class Scene_Menu < Scene_MenuBase
  alias r2_create_command_window_exit_fade create_command_window
  def create_command_window
    r2_create_command_window_exit_fade
    @command_window.set_handler(:cancel,    method(:exit_menu))
  end
  def exit_menu
    case $game_temp.fade_type
    when 0
      crossfade_to_black
    when 1
      white_fadeout(fadeout_speed)
    end
    return_scene
  end
end
It worked! Not only it causes the sweet delay that I think my game needs, but the fade effect also brings a bonus aesthetics.
...
It did nerfed the exploitable bug as expected, but sadly not the crash as it still persist. Never-the-less this has been what I have been asking and looking for. Thanks, bruh!
 

Latest Threads

Latest Posts

Latest Profile Posts

ScreenShot_5_26_2022_11_36_32.png
added a Panic gauge to battle. it fills up according to your actions. each character has a different passive that activates once the gauge is full. also once full, a countdown starts and after each action taken, the gauges decreases. with each character, the decrease is different.
Genuinely considering making a thread informing people how to Google.
It's time for Da Update...

Prototyping some overworld abilities. Some of the characters you'll meet on your journey can use special overworld skills to travel around. This can be something like digging holes in the ground or getting hints towards your next objective.

Even more things I made.
Equipping Abilities is very important.
fLhHhZjh.gif

Forum statistics

Threads
122,157
Messages
1,146,898
Members
160,425
Latest member
macaronnnnnnnn
Top