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 Selwyn/Squall minimap script to show terrain.

I'm using the mini-map script written by Selwyn/Squall:
#==============================================================================
# â–  Passability Mini Map
#------------------------------------------------------------------------------
# made by Selwyn/Squall // selwyn@rmxp.ch
# released the 30th of May 2006
#==============================================================================

#==============================================================================
# â–  Scene_Map
#------------------------------------------------------------------------------
# draw the mini map
# @corner is the corner you want the mini map to be displayed in.
# 1 is upper left, 2 is upper right, 3 is bottom left and 4 is bottom right
#==============================================================================

class Scene_Map
  alias main_passminimap main
  alias update_passminimap update
  alias transfer_passminimap transfer_player
  #--------------------------------------------------------------------------
  # â—
 

ikos

Member

Try:

Code:
####################################################################
# MapRadar v2.2.2

# By: SojaBird
# Site: http://www.nestcast.blogspot.com
# Discription: Shows a radar with map and where the player is located.

####################################################################
module SojaBird_MR
# Start Setup
####################################################################

# General Setup
Movement = 1 # Wheter to move the player-icon or the map to display the player-position [Move Player-Icon=1, Move Map=2].
Activate = 1 # The mode to activate radar [1=Switch, 2=Key, 3=Switch AND Key, 4=Switch OR Key].
Radar_Switch = 1 # Number of the switch wich determens if the radar is shown or not.
Key = Input::F5 # Keyboard input to show the radar [Input::??].


# Picture Setup
View_X_Tiles = 50 # The width of the viewport of the radar.
View_Y_Tiles = 50 # The height of the viewport of the radar.

Frame = "Frame" # Name of the picture for the frame.
Player = "Player" # Name of the picture wich shows the player-indicator.
Back = "Back" # Name of the picture wich is the BG for the Hud when there is no map displayed.
# Note: The name of these maps need to be "Map..." where the "..." stand for the map nr. So for map001 you need a picture called "Map1", for map002 "Map2" etc.

# Placement Setup
PlacementX = 2 # Horizontal placement of the Hud [Left=1, Center=2, Right=3, Custom=0].
PlacementY = 3 # Vertical placement of the Hud [Top=1, Center=2, Bottom=3, Custom=0].

CustomX = 0 # Your custom horizontal placement of the Hud.
CustomY = 0 # Your custom vertical placement of the Hud.


# Opacity Setup
Back_Opacity = 200 # "Back" opacity.
Map_Opacity = 200 # "Map..." opacity.
Frame_Opacity = 200 # "Frame" opacity.
Player_Opacity = 200 # "Player" opacity.

Hide = true # Wheter or not to hide the Hud when the player is behind it.
Hide_Opacity = 150 # Amount that the opacity of the Hud is decreased when the player is behind it.


# ScriptUse Setup
UseRadar = true # Whether or not to use the script.


####################################################################
# End Setup
end
####################################################################

####################################################################
####################################################################

PlayerWidth= Cache.picture(SojaBird_MR::Player).width
PlayerHeight = Cache.picture(SojaBird_MR::Player).height

ViewWidth = SojaBird_MR::View_X_Tiles * PlayerWidth
ViewHeight = SojaBird_MR::View_Y_Tiles * PlayerHeight

X_Place =
case SojaBird_MR::PlacementX
when 1
0
when 2
272 - (ViewWidth / 2)
when 3
544 - ViewWidth
when 0
SojaBird_MR::CustomX
end

Y_Place =
case SojaBird_MR::PlacementY
when 1
0
when 2
208 - (ViewHeight / 2)
when 3
416 - ViewHeight
when 0
SojaBird_MR::CustomY
end

####################################################################
####################################################################
if SojaBird_MR::UseRadar == true
####################################################################
####################################################################

class Scene_Map < Scene_Base

def start
super
$game_map.refresh
@spriteset = Spriteset_Map.new
@message_window = Window_Message.new
$Radar = Radar.new
end

def terminate
super
if $scene.is_a?(Scene_Battle)
@spriteset.dispose_characters
end
snapshot_for_background
@spriteset.dispose
@message_window.dispose
$Radar.dispose
if $scene.is_a?(Scene_Battle)
perform_battle_transition
end
end

def update
super
$game_map.interpreter.update
$game_map.update
$game_player.update
$game_system.update
@spriteset.update
@message_window.update
if $Radar == nil
$Radar = Radar.new
end
$Radar.update
unless $game_message.visible
update_transfer_player
update_encounter
update_call_menu
update_call_debug
update_scene_change
end
end

def update_transfer_player
return unless $game_player.transfer?
fade = (Graphics.brightness > 0)
fadeout(30) if fade
@spriteset.dispose
$game_player.perform_transfer
$game_map.autoplay
$game_map.update
Graphics.wait(15)
@spriteset = Spriteset_Map.new
$Radar.dispose
$Radar = Radar.new
fadein(30) if fade
Input.update
end

end

####################################################################
####################################################################

class Radar
include SojaBird_MR

def initialize
# standard values
@ZoomXmap = $game_map.width * PlayerWidth / Cache.picture("Map" + $game_map.map_id.to_s).width.to_f
@ZoomYmap = $game_map.height * PlayerHeight / Cache.picture("Map" + $game_map.map_id.to_s).height.to_f

@ZoomXframe = View_X_Tiles * PlayerWidth / Cache.picture(Frame).width.to_f
@ZoomYframe = View_Y_Tiles * PlayerHeight / Cache.picture(Frame).height.to_f

@ZoomXback = View_X_Tiles * PlayerWidth / Cache.picture(Back).width.to_f
@ZoomYback = View_Y_Tiles * PlayerHeight / Cache.picture(Back).height.to_f

@MW = Cache.picture("Map" + $game_map.map_id.to_s).width * @ZoomXmap
@MH = Cache.picture("Map" + $game_map.map_id.to_s).height * @ZoomYmap

@ViewPort = Viewport.new(X_Place, Y_Place, ViewWidth, ViewHeight)

# draw frame
@frame = Sprite.new(@ViewPort)
@frame.bitmap = Cache.picture(Frame)
@frame.z = 9999
@frame.opacity = Frame_Opacity
@frame.zoom_x = @ZoomXframe
@frame.zoom_y = @ZoomYframe

# draw back
@map_back = Sprite.new(@ViewPort)
@map_back.bitmap = Cache.picture(Back)
@map_back.z = 9996
@map_back.opacity = Back_Opacity
@map_back.zoom_x = @ZoomXback
@map_back.zoom_y = @ZoomYback

# draw map
@map = Sprite.new(@ViewPort)
@map.bitmap = Cache.picture("Map" + $game_map.map_id.to_s)
@map.z = 9997
@map.opacity = Map_Opacity
@map.zoom_x = @ZoomXmap
@map.zoom_y = @ZoomYmap

# draw player
@player_icon = Sprite.new(@ViewPort)
@player_icon.bitmap = Cache.picture(Player)
@player_icon.z = 9998
@player_icon.opacity = Player_Opacity
case Movement
when 1
@player_icon.x = $game_player.real_x * PlayerWidth / 256
@player_icon.y = $game_player.real_y * PlayerHeight / 256
@map.x = (ViewWidth - @MW) / 2
@map.y = (ViewHeight - @MH) / 2
when 2
@player_icon.x = ViewWidth / 2
@player_icon.y = ViewHeight / 2
@map.x = @player_icon.x - ($game_player.real_x * PlayerWidth / 256)
@map.y = @player_icon.y - ($game_player.real_y * PlayerHeight / 256)
end

# update
update
end

def update
# move player or map?
case Movement
when 1
@player_icon.x = @map.x + ($game_player.real_x * PlayerWidth / 256)
@player_icon.y = @map.y + ($game_player.real_y * PlayerHeight / 256)
when 2
@map.x = @player_icon.x - ($game_player.real_x * PlayerWidth / 256)
@map.y = @player_icon.y - ($game_player.real_y * PlayerHeight / 256)
end
=begin
if @map.x < X_Place and @map.x + @MW > X_Place + ViewWidth and @player_icon.x == ViewWidth / 2
@map.x = @player_icon.x - ($game_player.real_x * PlayerWidth / 256)
else
@player_icon.x = @map.x + ($game_player.real_x * PlayerWidth / 256)
end
if @map.y < Y_Place and @map.y + @MH > Y_Place + ViewHeight and @player_icon.y == ViewHeight / 2
@map.y = @player_icon.y - ($game_player.real_y * PlayerHeight / 256)
else
@player_icon.y = @map.y + ($game_player.real_y * PlayerHeight / 256)
end
=end

# hide
if Hide == true
if $game_player.screen_x + 16 > X_Place and $game_player.screen_y + 4 > Y_Place and $game_player.screen_x - 16 < X_Place + ViewWidth and $game_player.screen_y - 28 < Y_Place + ViewHeight
@frame.opacity = Frame_Opacity - Hide_Opacity
@map_back.opacity = Back_Opacity - Hide_Opacity
@map.opacity = Map_Opacity - Hide_Opacity
@player_icon.opacity = Player_Opacity - Hide_Opacity
else
@frame.opacity = Frame_Opacity
@map_back.opacity = Back_Opacity
@map.opacity = Map_Opacity
@player_icon.opacity = Player_Opacity
end
end

# activation
case Activate
when 1
if $game_switches[Radar_Switch]
@frame.visible = true
@map_back.visible = true
@map.visible = true
@player_icon.visible = true
else
@frame.visible = false
@map_back.visible = false
@map.visible = false
@player_icon.visible = false
end
when 2
if Input.press?(Key)
@frame.visible = true
@map_back.visible = true
@map.visible = true
@player_icon.visible = true
else
@frame.visible = false
@map_back.visible = false
@map.visible = false
@player_icon.visible = false
end
when 3
if $game_switches[Radar_Switch] and Input.press?(Key)
@frame.visible = true
@map_back.visible = true
@map.visible = true
@player_icon.visible = true
else
@frame.visible = false
@map_back.visible = false
@map.visible = false
@player_icon.visible = false
end
when 4
if $game_switches[Radar_Switch] or Input.press?(Key)
@frame.visible = true
@map_back.visible = true
@map.visible = true
@player_icon.visible = true
else
@frame.visible = false
@map_back.visible = false
@map.visible = false
@player_icon.visible = false
end
end
end

def dispose
@map.opacity = 0
@map_back.opacity = 0
@player_icon.opacity = 0
@frame.opacity = 0
end
end


end

Just paste above main.
 

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