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.

the MEGA-mini map

Script Request Template
Trying to get these two scripts to work together..........................~?

Script Title:
the MEGA-mini MAP
RMXP
here's an example

|----------------------------|
|
|...........(full screen)
|
| |---- |..................|-----|
| |mini |...................|pass|
| |----|....................|----|
|----------------------------|

Detailed Description:
Two minimap scripts that I would like to USE and FUSE both INTO ONE awesome script!
have both "minimaps" show in their own corner and each assigned to a separate button,
to toggle on and off...

in addition press both buttons to enable the FULL MAP feature!

the first one is the minimap with a full map feature.
(I simply typed in a "two button" trigger for the full map feature)
Code:
#CREDIT TO SQUALL - (a simple dual button configuration modified by g/A\/\/\|E|F/A\(C|=)                    

 

#(warning: putting my name in the script is not an attempt to acquire credit, but a mere heads up of a change to the original) 

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

 

class Game_Event < Game_Character

#--------------------------------------------------------------------------

# ? name

#--------------------------------------------------------------------------

def name

return @event.name

end

end

 

#==============================================================================

# ¦ Map_Base

#------------------------------------------------------------------------------

#  Base class for mini maps

#

# made by squall // [email=squall@loeher.zzn.com]squall@loeher.zzn.com[/email]

#==============================================================================

 

class Map_Base

MP_VERSION = 5

ACTIVATED_ID = 17

attr_reader :event

#--------------------------------------------------------------------------

# ? Initialize

#--------------------------------------------------------------------------

def initialize(corner, use_windowskin)

@tileset_name = $game_map.tileset_name

@bg = Window_Base.new(0, 0, 144, 112)

@bg.z = 9000

if no_display?

@bg.windowskin = nil

else

unless use_windowskin

@bg.dispose

@bg = Window_Base.new(0, 0, 160, 128)

@bg.contents = Bitmap.new(128, 96)

@bg.windowskin = nil

bmp = RPG::Cache.picture("")#graphic for frame

@bg.contents.blt(0, 0, bmp, Rect.new(0, 0, 128, 110))

@bg.z = 9015

end

end

@map = Sprite.new

@map.bitmap = Bitmap.new(map_width, map_height)

@map.z = 9005

@event = Sprite.new

@event.bitmap = Bitmap.new(map_width, map_height)

@event.z = 9010

self.back_opacity = 180

self.opacity = 180

case corner

when 1

self.x = 16

self.y = 16

when 2

self.x = 640 - width - 16

self.y = 16

when 3

self.x = 16

self.y = 480 - height - 16

when 4

self.x = 640 - width - 16

self.y = 480 - height - 16

else

self.x = 16

self.y = 16

end

end

#--------------------------------------------------------------------------

# ? display_map?

#--------------------------------------------------------------------------

def no_map_display?

for event in $game_map.events.values

if event.name.include?("[no map]")# EDIT TO = IF POOF JINN IS NOT IN PARTY

return true

end

end

return false

end

#--------------------------------------------------------------------------

# ? display_map?

#--------------------------------------------------------------------------

def no_event_display?

for event in $game_map.events.values

if event.name.include?("[no event]")# EDIT TO = IF POOF JINN IS NOT IN PARTY 

return true

end

end

return false

end

#--------------------------------------------------------------------------

# ? display_map?

#--------------------------------------------------------------------------

def no_display?

for event in $game_map.events.values

if event.name.include?("[no map]") and event.name.include?("[no event]")# EDIT TO = IF POOF JINN IS NOT IN PARTY

return true

end

end

return false

end

#--------------------------------------------------------------------------

# ? dispose

#--------------------------------------------------------------------------

def dispose

@bg.dispose

@map.bitmap.dispose

@map.dispose

@event.bitmap.dispose

@event.dispose

end

#--------------------------------------------------------------------------

# ? map

#--------------------------------------------------------------------------

def map

return @map

end

#--------------------------------------------------------------------------

# ? event

#--------------------------------------------------------------------------

def event

return @event

end

#--------------------------------------------------------------------------

# ? width

#--------------------------------------------------------------------------

def width

return 128

end

#--------------------------------------------------------------------------

# ? opacity=

#--------------------------------------------------------------------------

def height

return 96

end

#--------------------------------------------------------------------------

# ? opacity=

#--------------------------------------------------------------------------

def visible=(bool)

@bg.visible = bool

@event.visible = bool

@map.visible = bool

end

#--------------------------------------------------------------------------

# ? opacity

#--------------------------------------------------------------------------

def visible

return @bg.visible

end

#--------------------------------------------------------------------------

# ? opacity=

#--------------------------------------------------------------------------

def opacity=(opacity)

@event.opacity = opacity

@map.opacity = opacity

end

#--------------------------------------------------------------------------

# ? opacity

#--------------------------------------------------------------------------

def opacity

return @event.opacity

end

#--------------------------------------------------------------------------

# ? back_opacity=

#--------------------------------------------------------------------------

def back_opacity=(opacity)

@bg.opacity = opacity

@bg.contents_opacity = opacity if @bg.contents != nil

end

#--------------------------------------------------------------------------

# ? back_opacity

#--------------------------------------------------------------------------

def back_opacity

return @bg.opacity

end

#--------------------------------------------------------------------------

# ? x=

#--------------------------------------------------------------------------

def x=(x)

@bg.x = x - (@bg.width - 128) / 2

@event.x = x + 8

@map.x = x + 8

end

#--------------------------------------------------------------------------

# ? x

#--------------------------------------------------------------------------

def x

return @bg.x

end

#--------------------------------------------------------------------------

# ? y=

#--------------------------------------------------------------------------

def y=(y)

@bg.y = y - (@bg.height - 96) / 2

@event.y = y + 8

@map.y = y + 8

end

#--------------------------------------------------------------------------

# ? y

#--------------------------------------------------------------------------

def y

return @bg.y

end

#--------------------------------------------------------------------------

# ? map_width

#--------------------------------------------------------------------------

def map_width

return $game_map.width * 112/20

end

#--------------------------------------------------------------------------

# ? map_height

#--------------------------------------------------------------------------

def map_height

return $game_map.height * 80/15

end

#--------------------------------------------------------------------------

# ? display_x

#--------------------------------------------------------------------------

def display_x

return $game_map.display_x / 128 * 112/20

end

#--------------------------------------------------------------------------

# ? map_height

#--------------------------------------------------------------------------

def display_y

return $game_map.display_y / 128 * 80/15

end

end

#==============================================================================

# ¦ Map_Mini

#------------------------------------------------------------------------------

#  Base class for mini maps

#

# made by squall // [email=squall@loeher.zzn.com]squall@loeher.zzn.com[/email]

#==============================================================================

 

class Map_Mini < Map_Base

#--------------------------------------------------------------------------

# ? initialize

#--------------------------------------------------------------------------

def initialize(corner, use_windowskin)

super(corner, use_windowskin)

unless no_map_display?# THIS WILL NOT DISPLAY MAP

draw_map

end

end

#--------------------------------------------------------------------------

# ? update

#--------------------------------------------------------------------------

def update

map.src_rect.set(display_x, display_y, width - 16, height - 16)

if @tileset_name != $game_map.tileset_name

@tileset_name = $game_map.tileset_name

unless no_map_display?# THIS WILL NOT DISPLAY MAP

map.bitmap.clear

draw_map

end

end

end

#--------------------------------------------------------------------------

# ? draw_map

#--------------------------------------------------------------------------

def draw_map

bitmap = Bitmap.new($game_map.width * 32, $game_map.height * 32)

for i in 0...($game_map.width * $game_map.height)

x = i % $game_map.width

y = i / $game_map.width

for level in 0...3

tile_id = $game_map.data[x, y, level]

if tile_id >= 384

tileset_bitmap = RPG::Cache.tile($game_map.tileset_name, tile_id, 0)

src_rect = Rect.new(0, 0, 32, 32)

bitmap.blt(x * 32, y * 32, tileset_bitmap, src_rect)

end

if tile_id >= 48 and tile_id < 384

id = tile_id / 48 - 1

tileset_bitmap = RPG::Cache.autotile($game_map.autotile_names[id])

src_rect = Rect.new(32, 64, 32, 32)

bitmap.blt(x * 32, y * 32, tileset_bitmap, src_rect)

end

end

end

d_rect = Rect.new(0, 0, map_width, map_height)

s_rect = Rect.new(0, 0, bitmap.width, bitmap.height)

map.bitmap.stretch_blt(d_rect, bitmap, s_rect)

bitmap.clear

bitmap.dispose

end

end

#==============================================================================

# ¦ Map_Event

#------------------------------------------------------------------------------

#  draw the events and hero position

#==============================================================================

 

class Map_Event < Map_Mini

#--------------------------------------------------------------------------

# ? initialize

#--------------------------------------------------------------------------

def initialize(corner = 1, windowskin = true)

super(corner, windowskin)

@dots = []

end

#--------------------------------------------------------------------------

# ? refresh_dots

#--------------------------------------------------------------------------

def refresh_event_dots

for event in $game_map.events.values

bitmap = nil

x = event.x * map_width / $game_map.width

y = event.y * map_height / $game_map.height

next if event.list == nil

for i in 0...event.list.size

if event.list[i].parameters[0].is_a?(String)

if event.list[i].parameters[0] == "event"

bitmap = RPG::Cache.picture(event.list[i].parameters[0])

break

elsif event.list[i].parameters[0] == "enemy"

bitmap = RPG::Cache.picture(event.list[i].parameters[0])

break

elsif event.list[i].parameters[0].include?("teleport")

bitmap = RPG::Cache.picture("teleport")

break

elsif event.list[i].parameters[0] == "chest"

bitmap = RPG::Cache.picture(event.list[i].parameters[0])

break

elsif event.list[i].parameters[0] == "npc"

bitmap = RPG::Cache.picture(event.list[i].parameters[0])

break

elsif event.list[i].parameters[0] == "savepoint"

bitmap = RPG::Cache.picture(event.list[i].parameters[0])

break

else

bitmap = nil

end

end

end

@dots.push([x, y, bitmap])

end

end

#--------------------------------------------------------------------------

# ? refresh_dots

#--------------------------------------------------------------------------

def refresh_player_dot

x = $game_player.x * map_width / $game_map.width

y = $game_player.y * map_height / $game_map.height

bitmap = RPG::Cache.picture("hero")

@dots.push([x, y, bitmap])

end

#--------------------------------------------------------------------------

# ? update

#--------------------------------------------------------------------------

def update

super

@dots.clear

event.bitmap.clear

refresh_event_dots unless no_event_display?

refresh_player_dot unless no_display?

for dot in @dots

unless dot[2] == nil

event.bitmap.blt(dot[0], dot[1], dot[2], Rect.new(0, 0, 4, 4))

end

end

event.src_rect.set(display_x, display_y, width - 16, height - 16)

end

end

#==============================================================================

# ¦ Map_Full

#------------------------------------------------------------------------------

# made by squall // [email=squall@loeher.zzn.com]squall@loeher.zzn.com[/email]

#==============================================================================

 

class Map_Full

#--------------------------------------------------------------------------

# ? Initialize

#--------------------------------------------------------------------------

def initialize

@dots = []

@teleport_sprites = []

if $game_map.width > $game_map.height

@map_width = 640

@map_height = $game_map.height * @map_width / $game_map.width

if @map_height > 480

@map_height = 480

end

else

@map_height = 480

@map_width = $game_map.width * @map_height / $game_map.height

if @map_width > 640

@map_width = 640

end

end

@map = Sprite.new

@event = Sprite.new

@map.bitmap = Bitmap.new(width, height)

@event.bitmap = Bitmap.new(width, height)

@map.x = @event.x = 320 - width / 2

@map.y = @event.y = 240 - height / 2

draw_map unless no_map_display?

draw_event_dots unless no_event_display?

draw_player_dot unless no_display?

if no_display?

@message = Window_Base.new(0, 208, 640, 64)

message = "Only a Jinn can grant you this vision"#WHAT WILL DISPLAY WHEN NO MAP

@message.contents = Bitmap.new(608, 32)

@message.contents.font.name = $fontface

@message.contents.font.size = 32

@message.contents.font.color.set(255, 255, 255, 100)

@message.contents.draw_text(-1, -1, 608, 32, message, 1)

@message.contents.draw_text(-1, 1, 608, 32, message, 1)

@message.contents.draw_text(1, -1, 608, 32, message, 1)

@message.contents.draw_text(1, 1, 608, 32, message, 1)

@message.contents.font.color.set(255, 255, 255, 50)

@message.contents.draw_text(-2, -2, 608, 32, message, 1)

@message.contents.draw_text(-2, 2, 608, 32, message, 1)

@message.contents.draw_text(2, -2, 608, 32, message, 1)

@message.contents.draw_text(2, 2, 608, 32, message, 1)

@message.contents.font.color.set(255, 255, 255)

@message.contents.draw_text(0, 0, 608, 32, message, 1)

@message.windowskin = nil

end

end

#--------------------------------------------------------------------------

# ? display_map?

#--------------------------------------------------------------------------

def no_map_display?

for event in $game_map.events.values

if event.name.include?("[full]") 

return false

end

if event.name.include?("[no map]")  

return true

end

end

return false

end

#--------------------------------------------------------------------------

# ? display_map?

#--------------------------------------------------------------------------

def no_event_display?

for event in $game_map.events.values

if event.name.include?("[full]")  

return false

end

if event.name.include?("[no event]")  

return true

end

end

return false

end

#--------------------------------------------------------------------------

# ? display_map?

#--------------------------------------------------------------------------

def no_display?

for event in $game_map.events.values

if event.name.include?("[full]")  

return false

end

if event.name.include?("[no map]") and event.name.include?("[no event]")

return true

end

end

return false

end

#--------------------------------------------------------------------------

# ? dispose

#--------------------------------------------------------------------------

def dispose

for sprite in @teleport_sprites

sprite.dispose

end

@message.dispose if no_display?

@map.bitmap.dispose

@map.dispose

@event.bitmap.dispose

@event.dispose

end

#--------------------------------------------------------------------------

# ? width

#--------------------------------------------------------------------------

def width

return @map_width

end

#--------------------------------------------------------------------------

# ? opacity=

#--------------------------------------------------------------------------

def height

return @map_height

end

#--------------------------------------------------------------------------

# ? draw_map

#--------------------------------------------------------------------------

def draw_map

bitmap = Bitmap.new($game_map.width * 32, $game_map.height * 32)

for i in 0...($game_map.width * $game_map.height)

x = i % $game_map.width

y = i / $game_map.width

for level in 0...3

tile_id = $game_map.data[x, y, level]

if tile_id >= 384

tileset_bitmap = RPG::Cache.tile($game_map.tileset_name, tile_id, 0)

src_rect = Rect.new(0, 0, 32, 32)

bitmap.blt(x * 32, y * 32, tileset_bitmap, src_rect)

end

if tile_id >= 48 and tile_id < 384

id = tile_id / 48 - 1

tileset_bitmap = RPG::Cache.autotile($game_map.autotile_names[id])

src_rect = Rect.new(32, 64, 32, 32)

bitmap.blt(x * 32, y * 32, tileset_bitmap, src_rect)

end

end

end

d_rect = Rect.new(0, 0, width, height)

s_rect = Rect.new(0, 0, bitmap.width, bitmap.height)

@map.bitmap.stretch_blt(d_rect, bitmap, s_rect)

bitmap.clear

bitmap.dispose

end

#--------------------------------------------------------------------------

# ? refresh_dots

#--------------------------------------------------------------------------

def draw_event_dots

for event in $game_map.events.values

bitmap = nil

x = event.x * width / $game_map.width

y = event.y * height / $game_map.height

next if event.list == nil

for i in 0...event.list.size

if event.list[i].parameters[0].is_a?(String)

if event.list[i].parameters[0] == "event"

bitmap = RPG::Cache.picture(event.list[i].parameters[0])

break

elsif event.list[i].parameters[0] == "enemy"

bitmap = RPG::Cache.picture(event.list[i].parameters[0])

break

elsif event.list[i].parameters[0].include?("teleport")

bitmap = RPG::Cache.picture("teleport")

name = event.list[i].parameters[0].dup

name.slice!("teleport, ")

@teleport_sprites.push(new_name_sprite(name, x, y))

break

elsif event.list[i].parameters[0] == "chest"

bitmap = RPG::Cache.picture(event.list[i].parameters[0])

break

elsif event.list[i].parameters[0] == "npc"

bitmap = RPG::Cache.picture(event.list[i].parameters[0])

break

elsif event.list[i].parameters[0] == "savepoint"

bitmap = RPG::Cache.picture(event.list[i].parameters[0])

break

else

bitmap = nil

end

end

end

@dots.push([x, y, bitmap])

end

for dot in @dots

unless dot[2] == nil

@event.bitmap.blt(dot[0], dot[1], dot[2], Rect.new(0, 0, 4, 4))

end

end

end

#--------------------------------------------------------------------------

# ? new_name_sprite

#--------------------------------------------------------------------------

def new_name_sprite(name, x, y)

sprite = Sprite.new

sprite.y = y + 240 - height / 2

x + 128 > 640 ? sprite.x = 512 : sprite.x = x + 320 - width / 2

bitmap = Bitmap.new(128, 32)

bitmap.font.name, bitmap.font.size = $fontface, 20

bitmap.font.color.set(255, 255, 255)

bitmap.draw_text(0, 0, 128, 32, name)

sprite.bitmap = bitmap

return sprite

end

#--------------------------------------------------------------------------

# ? refresh_dots

#--------------------------------------------------------------------------

def draw_player_dot

x = $game_player.x * width / $game_map.width

y = $game_player.y * height / $game_map.height

bitmap = RPG::Cache.picture("hero")

@event.bitmap.blt(x, y, bitmap, Rect.new(0, 0, 4, 4))

end

end

 

#==============================================================================

# ¦ Scene_MiniMap

#------------------------------------------------------------------------------

#  draw the map full screen

#==============================================================================

 

class Scene_MiniMap

#--------------------------------------------------------------------------

# ? main

#--------------------------------------------------------------------------

def main

@map = Map_Full.new

Graphics.transition

loop do

Graphics.update

Input.update

update

if $scene != self

break

end

end

Graphics.freeze

@map.dispose

end

#--------------------------------------------------------------------------

# ? Update the contents of all five windows on the main menu

#--------------------------------------------------------------------------

def update

if Input.trigger?(Input::X) and Input.trigger?(Input::A)#to view entire map

$game_system.se_play($data_system.cancel_se)

$scene = Scene_Map.new

return

end

end

end

 

#==============================================================================

# ¦ 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

#

# @use_windowskin is whether true or false. true if you want to use the

# the current windowskin for the minimap background.

# or false if you want to use the picture named mapback in your picture folder.

#==============================================================================

 

class Scene_Map

alias main_minimap main

alias update_minimap update

alias transfer_minimap transfer_player

#--------------------------------------------------------------------------

# ? initialize

#--------------------------------------------------------------------------

def initialize

@corner = 4 # 1 or 2 or 3 or 4

@use_windowskin = false # true or false

end

#--------------------------------------------------------------------------

# ? main

#--------------------------------------------------------------------------

def main

@event_map = Map_Event.new(@corner, @use_windowskin)

main_minimap

@event_map.dispose

end

#--------------------------------------------------------------------------

# ? update

#--------------------------------------------------------------------------

def update

@event_map.update

if $game_system.map_interpreter.running?

@event_map.visible = false

else

@event_map.visible = true

end

if Input.trigger?(Input::X) and Input.trigger?(Input::A)#to exit entire map!

$game_system.se_play($data_system.decision_se)

$scene = Scene_MiniMap.new

return

end

update_minimap

end

#--------------------------------------------------------------------------

# ? transfer_player

#--------------------------------------------------------------------------

def transfer_player

transfer_minimap

@event_map.dispose

@event_map = Map_Event.new(@corner, @use_windowskin)

end

end

the second one is the passability minimap.
Code:
OnButton = Input::A # edit button to toggle minimap on/off.

 

class Scene_Map

  alias main_passminimap main

  alias update_passminimap update

  alias transfer_passminimap transfer_player

  #-------

  alias main_minimap main

  alias update_minimap update

  alias transfer_minimap transfer_player

  #--------------------------------------------------------------------------

  # โ—� initialize

  #--------------------------------------------------------------------------

  def initialize

    @corner = 4 # 1 or 2 or 3 or 4

  end

  

  #--------------------------------------------------------------------------

  # โ—� main

  #--------------------------------------------------------------------------

  def main

    @mini_map = Map_Event.new(@corner)

    main_passminimap

    @mini_map.dispose

  end

  #--------------------------------------------------------------------------

  # โ—� update

  #--------------------------------------------------------------------------

  def update

    @mini_map.update

    if $game_system.map_interpreter.running?

      @mini_map.visible = false

    elsif not $game_system.map_interpreter.running? and @mini_map.on?

      @mini_map.visible = true

    end

    update_passminimap

  end

  #--------------------------------------------------------------------------

  # โ—� transfer_player

  #--------------------------------------------------------------------------

  def transfer_player

    transfer_passminimap

    @mini_map.dispose

    @mini_map = Map_Event.new(@corner)

  end

end

 

#==============================================================================

# โ–  Map_Base

#------------------------------------------------------------------------------

# ใ€€Base class for mini maps

#==============================================================================

 

class Map_Base < Sprite

  #--------------------------------------------------------------------------

  # โ—� constants and instances

  #--------------------------------------------------------------------------

  PMP_VERSION  = 6

  ACTIVATED_ID = 1 # set the switch id for the minimap display (on/off)

  attr_reader :event

  #--------------------------------------------------------------------------

  # โ—� initialize

  #--------------------------------------------------------------------------

  def initialize(corner)

    super(Viewport.new(16, 16, width, height))

    viewport.z = 8000

    @border = Sprite.new

    @border.x = viewport.rect.x - 6

    @border.y = viewport.rect.y - 6

    @border.z = viewport.z - 1

    @border.bitmap = RPG::Cache.picture("minimapback")

    self.visible = on?

    self.opacity = 180

    case corner

    when 1

      self.x = 16

      self.y = 16

    when 2

      self.x = 640 - width - 16

      self.y = 16

    when 3

      self.x = 16

      self.y = 480 - height - 16

    when 4

      self.x = 640 - width - 16

      self.y = 480 - height - 16

    else

      self.x = 16

      self.y = 16

    end

    self.visible = on?

  end

  #--------------------------------------------------------------------------

  # โ—� dispose

  #--------------------------------------------------------------------------

  def dispose

    @border.dispose

    super

  end

  #--------------------------------------------------------------------------

  # โ—� x=

  #--------------------------------------------------------------------------

  def x=(x)

    self.viewport.rect.x = x

    @border.x = x - 6

  end

  #--------------------------------------------------------------------------

  # โ—� y=

  #--------------------------------------------------------------------------

  def y=(y)

    self.viewport.rect.y = y

    @border.y = y - 6

  end

  #--------------------------------------------------------------------------

  # โ—� visible=

  #--------------------------------------------------------------------------

  def visible=(bool)

    super

    self.viewport.visible = bool

    @border.visible = bool

  end

  #--------------------------------------------------------------------------

  # โ—� minimap_on?

  #--------------------------------------------------------------------------

  def on?

     return true if @on == true and !$game_temp.message_window_showing

     return false

end

  #--------------------------------------------------------------------------

  # โ—� update

  #--------------------------------------------------------------------------

  def update

    super

    if @on and Input.trigger?(OnButton)

      @on = false

    elsif !@on and Input.trigger?(OnButton)

      @on = true

    end

      self.visible = on?

    if viewport.ox < display_x

      viewport.ox += 1

    elsif viewport.ox > display_x

      viewport.ox -= 1

    end

    if viewport.oy < display_y

      viewport.oy += 1

    elsif viewport.oy > display_y

      viewport.oy -= 1

    end

  end

  #--------------------------------------------------------------------------

  # โ—� width

  #--------------------------------------------------------------------------

  def width

    return 120

  end

  #--------------------------------------------------------------------------

  # โ—� height

  #--------------------------------------------------------------------------

  def height

    return 90

  end

  #--------------------------------------------------------------------------

  # โ—� display_x

  #--------------------------------------------------------------------------

  def display_x

    return $game_map.display_x * 3 / 64

  end

  #--------------------------------------------------------------------------

  # โ—� display_y

  #--------------------------------------------------------------------------

  def display_y

    return $game_map.display_y * 3 / 64

  end

end

 

#==============================================================================

# โ–  Map_Passability

#------------------------------------------------------------------------------

#   draws the mini map

#==============================================================================

 

class Map_Passability < Map_Base

  #--------------------------------------------------------------------------

  # โ—� constants

  #--------------------------------------------------------------------------

  INDEX  =

  [

  26, 27, 32, 33,    4, 27, 32, 33,   26,  5, 32, 33,    4,  5, 32, 33,    

  26, 27, 32, 11,    4, 27, 32, 11,   26,  5, 32, 11,    4,  5, 32, 11,    

  26, 27, 10, 33,    4, 27, 10, 33,   26,  5, 10, 33,    4,  5, 10, 33,

  26, 27, 10, 11,    4, 27, 10, 11,   26,  5, 10, 11,    4,  5, 10, 11,  

  24, 25, 30, 31,   24,  5, 30, 31,   24, 25, 30, 11,   24,  5, 30, 11,  

  14, 15, 20, 21,   14, 15, 20, 11,   14, 15, 10, 21,   14, 15, 10, 11,

  28, 29, 34, 35,   28, 29, 10, 35,    4, 29, 34, 35,    4, 29, 10, 35,

  38, 39, 44, 45,    4, 39, 44, 45,   38,  5, 44, 45,    4,  5, 44, 45,

  24, 29, 30, 35,   14, 15, 44, 45,   12, 13, 18, 19,   12, 13, 18, 11,

  16, 17, 22, 23,   16, 17, 10, 23,   40, 41, 46, 47,    4, 41, 46, 47,

  36, 37, 42, 43,   36,  5, 42, 43,   12, 17, 18, 23,   12, 13, 42, 43,

  36, 41, 42, 47,   16, 17, 46, 47,   12, 17, 42, 47,    0,  1,  6,  7

  ]

  X = [0, 1, 0, 1]

  Y = [0, 0, 1, 1]

  #--------------------------------------------------------------------------

  # โ—� initialize

  #--------------------------------------------------------------------------

  def initialize(corner)

    super(corner)

    @autotile = RPG::Cache.picture("minimap_tiles")

    setup()

  end

  #--------------------------------------------------------------------------

  # โ—� setup

  #--------------------------------------------------------------------------

  def setup()

    @map = load_data(sprintf("Data/Map%03d.rxdata", $game_map.map_id))

    tileset = $data_tilesets[@map.tileset_id]

    @passages = tileset.passages

    @priorities = tileset.priorities

    redefine_tiles

    refresh

  end

  #--------------------------------------------------------------------------

  # โ—� pass

  #--------------------------------------------------------------------------

  def pass(tile_id)

    return 15 if tile_id == nil

    return @passages[tile_id] != nil ? @passages[tile_id] : 15

  end

  #--------------------------------------------------------------------------

  # โ—� passable

  #--------------------------------------------------------------------------

  def passable(tile_id)

    return pass(tile_id) < 15

    return 0 if @passages[tile_id] & 0x40 == 0x40#insert

  end

  #--------------------------------------------------------------------------

  # โ—� redefine_tile

  #--------------------------------------------------------------------------

  def redefine_tiles

    width = @map.width

    height = @map.height

    map = RPG::Map.new(width, height)

    map.data = @map.data.dup

    for x in 0...width

      for y in 0...height

        for level in [1, 2]

          id = @map.data[x, y, level]

          if id != 0 and @priorities[id] == 0

            @map.data[x, y, 0] = id

            @passages[@map.data[x, y, 0]] = @passages[id]

          end

        end

      end

    end

    for x in 0...width

      for y in 0...height

        for level in [0]

        tile = @map.data[x, y, level]

        u = @map.data[x,   y-1, level]

        l = @map.data[x-1, y,   level]

        r = @map.data[x+1, y,   level]

        d = @map.data[x,   y+1, level]

        if !passable(tile)

          map.data[x, y] = 0

        else

          if tile == 0

            map.data[x, y, level] = 0

            next

          end

          if pass(tile) < 15

            if !passable(u) and !passable(l) and !passable(r) and !passable(d)

              map.data[x, y, level] = 0

            elsif !passable(u) and !passable(l) and !passable(r) and passable(d)

              map.data[x, y, level] = 90

            elsif !passable(u) and !passable(l) and !passable(d) and passable(r)

              map.data[x, y, level] = 91

            elsif !passable(u) and !passable(r) and !passable(d) and passable(l)

              map.data[x, y, level] = 93

            elsif !passable(l) and !passable(r) and !passable(d) and passable(u)

              map.data[x, y, level] = 92

            elsif !passable(u) and !passable(d) and passable(r) and passable(l)

              map.data[x, y, level] = 81

            elsif !passable(u) and !passable(r) and passable(d) and passable(l)

              map.data[x, y, level] = 84

            elsif !passable(u) and !passable(l) and passable(d) and passable(r)

              map.data[x, y, level] = 82

            elsif !passable(d) and !passable(r) and passable(l) and passable(u)

              map.data[x, y, level] = 86

            elsif !passable(d) and !passable(l) and passable(r) and passable(u)

              map.data[x, y, level] = 88

            elsif !passable(r) and !passable(l) and passable(d) and passable(u)

              map.data[x, y, level] = 80

            elsif !passable(u) and passable(d) and passable(r) and passable(l)

              map.data[x, y, level] = 68

            elsif !passable(d) and passable(u) and passable(r) and passable(l)

              map.data[x, y, level] = 76

            elsif !passable(r) and passable(d) and passable(u) and passable(l)

              map.data[x, y, level] = 72

            elsif !passable(l) and passable(d) and passable(u) and passable(r)

              map.data[x, y, level] = 64

            else

              map.data[x, y, level] = 48

            end

          else

            map.data[x, y, level] = 0

          end

        end

        end

      end

    end

    @map = map.dup

    map = nil

  end

  #--------------------------------------------------------------------------

  # โ—� refresh

  #--------------------------------------------------------------------------

  def refresh

    self.visible = false

    self.bitmap = Bitmap.new(@map.width * 6, @map.height * 6)

    bitmap = Bitmap.new(@map.width * 6, @map.height * 6)

    rect1 = Rect.new(6, 0, 6, 6)

    for y in [email=0...@map.height]0...@map.height[/email]

      for x in [email=0...@map.width]0...@map.width[/email]

        for level in [0]

          tile_id = @map.data[x, y, level]

          next if tile_id == 0

          id = tile_id / 48 - 1

          tile_id %= 48

          for g in 0..3

            h = 4 * tile_id + g

            y1 = INDEX[h] / 6

            x1 = INDEX[h] % 6

            rect2 = Rect.new(x1 * 3, y1 * 3, 3, 3)

            bitmap.blt(x * 6 + X[g] *  3, y * 6 + Y[g] * 3, @autotile, rect2)

          end

        end

      end

    end

    d_rect = Rect.new(0, 0, @map.width * 6, @map.height * 6)

    s_rect = Rect.new(0, 0, bitmap.width, bitmap.height)

    self.bitmap.stretch_blt(d_rect, bitmap, s_rect)

    self.viewport.ox = display_x

    self.viewport.oy = display_y

    bitmap.clear

    bitmap.dispose

  end

end

 

#==============================================================================

# โ–  Map_Event

#------------------------------------------------------------------------------

# ใ€€draw the events and hero position

#==============================================================================

 

class Map_Event < Map_Passability

  #--------------------------------------------------------------------------

  # โ—� initialize

  #--------------------------------------------------------------------------

  def initialize(corner = 4)# select to show minimap in corner of screen

    # 1 = top left / 2 = top right / 3 = bottom left / 4 = bottom right

    super(corner)

    @dots = []

    @player = Sprite.new(self.viewport)

    @player.bitmap = RPG::Cache.picture("mmcursors")#minimap graphic for player 

    @player.src_rect = Rect.new(0, 0, 15, 15)

    @player.z = self.z + 3

    @events = {}

 

    for key in $game_map.events.keys

      event = $game_map.events[key]

      next if event.list == nil

      for i in 0...event.list.size

        next if event.list[i].code != 108

        @events[key] = Sprite.new(self.viewport)

        @events[key].z = self.z + 2

           if event.list[i].parameters[0].include?("event")#add in comment

          @events[key].bitmap = RPG::Cache.picture("event")#to show graphic

        elsif event.list[i].parameters[0].include?("enemy")

          @events[key].bitmap = RPG::Cache.picture("enemy")

        elsif event.list[i].parameters[0].include?("miniboss")

          @events[key].bitmap = RPG::Cache.picture("miniboss")

        elsif event.list[i].parameters[0].include?("boss")

          @events[key].bitmap = RPG::Cache.picture("boss")

        elsif event.list[i].parameters[0].include?("hint")

          @events[key].bitmap = RPG::Cache.picture("hint")

        elsif event.list[i].parameters[0].include?("teleport")

          @events[key].bitmap = RPG::Cache.picture("teleport")

        elsif event.list[i].parameters[0].include?("chest")

          @events[key].bitmap = RPG::Cache.picture("chest")

        elsif event.list[i].parameters[0].include?("npc")

          @events[key].bitmap = RPG::Cache.picture("npc")

        elsif event.list[i].parameters[0].include?("savepoint")

          @events[key].bitmap = RPG::Cache.picture("savepoint")

        end

      end

    end

  end

  #--------------------------------------------------------------------------

  # โ—� dispose

  #--------------------------------------------------------------------------

  def dispose

    @player.dispose

    for event in @events.values

      event.dispose

    end

    super

  end

  #--------------------------------------------------------------------------

  # โ—� update

  #--------------------------------------------------------------------------

  def update

    super

    @player.x = $game_player.real_x * 3 / 64 - 5

    @player.y = $game_player.real_y * 3 / 64 - 4

    @player.src_rect.x = ($game_player.direction / 2 - 1) * 15

    for key in @events.keys

      event = @events[key]

      mapevent = $game_map.events[key]

      event.x = mapevent.real_x * 3 / 64

      event.y = mapevent.real_y * 3 / 64

    end

  end

end

SELWYN SQUALL gets credit for both of these scripts. I've done my share of googelin' for his answer...

Both of these scripts work very well and are easy to use... I need help in making them both work together.
anyone please advise, so I know how to make the proper edits...

~g/A\/\/\|E|F/A\(C|=
 
poeman":3msb528e said:
I don't know why you credit yourself when all you did was ask for help.

@poeman - ouch! please read the post poeman! my request is to have these two scripts work together.
the only credit I can have is the button configuration... but I'm not asking for credit, I'm requesting assistance.

seriously, if your going to post anyone's work with out mentioning any adjustments you have made...
then you misrepresent the original author of the script.

my intentions are to get this fusion working, and share with the rest of the us.
so thanks for your response, though you offer no support, it's still a response. ~g


BUMP!

gameface101":3msb528e said:
Script Request Template
Trying to get these two scripts to work together..........................~?


SELWYN SQUALL gets credit for both of these scripts. I've done my share of googelin' for his answer...

Both of these scripts work very well and are easy to use... I need help in making them both work together.
anyone please advise, so I know how to make the proper edits...

~g/A\/\/\|E|F/A\(C|=
 
^ _^
\___/ ~ a response!

How would I program a "two button" trigger to toggle the mini-map to full screen and back to regular?
@huntercpe - check the first script... line 621

I still need help with...

TWO SCRIPTS:

passmap script - one button to turn off/on

minimap script - one button to turn off/on and two buttons for full screen mode on/off

TWO BUTTONS:

X - disables/enables the pass-ability map
Code:
if Input.trigger?(Input::X)#passmap
A - disables/enables the mini-map
Code:
if Input.trigger?(Input::A)#minimap
BUTTON X + BUTTON A = disables/enables the full screen map
Code:
if Input.trigger?(Input::X) and Input.trigger?(Input::A)#full screen map!

need help with the compatibility between the two scripts...
to have them working simultaneously and to have an ON/OFF switch for the mini-map ~(G
 

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