Countdown timer that interrupts messages

Discussion in 'RGSS3 Script Requests' started by welcler, Jul 27, 2019.

  1. welcler

    welcler Villager Member

    Messages:
    20
    Likes Received:
    3
    First Language:
    English
    Primarily Uses:
    RMVXA
    Quoted from my post in the VXA board:
    I was told this would be best achieved with a script but I'm a noob at scripting.
     
    #1
  2. Kes

    Kes Global Moderators Global Mod

    Messages:
    20,945
    Likes Received:
    10,652
    First Language:
    English
    Primarily Uses:
    RMVXA
    Just a heads up for the future. If you have a similar situation again where you have started a thread and been told that it needs to be somewhere else, just Report your post and ask for the thread to be moved. That way we don't end up with orphaned and duplicate threads.
    Thanks.
     
    #2
  3. Heirukichi

    Heirukichi Veteran Veteran

    Messages:
    1,249
    Likes Received:
    507
    Location:
    Italy
    First Language:
    Italian
    Primarily Uses:
    RMVXA
    I'll answer what you asked in the previous thread as well. With a script call you could do this before calling the Game Over command:
    Code:
    $game_message.clear
    $game_message.visible = false
    
    With a script you can simply add this below Materials
    Code:
    class Scene_Map < Scene_Base
      alias hrk_scene_change_old scene_change_ok?
      def scene_change_ok?
        $game_switches[pick_a_switch_id] || hrk_scene_change_old
      end
    end
    
    Of course, you have to change "pick_a_switch_id" with a real switch ID (it can be any ID). Once you do, you can set that switch to true and the game will allow you to perform a scene change even if the message is visible.
     
    #3
  4. welcler

    welcler Villager Member

    Messages:
    20
    Likes Received:
    3
    First Language:
    English
    Primarily Uses:
    RMVXA
    Kes, sorry! I'm new to the forums.

    Heirukichi, the script call doesn't seem to work. I tried your script but it's not working for me either, what am I doing wrong?
    I used switch 47 for the script. Here's basically what I did

    Code:
    class Scene_Map < Scene_Base
      alias hrk_scene_change_old scene_change_ok?
      def scene_change_ok?
        $game_switches[47] || hrk_scene_change_old
      end
    end
    Autorun:
    Timer start
    Switch 47 on
    Self-switch A on

    Parallel process with condition self-switch A:
    Conditional branch: timer 0
    >Game over

    It's still only triggering game over after the messages finish.
     
    #4
  5. Heirukichi

    Heirukichi Veteran Veteran

    Messages:
    1,249
    Likes Received:
    507
    Location:
    Italy
    First Language:
    Italian
    Primarily Uses:
    RMVXA
    That's strange, it works perfectly in a blank project. I didn't use the timer, but the Game Over scene was successfully called even with the message there. Here is my event.
    [​IMG]
    The first line is used to wait 3 seconds, don't mind it.
     

    Attached Files:

    #5
  6. welcler

    welcler Villager Member

    Messages:
    20
    Likes Received:
    3
    First Language:
    English
    Primarily Uses:
    RMVXA
    Huh, so I tried the script call without the timer and it does work. It just doesn't seem to be working with the timer.

    Would you mind testing it out with a timer?
     
    #6
  7. Heirukichi

    Heirukichi Veteran Veteran

    Messages:
    1,249
    Likes Received:
    507
    Location:
    Italy
    First Language:
    Italian
    Primarily Uses:
    RMVXA
    You are right, having both the timer sprite and the message window visible prevents the Parallel Process interpreter from running, that is the reason why it does not stop. You can solve it using this
    Code:
    class Scene_Map < Scene_Base
      alias hrk_update_no_timer_old update
      def update
        hrk_update_no_timer_old
        if ($game_switches[47] && ($game_timer.sec == 0))
          SceneManager.call(Scene_Gameover) 
        end
      end # Update
    end # Scene_Map class
    
    It does not check if it is possible to change scene, it automatically switches to the Game Over scene, even if the message is visible. Just be sure not to use your switch/timer combination anywhere else, if the timer reaches 0 and the switch is still ON it will trigger a Game Over, no matter what.
     
    #7
  8. welcler

    welcler Villager Member

    Messages:
    20
    Likes Received:
    3
    First Language:
    English
    Primarily Uses:
    RMVXA
    It works! Thank you so much : )
     
    #8

Share This Page