RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[SOLVED!] HUD System with ability to change common event

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 75
what am i supposed to put here oh no im almost out
    "Advanced" HUD System
    9/11/10



    Summary
    I've been looking around for a good HUD, but I can't seem to find what I'm looking for! Most of them display the HP/MP of a character, but what I'm looking for is a unified one that can display the date, time and stamina of the player. I've been using Jet's scripts, but I'm looking for a way to unify all of them into one HUD.

    http://rmrk.net/index.php/topic,38148.msg446139.html#msg446139
    http://rmrk.net/index.php/topic,38147.msg446137.html#msg446137

    Secondly, I'm looking to see if there is a way a key or a button could be pressed that would turn on/off a common event with something in the HUD to say it was on/off.

    Features Desired
    • HUD That can implement a time/day/stamina system.
    • Ability to freely turn on/off a common event with a keystroke along with something in the HUD so players could know.
    ]
    [/list]

    Mockups




    (Ideally, I would like the HUD in that position, if possible.)

    Games its been in
      I have no idea, the closest thing I have seen it used is in
    World's Dawn, which was made by Sagitar

    http://rmrk.net/index.php/topic,39481.0.html

    [/list]



    Did you search?
    <<Yes!>>

    Where did you search?
    • RPG Maker VX Script releases
    • RPG Maker VX Script requests

    What did you search for?
    • HUD
    • Time (Systems)
    • Other things that I can't remember.

    EDIT: The most important thing I'm looking for right now is just a way to quickly trigger on/off a common event using a key or some sort of button!
    « Last Edit: September 13, 2010, 02:31:59 PM by Osaka »

    **
    Rep:
    Level 75
    what am i supposed to put here oh no im almost out
    I've been messing with Conditional Branch events, but for some reason nothing happens with the keys unless it's the directional buttons. Is there something I need to do in order for these keys to work?

    **
    Rep:
    Level 75
    RMRK Junior
    I think I can do that, if nobody else does. It seems easy to deal with, and could be a good script to test my newly-learned skills... :) I'll try to! If anybody else is willing to do this, please go ahead, I won't be angry.

    **
    Rep:
    Level 75
    RMRK Junior
    Well, I read the scripts an it seems that with a bit of configuration, you can have 2/3 of your requests using them alone...
    Just set the windows on map to true (MAP_TIME_WINDOW = true      STAMINA_ON_MAP = true) plus set the coorinates to a proper value (a few playtests should suffice to find what these are, I would do it myself, but I haven't got RMVX on this PC).

    I will do a script for the common event part.

    **
    Rep:
    Level 75
    what am i supposed to put here oh no im almost out
    For some reason the Stamina Window won't show up even if I put the setting as "True" (It will show up on the menu when one presses escape.)

    I went into the code and messed with it a little, and I think I have something working, but I think I will do that!

    And thank you thank you thank you for writing a script  ;D

    **
    Rep:
    Level 75
    RMRK Junior
    I did it! :D
    But the format is crappy. Anyway, I think I'll post it in the afternoon...

    **
    Rep:
    Level 75
    RMRK Junior
    And here we are!

    Code: [Select]
    #------------------------------------------------------------------
    #------------------------------------------------------------------
    #                  The Mormegil's Pretty Sunsets HUD
    #                             v 1.0
    #------------------------------------------------------------------
    #------------------------------------------------------------------
    #
    # This is a HUD system has a window that checks if a certain Common
    # Event was called, and the possibility to call it by pressing a
    # button on map.
    #
    #------------------------------------------------------------------
    #
    #     $$$$$$$$$$$$$$$ CUSTOMIZATION OPTIONS $$$$$$$$$$$$$$$$$$$$
    #
    # You can customize the position of the window of the HUD,

    TMPS_HUD_EVENT_POSITION = [0, 0]

    # its text,

    TMPS_HUD_TEXT_ON = "Online"
    TMPS_HUD_TEXT_OFF = "Offline"

    # the button you need to press to turn the common event on/off,

    TMPS_BUTTON = Input::X    # default is A

    # the switch this common events toggles

    TMPS_SWITCH = 1           # insert ID here

    # and the common event called:

    TMPS_COMMON_EVENT = 1     # insert ID here
     
    #------------------------------------------------------------------
    #------------------------------------------------------------------
    #------------------------------------------------------------------

    #                   STOP EDITING PAST THIS POINT!
    # @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    # @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    # @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    #

    class Scene_Map < Scene_Base
      alias tmps_event_start start
      def start
        @window_TMPS = Window_TMPS.new(TMPS_HUD_EVENT_POSITION[0], TMPS_HUD_EVENT_POSITION[1])
        tmps_event_start
      end

      alias update_tmps update
      def update
        update_tmps
        update_tmps_event_call
        @window_TMPS.update
      end

      def update_tmps_event_call
        if Input.trigger?(TMPS_BUTTON)
          common_event = $data_common_events[TMPS_COMMON_EVENT]
          if $game_switches[TMPS_SWITCH]
            $game_switches[TMPS_SWITCH] = false
          else
            $game_switches[TMPS_SWITCH] = true
          end
          $game_temp.common_event_id = common_event.id
        end
      end
    end

    class Window_TMPS < Window_Base
     
      def initialize(x, y, width = 110)
        @txton = TMPS_HUD_TEXT_ON
        @txtoff = TMPS_HUD_TEXT_OFF
        super(x, y, width, WLH + 32)
        self.opacity = 255
        @width_window_tmps = self.width
        refresh
      end
     
      def refresh
        if $game_switches[TMPS_SWITCH]
          onoff = "ON"
        else
          onoff = "OFF"
        end
        self.contents.clear
        draw_event_onoff(@width_window_tmps - 8, @txton, @txtoff, onoff)
      end
     
      def draw_event_onoff(width, text_on, text_off, onoff = "OFF")
        if onoff == "ON"
          self.contents.draw_text(4, 0, width, WLH, text_on)
        elsif onoff == "OFF"
          self.contents.draw_text(4, 0, width, WLH, text_off)
        end
      end

      def update
        refresh
      end
    end


    I still don't know how to mess around with the format, but this should be enough to start! The rest is up to masters of RMVX language...

    **
    Rep:
    Level 75
    what am i supposed to put here oh no im almost out
    This is PERFECT! Thank you so much! I'm sure this script can help a ton of people as well who are looking to have a similar effect. You are incredible.


    .

    **
    Rep:
    Level 75
    RMRK Junior
    Well, thank you! But believe me, this was far from difficult... It was my first script after all!

    **
    Rep:
    Level 75
    RMRK Junior
    Actually I found a problem. It does not dispose itself. I'll work on it later, though...

    **
    Rep:
    Level 75
    what am i supposed to put here oh no im almost out
    Actually I found a problem. It does not dispose itself. I'll work on it later, though...

    I used a conditional branch within the common event, and it worked fine. So, when someone presses the A key, the common event is triggered, the conditional branch checks to see which control switch is on/off and reacts accordingly.

    **
    Rep:
    Level 75
    RMRK Junior
    Yeah, the problem was with the window itself. If you open, say, the menu, the window doesn't disappear. Nor does it desappear when you invoke it again (thus if you call it 300 times you'll have 300 windows on screen, one aboe the other).

    Try this:
    Quote
    #------------------------------------------------------------------
    #------------------------------------------------------------------
    #                  The Mormegil's Pretty Sunsets HUD
    #                             v 1.0
    #------------------------------------------------------------------
    #------------------------------------------------------------------
    #
    # This is a HUD system has a window that checks if a certain Common
    # Event was called, and the possibility to call it by pressing a
    # button on map.
    #
    #------------------------------------------------------------------
    #
    #     $$$$$$$$$$$$$$$ CUSTOMIZATION OPTIONS $$$$$$$$$$$$$$$$$$$$
    #
    # You can customize the position of the window of the HUD,

    TMPS_HUD_EVENT_POSITION = [0, 0]

    # its text,

    TMPS_HUD_TEXT_ON = "Online"
    TMPS_HUD_TEXT_OFF = "Offline"

    # the button you need to press to turn the common event on/off,

    TMPS_BUTTON = Input::X    # default is A

    # the switch this common events toggles

    TMPS_SWITCH = 1           # insert ID here

    # and the common event called:

    TMPS_COMMON_EVENT = 1     # insert ID here
     
    #------------------------------------------------------------------
    #------------------------------------------------------------------
    #------------------------------------------------------------------

    #                   STOP EDITING PAST THIS POINT!
    # @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    # @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    # @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    #

    class Scene_Map < Scene_Base
      alias tmps_event_start start
      def start
        @window_TMPS = Window_TMPS.new(TMPS_HUD_EVENT_POSITION[0], TMPS_HUD_EVENT_POSITION[1])
        tmps_event_start
      end

      alias update_tmps update
      def update
        update_tmps
        update_tmps_event_call
        @window_TMPS.update
      end

      def update_tmps_event_call
        if Input.trigger?(TMPS_BUTTON)
          common_event = $data_common_events[TMPS_COMMON_EVENT]
          if $game_switches[TMPS_SWITCH]
            $game_switches[TMPS_SWITCH] = false
          else
            $game_switches[TMPS_SWITCH] = true
          end
          $game_temp.common_event_id = common_event.id
        end
      end
    end

    class Window_TMPS < Window_Base
     
      def initialize(x, y, width = 110)
        @txton = TMPS_HUD_TEXT_ON
        @txtoff = TMPS_HUD_TEXT_OFF
        super(x, y, width, WLH + 32)
        self.opacity = 255
        @width_window_tmps = self.width
        refresh
      end
     
      def refresh
        if $game_switches[TMPS_SWITCH]
          onoff = "ON"
        else
          onoff = "OFF"
        end
        self.contents.clear
        draw_event_onoff(@width_window_tmps - 8, @txton, @txtoff, onoff)
        unless $scene.is_a?(Scene_Map)
          self.dispose
        end
      end
     
      def draw_event_onoff(width, text_on, text_off, onoff = "OFF")
        if onoff == "ON"
          self.contents.draw_text(4, 0, width, WLH, text_on)
        elsif onoff == "OFF"
          self.contents.draw_text(4, 0, width, WLH, text_off)
        end
      end

      def update
        refresh
      end
    end