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.

Modify Location Window

It's probaly a very easy thing to do but I can't seem to figure it out. Could anyone modify this location window so that if a switch is on it will be visible else it will not. Thanks in advance;)

class Window_Location < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(340, 430, 300, 50)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 160
refresh
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
$data_map_infos = load_data("Data/MapInfos.rxdata")
self.contents.draw_text(0, 0, 260, 17, $data_map_infos[$game_map.map_id].name)
end
end
[\spoiler]
 
add this method before your script's last end
Code:
def update
  self.visible = $game_switches[[COLOR=Red]switch_id[/COLOR]] == true
  super
end
and replace the red switch_id by your switch
 
replace
Code:
self.back_opacity = 160
for
Code:
self.opacity = 0
self.contents_opacity = 0
and replace the script I posted for this one
Code:
def update
  self.visible = $game_switches[switch_id] == true
  if self.visible != @last_visible
    if self.visible
      self.opacity += [COLOR=Red]20[/COLOR] if self.opacity < 160
      @last_visible = true if self.opacity >= 160
    else
      self.opacity -= [COLOR=Red]20[/COLOR] if self.opacity > 0
      @last_visible = true if self.opacity == 0
    end
    self.contents_opacity = self.opacity
  end
  super
end
You can play with the numbers in red to change the speed.
Ive not tested it, but it shall work.
 

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