Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: Exiled_by_choise on April 05, 2009, 02:21:16 am

Title: Blizz ABS
Post by: Exiled_by_choise on April 05, 2009, 02:21:16 am
Hi is there any way to use the minimap that comes with Blizz ABS seperatly without using Blizz ABS.
Title: Re: Blizz ABS
Post by: Reno-s--Joker on April 05, 2009, 03:23:54 am
I'm just going to assume it's the same one as the one in Tons, link here: Tons of Addons (http://forum.chaos-project.com/index.php?topic=105.0)
Then it's just a simple matter of finding which part of the code it is and extracting that - although I recommend you keep Tons together. If you're having trouble doing this I can extract it for you tomorrow.

Hope it helped, and I wasn't deeply mistaken. D:
Title: Re: Blizz ABS
Post by: Blizzard on April 05, 2009, 07:13:33 am
Yes and no. The minimap in Blizz-ABS is more advanced than the one in Tons of Add-ons. I never find the time to update it.
Title: Re: Blizz ABS
Post by: Exiled_by_choise on April 09, 2009, 04:05:44 am
Can you for all of the people who want the Blizz ABS minimap but not the Blizz ABS itself.  :)
Title: Re: Blizz ABS
Post by: Blizzard on April 09, 2009, 04:38:35 am
As I said...

Quote from: Doris on April 05, 2009, 07:13:33 am
I never find the time to update it.


Tons of Add-on's minimap is basially working the same as Blizz-ABS's minimap does. The only difference is that it's not as pretty.
Title: Re: Blizz ABS
Post by: Exiled_by_choise on April 11, 2009, 03:28:14 am
Ok, i get that, so is there anyone who would edit the Tons minimap because i kinda don't know how it works.
Title: Re: Blizz ABS
Post by: Reno-s--Joker on April 11, 2009, 07:12:39 am
Here's the one from Tons:
Code: ShowHide
#==============================================================================
# Game_System
# You probably need this section for compatibility with other scripts made by
# Blizzard.
#==============================================================================

class Game_System
 
  alias init_minimap_from_tons2 initialize
  def initialize
    init_minimap_from_tons2
    @QUICK_PASSABILITY_TEST = true
    @MINIMAP                = true
  end
 
  attr_accessor :QUICK_PASSABILITY_TEST
  attr_accessor :MINIMAP
 
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Quick Passability Test by Blizzard
# Version: 1.0b
# Type: Debug Utility
# Date: 7.2.2007
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Important:
#
#   This add-ons ONLY works in Debug mode/Testplay mode and is mainly
#   considered for debugging maps faster.
#
#
# Instructions:
#
#   This will put a mask on your map that shows the passability. Trigger on/off
#   the mask by pressing F6. You can define the color the passable part should
#   have by changing the TILE_COLOR constant. Use this template:
#
#   TILE_COLOR = Color.new(R, G, B, A)
#
#   R - red
#   G - green
#   B - blue
#   A - alpha (opacity)
#
#   Every value needs to be set to a number between 0~255. Alpha over 128 is
#   not recommended. This will only work with the map, events are not
#   considered. This add-on will not work if the map's width * maps's height is
#   bigger than 19200, because the sprite would take up too much RAM and your
#   operating system would freeze and crash the game.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

TILE_COLOR = Color.new(255, 64, 0, 96)

#==============================================================================
# Game_Map
#==============================================================================

$quick_pass = true

class Game_Map
 
  attr_reader :passables
 
  alias setup_minimap_later setup
  def setup(map_id)
    setup_minimap_later(map_id)
    setup_passability_net(true)
  end
 
  def setup_passability_net(force_flag = false)
    if @passables == nil || @passables == [] || force_flag
      @passables = []
      s1 = $game_system.minimap_w / $game_map.width
      s2 = $game_system.minimap_h / $game_map.height
      if $DEBUG && $game_system.QUICK_PASSABILITY_TEST &&
          width * height <= 19200 || $game_system.MINIMAP && s1 != 0 && s2 != 0
        (0...$game_map.height).each {|i|
            Graphics.update if $game_map.width * $game_map.height >= 19200
            (0...$game_map.width).each {|j|
                if $game_map.virtual_passable?(j, i, 2) ||
                   $game_map.virtual_passable?(j, i, 4) ||
                   $game_map.virtual_passable?(j, i, 6) ||
                   $game_map.virtual_passable?(j, i, 8)
                  @passables.push([j, i])
                end}}
      end
    end
  end
 
  def virtual_passable?(x, y, d)
    return false unless valid?(x, y)
    bit = (1 << (d / 2 - 1)) & 0x0f
    [2, 1, 0].each {|i|
        if data[x, y, i] == nil then return false
        elsif @passages[data[x, y, i]] & bit != 0 then return false
        elsif @passages[data[x, y, i]] & 0x0f == 0x0f then return false
        elsif @priorities[data[x, y, i]] == 0 then return true
        end}
    return true
  end
 
end

#==============================================================================
# Scene_Map
#==============================================================================

class Scene_Map
 
  alias main_quick_passability_later main
  def main
    main_quick_passability_later
    @passable.dispose if @passable != nil
  end
 
  alias upd_quick_passability_later update
  def update
    upd_quick_passability_later
    if $DEBUG && $game_system.QUICK_PASSABILITY_TEST
      if @passable != nil
        if Input.trigger?(Input::F6)
          @passable.dispose
          @passable = nil
        else
          @passable.x = -$game_map.display_x/4
          @passable.y = -$game_map.display_y/4
        end
      elsif Input.trigger?(Input::F6)
        @passable = create_passable_help
        unless @passable == nil
          @passable.x = -$game_map.display_x/4
          @passable.y = -$game_map.display_y/4
        end
      end
    end
  end
 
  def create_passable_help
    coos = $game_map.passables
    if coos != [] && $game_map.width * $game_map.height <= 19200
      passable = RPG::Sprite.new
      passable.bitmap = Bitmap.new($game_map.width*32, $game_map.height*32)
      coos.each_index {|i|
          passable.bitmap.fill_rect(coos[i][0]*32, coos[i][1]*32, 32, 32, TILE_COLOR)}
      passable.z = 10000
      return passable
    end
  end
 
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Dynamic Passability Minimap by Blizzard
# Version: 1.01b
# Type: Game Playability Improvement
# Date: 7.2.2007
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Compatibility:
#
#   95% compatible with SDK v1.x. 60% compatible with SDK v2.x. This add-on
#   NEEDS "Quick Passability Test" by Blizzard. WILL corrupt your old
#   savegames. Might not work with special map add-ons. Does NOT work with
#   pixel-movement without changing the code.
#
#
# Why this minimap script better is than any other (aka features):
#
#   - simple display to avoid lag
#   - custom size, position and opacity, changeable even during the game
#   - no bitmaps, no pictures to import, only plain script
#
#
# Explanation:
#
#   This add-on will draw a real-time minimap on the specified X and Y
#   coordinate on your screen. It will show the player, events that do NOT have
#   a comment in their code that says "no_minimap", that are not parallel
#   process and that are not auto-start and that are not erased yet. Events
#   with a teleport/transfer player command will be shown in a different color.
#   Any event with and comment with "special" in their code will be also
#   displayed differently. Blizz-ABS disables this add-on automatically and
#   uses the more enhanced built-in Blizz-ABS Minimap.
#
#
# Instructions:
#
#   You can trigger the minimap visible/invisible with F5 during the game.
#   Set up the starting configuration below. The colors follow a template of:
#
#     WHAT_COLOR = Color.new(R, G, B)
#
#   R - red
#   G - green
#   B - blue
#
#   Change the colors of the dots on the map as you prefer it.
#
#   PLAYER_COLOR    - the player on the minimap
#   EVENT_COLOR     - any event on the minimap that is not erased, is not
#                     auto-start, is not parallel process and does not have a
#                     comment in its code with the word "no_minimap"
#   TELEPORT_COLOR  - any event like the one above, but that has a teleport/
#                     transfer_player command
#   SPECIAL_COLOR   - any event with a comment with the word "special"
#   MINIMAP_X       - default X of the minimap on the screen
#   MINIMAP_Y       - default Y of the minimap on the screen
#   MINIMAP_WIDTH   - default maximal allowed width of the minimap
#   MINIMAP_HEIGHT  - default maximal allowed height of the minimap
#   MINIMAP_OPACITY - default opacity of the minimap on the screen
#
#   You have the possibility to change the minimap's size, coordinates and
#   opacity during the game process. The command you need to type in into a
#   "Call Script" command window are:
#
#     $game_system.mini_coos(X, Y)
#     $game_system.mini_size(W, H)
#     $game_system.mini_opaq(A)
#
#   X - new X
#   Y - new Y
#   W - new width
#   H - new height
#   A - new opacity
#
#   Any changes will be applied instantly. Note that you don't need to use ALL
#   commands.
#
#
# Note:
#
#   Changing X, Y and opacity during the game will result in just moving the
#   sprite. The minimap will not work if the maximal allowed size is smaller
#   than the map size. (i.e. if your minimap is 160x120, maps like 170x130,
#   180x15 or 20x140 will not work.)
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Start Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

PLAYER_COLOR = Color.new(0, 255, 0)
EVENT_COLOR = Color.new(0, 128, 255)
TELEPORT_COLOR = Color.new(255, 255, 0)
SPECIAL_COLOR = Color.new(255, 0, 0)
MINIMAP_X = 0
MINIMAP_Y = 0
MINIMAP_WIDTH = 160
MINIMAP_HEIGHT = 160
MINIMAP_OPACITY = 160

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# End Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

if $quick_pass != true
  p 'Attention! Minimap is missing a vital add-on! Application will now close!'
  exit
end

#==============================================================================
# Game_System
#==============================================================================

class Game_System
 
  attr_reader   :minimap_x
  attr_reader   :minimap_y
  attr_reader   :minimap_w
  attr_reader   :minimap_h
  attr_reader   :minimap_a
  attr_accessor :minimap_visible
 
  alias init_minimap_later initialize
  def initialize
    init_minimap_later
    @minimap_visible = false
    @minimap_x = [[MINIMAP_X, 0].max, 640].min
    @minimap_y = [[MINIMAP_Y, 0].max, 480].min
    @minimap_w = [[MINIMAP_WIDTH, 0].max, 640].min
    @minimap_h = [[MINIMAP_HEIGHT, 0].max, 480].min
    @minimap_a = [[MINIMAP_OPACITY, 0].max, 255].min
  end
 
  def mini_coos(x, y)
    @minimap_x, @minimap_y = [[x, 0].max, 640].min, [[y, 0].max, 480].min
  end
 
  def mini_size(w, h)
    @minimap_w, @minimap_h = [[w, 0].max, 640].min, [[h, 0].max, 480].min
    $game_map.setup_passability_net
  end
 
  def mini_opaq(a)
    @minimap_a = [[a, 0].max, 255].min
  end
 
end

#==============================================================================
# Game_Event
#==============================================================================

class Game_Event
 
  attr_reader :erased
 
  def conditions
    @event.pages.reverse.each {|page|
        c = page.condition
        next if c.switch1_valid && !$game_switches[c.switch1_id]
        next if c.switch2_valid && !$game_switches[c.switch2_id]
        if c.variable_valid
          next if $game_variables[c.variable_id] < c.variable_value
        end
        if c.self_switch_valid
          key = [@map_id, @event.id, c.self_switch_ch]
          next if $game_self_switches[key] != true
        end
        return true}
    return false
  end
 
end
 
#==============================================================================
# Minimap
#==============================================================================

class Minimap < RPG::Sprite
 
  def initialize(viewport = nil)
    super
    self.z = 10100
    create_minimap
  end
 
  def create_minimap
    coos = $game_map.passables
    @w, @h = $game_system.minimap_w, $game_system.minimap_h
    s = [@w / $game_map.width, @h / $game_map.height]
    @size = (s[0] > s[1] ? s[1] : s[0])
    if @size > 0
      self.bitmap = Bitmap.new(@size*$game_map.width, @size*$game_map.height)
      self.bitmap.fill_rect(0, 0, @w, @h, Color.new(0, 0, 0))
      color = Color.new(128, 128, 128)
      coos.each {|coo|
          self.bitmap.fill_rect(coo[0]*@size, coo[1]*@size, @size, @size, color)}
      @events = get_events
      create_sevents
      update
    else
      self.dispose
    end
  end
 
  def update
    super
    ev = get_events
    if ev != @events
      @events = ev
      destroy_sevents
      create_sevents
    end
    self.x, self.y = $game_system.minimap_x, $game_system.minimap_y
    self.opacity = $game_system.minimap_a
    @sevents.each_index {|i|
        @sevents[i].x = @events[i].x * @size + self.x
        @sevents[i].y = @events[i].y * @size + self.y
        @sevents[i].opacity = $game_system.minimap_a}
    if @w != $game_system.minimap_w || @h != $game_system.minimap_h
      self.bitmap.dispose
      destroy_sevents
      create_minimap
    end
  end
 
  def create_sevents
    @sevents = []
    @events.each_index {|i|
        sprite = RPG::Sprite.new
        sprite.bitmap = Bitmap.new(@size, @size)
        if @events[i].is_a?(Game_Player)
          color = PLAYER_COLOR
        elsif event_comment(@events[i], 'special')
          color = SPECIAL_COLOR
        elsif @events[i].list != nil && @events[i].list.any? {|j| j.code == 201}
          color = TELEPORT_COLOR
        else
          color = EVENT_COLOR
        end
        sprite.bitmap.fill_rect(0, 0, @size, @size, color)
        sprite.z = 10200
        @sevents.push(sprite)}
  end
   
  def destroy_sevents
    @sevents.each {|i| i.dispose}
    @sevents = nil
  end
 
  def get_events
    events = [$game_player]
    $game_map.events.each_value {|event|
        if !event.erased && ![3, 4].include?(event.trigger) &&
            !event_comment(event, 'no_minimap') && event.conditions
          events.push(event)
        end}
    return events
  end
 
  def event_comment(event, comment)
    return false unless event.list.is_a?(Array)
    return (event.list.any? {|c| c.code == 108 && c.parameters[0] == comment})
  end
 
  def dispose
    destroy_sevents if @sevents != nil
    super
  end
 
end

#==============================================================================
# Scene_Map
#==============================================================================

class Scene_Map
 
  alias main_minimap_later main
  def main
    @minimap = Minimap.new if $game_system.minimap_visible
    main_minimap_later
    @minimap.dispose if @minimap != nil
  end
 
  alias upd_minimap_later update
  def update
    upd_minimap_later
    return if $BlizzABS && BlizzABS::VERSION >= 1.20
    if $game_system.MINIMAP
      if @minimap != nil
        if Input.trigger?(Input::F5)
          @minimap.dispose
          @minimap = nil
          $game_system.minimap_visible = false
        else
          @minimap.update
        end
      elsif Input.trigger?(Input::F5)
        @minimap = Minimap.new
        if @minimap.disposed?
          $game_system.minimap_visible = false
          @minimap = nil
        else
          $game_system.minimap_visible = true
        end
      end
    end
  end
 
  alias transfer_player_minimap_later transfer_player
  def transfer_player
    if $game_system.minimap_visible
      @minimap.dispose
      @minimap = nil
    end
    transfer_player_minimap_later
    @minimap = Minimap.new if $game_system.minimap_visible
    if @minimap != nil && @minimap.disposed?
      @minimap = nil
      $game_system.minimap_visible = false
    end
  end
 
end

Press F5 in game to toggle it.

Let me know if I've made any errors in copy-pasting. :)
Title: Re: Blizz ABS
Post by: Blizzard on April 13, 2009, 03:44:16 pm
:facepalm: I said that I'll do it when I find some time.
Title: Re: Blizz ABS
Post by: Exiled_by_choise on April 15, 2009, 03:35:45 am
Thanks Reno-s--Batman but i already have the Tons minimap but I want the Blizz ABS minimap it's much cooler. 8)
Title: Re: Blizz ABS
Post by: Exiled_by_choise on April 19, 2009, 10:02:03 pm
Hey Blizzard i've been trying for a few days now to understand the Blizz ABS script and seperate the minimap and I can't do it so I was wondering if someone (hopefully you) could do it for me. :)
Title: Re: Blizz ABS
Post by: G_G on April 19, 2009, 10:05:09 pm
Umm he updated tons of add ons and it has the minimap in it from blizz abs.