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.

[RESOLVED] Windows on a map (HUD)

I am making my own HUD for Lost fantasy. I have the first window of it made, for skills. I need it to be shown on the map always unless there is a battle or the menu is opened. I also need the map to be shown in the background.

How can I do this?

Here is the window and scene script so far:

#--------------------------
# Scene_Hud
#--------------------------

class Scene_Hud
#-----------------
# Main processing
#-----------------

def main
#Call window
@window = Window_HudSkills.new
#Transition
Graphics.transition
#Main loop
loop do
#Update game screen
Graphics.update
#Update input info
Input.update
#Frame update
update
#Abort loop if screen is changed
if $scene != self
break
end
end
#Prepare for transition
Graphics.freeze
#Dispose of windows
@window.dispose
end

#-------------------
# Frame update
#-------------------

def update
# Update windows
@window.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to Menu screen
$scene = Scene_Map.new
return
end
end
end

#----------------------------------------
# Window_HudStats
#----------------------------------------

class Window_HudSkills < Window_Base
#----------------------------------------
# Object Initialization
#----------------------------------------
def initialize
super(421, 0, 219, 100)
self.contents = Bitmap.new(width - 2, height - 2)
refresh
end

def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = 16
#Fishing
fishlvl = $game_variables[8]
#Cooking
cooklvl = $game_variables[26]
#Hunting
huntlvl = $game_variables[29]
#Alchemy
alclvl = $game_variables[32]
#Agility
agilvl = $game_variables[35]
#-------------------------
#Text coding and placement
#-------------------------
self.contents.draw_text(35, 7, 50, 25, "#{fishlvl}")
self.contents.draw_text(100, 7, 50, 25, "#{cooklvl}")
self.contents.draw_text(165, 7, 50, 25, "#{huntlvl}")
self.contents.draw_text(35, 38, 50, 25, "#{alclvl}")
self.contents.draw_text(100, 38, 50, 25, "#{agilvl}")
#--------------------------
#Image coding and placement
#--------------------------
@bitmap = RPG::Cache.icon("fish.png")
self.contents.blt(7, 4, @bitmap, Rect.new(0, 0, @bitmap.width, @bitmap.height), 160)
@bitmap = RPG::Cache.icon("fo8.png")
self.contents.blt(71, 4, @bitmap, Rect.new(0, 0, @bitmap.width, @bitmap.height), 160)
@bitmap = RPG::Cache.icon("005-weapon05.png")
self.contents.blt(141, 4, @bitmap, Rect.new(0, 0, @bitmap.width, @bitmap.height), 160)
@bitmap = RPG::Cache.icon("skill_022.png")
self.contents.blt(7, 35, @bitmap, Rect.new(0, 0, @bitmap.width, @bitmap.height), 160)
@bitmap = RPG::Cache.icon("020-accessory05.png")
self.contents.blt(71, 35, @bitmap, Rect.new(0, 0, @bitmap.width, @bitmap.height), 160)
end
end
 
I am using Netplay+, so er... there are three different Scene_Maps. there is default, the one in the SDK, and the Netplay+ one. Do you know which one (and where) I would need to edit? (I don't exactly have much experience at SDK and stuff like that).
 
Where and how would I edit this script to add it?

Code:
#==============================================================================
# ** Scene_Map - Additions for Netplay Plusâ„¢
#------------------------------------------------------------------------------
# Author    Meâ„¢ and Shark_Tooth
# Version   1.0
#==============================================================================
class Scene_Map
  attr_accessor :spriteset
  #--------------------------------------------------------------------------
  # * Initializes map.
  #--------------------------------------------------------------------------
  def initialize
    $game_temp.spriteset_refresh
    Network::Main.send_map
  end
  
  alias pldlltransfer_player transfer_player
  def transfer_player
    pldlltransfer_player
    a = Network::Main.mapplayers
    a = {}
    Network::Main.send_start
    $scene = Scene_Reinit.new
    $game_temp.spriteset_renew = true
  end
  #--------------------------------------------------------------------------
  # * Updates Net/Map PLayers
  #--------------------------------------------------------------------------
  def update_netplayers
    if $game_temp.spriteset_renew
      @spriteset.dispose
      @spriteset = Spriteset_Map.new
      $game_temp.spriteset_renew = false
      return
    end
    for mapplayer in Network::Main.mapplayers.values
      begin
        mapplayer.update
      rescue
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Updates Systems
  #--------------------------------------------------------------------------
  alias netplay2_update_systems update_systems
  def update_systems
    # Update Mouse Position
    $mouse.update
    # Update Mouse
    #update_mouse
    # Update Input
    update_input
    # Update old systems
    netplay2_update_systems
    # Update Network
    update_network
    # Update Netplayers
    update_netplayers
    # Update Move
    Network::Main.send_move_change
    # Update Chat
    update_chat
    # Update Private Chat
    #update_pchat
    
  end
  #--------------------------------------------------------------------------
  # * Updates Chat
  #--------------------------------------------------------------------------  
  def update_chat
    if Input.trigger?(Input::F5)
      $scene = Scene_Chat.new
    end     
  end
  #--------------------------------------------------------------------------
  # * Updates Private Chat
  #--------------------------------------------------------------------------
  def update_pchat
    chatdo = false
    chatid = -1
    for chat in 0..$game_temp.pchat_refresh.size
      if $game_temp.pchat_refresh[chat]
        chatdo = true
        chatid = chat
      end
    end
    if chatdo
      $scene = Scene_PChat.new(chatid-1) unless $game_temp.pchat_refresh.size <= 1
    end
    if Input.trigger?(Input::F7)
      $scene = Scene_PChat.new if Network::Main.players.size >= 2
    end
  end
  #--------------------------------------------------------------------------
  # * Updates Input
  #--------------------------------------------------------------------------
  def update_input
    if Input.trigger?(Input::C)
      for player in Network::Main.mapplayers.values
        next if player == nil
        next if not face_too?(player)
        #update_pvp
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Updates Mouse
  #--------------------------------------------------------------------------  
  def update_mouse
    if Input.triggerd?(Input::Mouse_Left)
      if $game_player.mouse_passable?($game_player.x, $game_player.y, $mouse.map_x, $mouse.map_y)
        $game_player.find_path($mouse.map_x, $mouse.map_y)
      else
        for events in $game_map.events.values
          next if events.x != $mouse.map_x or events.y != $mouse.map_y
          $game_player.check_event_trigger_there([0,1,2]) if face_too?(events)
        end
        for player in Network::Main.mapplayers.values
          next if player == nil
          next if player.x != $mouse.map_x or player.y != $mouse.map_y
          #update_pvp
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Faceing and next too (object) ?
  #--------------------------------------------------------------------------
  def face_too?(events)
    new_x = $game_player.x + ($game_player.direction == 6 ? 1 : $game_player.direction == 4 ? -1 : 0)
    new_y = $game_player.y + ($game_player.direction == 2 ? 1 : $game_player.direction == 8 ? -1 : 0)
    # If event coordinates are consistent
    if events.x == new_x and events.y == new_y
      return true
    end
    return false
  end
  
  #--------------------------------------------------------------------------
  # * Updates Network
  #-------------------------------------------------------------------------- 
  def update_network
    Network::Main.update
  end
  #end class
end
 

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