Jump to content
kal

Ruby/RGSS3 questions that don't deserve their own thread

Recommended Posts

Yeah I figured that is what you meant. :3 I just mean you can't easily just make an image to use as a mask because you can't copy channels form one image to another. You would either have to clear the transparent bits line per line, or do tricks with additive blending. Here look I made this thing to show you what I mean:

 

image.thumb.png.dfd4140b91d9d27e39f683d98472e2f2.png

 

This is the only good way I have found to do masks in VX Ace.

 

Oh oops. I was saying addictive instead of additive...  Silly Kayzee they aren't the same word at all! I mean a sprite with a blend_type of 1 okay? >w<

 

Er, anyway, I am not exactly sure how that minimap script works and most of the links on that page are dead, so I don't think I can help code it right now, but the basic idea is something I have done before. For example, the glow effects on my title sequence near the start of this video (after I am done talking about 21 seconds in)  Is done by hiding a repeating plane behind a mask and additivly blending the background on top of it (uses quite a bit of subtractive blending too). Never tried it on a ui element though. :O

 
Edited by Kayzee

Share this post


Link to post
Share on other sites
8 hours ago, Kayzee said:

"return a.one?"

 

Well, this is certainly interesting. Sounds to me like one could use any number with this. 'return a.three?'

Share this post


Link to post
Share on other sites
8 hours ago, Kayzee said:

glow effects on my title sequence near the start of this video

Brief hijack. Were you using a lighting script in this demo? The clips of you running around the forest and kickin' baddies looked really nice. If it was a script, which one was it, and is it pretty light to run? (Pun absolutely intended.)

Share this post


Link to post
Share on other sites
11 hours ago, PhoenixSoul said:

 

Well, this is certainly interesting. Sounds to me like one could use any number with this. 'return a.three?'

 

Nope, only one. Doing this for every other number to check for x and exactly x results isn't nearly as useful as you might think.. Plus, if they wrote a method for every number, that would be a lot of methods! :3

 

If you want to check for an exact number,  you are better off using "return a.count" to just get the number of matches.

 

10 hours ago, AeghtyAteKees said:

Brief hijack. Were you using a lighting script in this demo? The clips of you running around the forest and kickin' baddies looked really nice. If it was a script, which one was it, and is it pretty light to run? (Pun absolutely intended.)

 

Hehe, I was using Khas Awesome Light Effects at one point, but I was never really happy with it's terms of service and I ended up needing to heavily modify it so much to get it to work the way I wanted anyway, so I eventually scraped the whole thing and wrote my own lighting/effect script from scratch. XD Only thing missing is the real time shadow effects Khas Awesome Light Effects has, which are honestly slow as heck and don't look all that great, so no big loss in my eyes.

 

I also use the same script for a fog effect in one area. Not sure if it looks that great, as is though:

Spoiler

image.png.facdb89e8a50c606426ea7731574e7ac.png

 

Edit: Oh also, for reference, most of my dungeon areas also are covered by a 'fog of war' effect which hides unexplored tiles in addition to lighting. Here is a shot of my foresty area with the lighting script disabled:

 

Spoiler

image.png.e887609c4545b0e414947c7ec5f40d9c.png

 

Edited by Kayzee

Share this post


Link to post
Share on other sites

Ninjamida made this jukebox script, and I love it, but there's one thing I really would love if I knew how to pull it off...

Pitch and Volume settings. As is, if I wanted to have the selected sound file play back at the pitch/volume settings I have it set to, I'd have to edit the sound file and change a bunch of other things because, well...

 

Spoiler

## Audio module

module Audio
  
  class << self
    alias ninjamida_jukebox_bgm_play bgm_play
    alias ninjamida_jukebox_bgs_play bgs_play
    alias ninjamida_jukebox_me_play me_play
    alias ninjamida_jukebox_se_play se_play
  end
  
  def self.bgm_play(filename, volume = 100, pitch = 100, pos = 0)
    ninjamida_jukebox_bgm_play(filename, volume, pitch, pos)
    return if !NINJAMIDA_JUKEBOX_CONFIG::AUTO_ADD_SOUNDS || $game_jukebox.nil?
    $game_jukebox.jukebox_unlock(filename, :bgm) 
  end
  
  def self.bgs_play(filename, volume = 100, pitch = 100, pos = 0)
    ninjamida_jukebox_bgs_play(filename, volume, pitch, pos)
    return if !NINJAMIDA_JUKEBOX_CONFIG::AUTO_ADD_SOUNDS || $game_jukebox.nil?
    $game_jukebox.jukebox_unlock(filename, :bgs) 
  end
  
  def self.me_play(filename, volume = 100, pitch = 100)
    ninjamida_jukebox_me_play(filename, volume, pitch)
    return if !NINJAMIDA_JUKEBOX_CONFIG::AUTO_ADD_SOUNDS || $game_jukebox.nil?
    $game_jukebox.jukebox_unlock(filename, :me) 
  end
  
  def self.se_play(filename, volume = 100, pitch = 100)
    ninjamida_jukebox_se_play(filename, volume, pitch)
    return if !NINJAMIDA_JUKEBOX_CONFIG::AUTO_ADD_SOUNDS || $game_jukebox.nil?
    $game_jukebox.jukebox_unlock(filename, :se) 
  end
  
end

 


I mean, I could maybe try to set up some kind of variable like use 'vol' for volume and 'pit' for pitch, but then I'd have to set those up and I'm not quite sure how to do so...

The other alternative is to simply set all music and sound to have default pitch and volume, but since I already use Yanfly's System Options, default volume already doesn't match up with the default volume settings of Yanfly's script...

Edited by PhoenixSoul

Share this post


Link to post
Share on other sites
19 hours ago, Kayzee said:

Yeah I figured that is what you meant. :3 I just mean you can't easily just make an image to use as a mask because you can't copy channels form one image to another. You would either have to clear the transparent bits line per line, or do tricks with additive blending. Here look I made this thing to show you what I mean:

 

image.thumb.png.dfd4140b91d9d27e39f683d98472e2f2.png

 

This is the only good way I have found to do masks in VX Ace.

 

Oh oops. I was saying addictive instead of additive...  Silly Kayzee they aren't the same word at all! I mean a sprite with a blend_type of 1 okay? >w<

 

Er, anyway, I am not exactly sure how that minimap script works and most of the links on that page are dead, so I don't think I can help code it right now, but the basic idea is something I have done before. For example, the glow effects on my title sequence near the start of this video (after I am done talking about 21 seconds in)  Is done by hiding a repeating plane behind a mask and additivly blending the background on top of it (uses quite a bit of subtractive blending too). Never tried it on a ui element though. :O

 

Luckily the script already has that 3 sprites that simulate what you mention.

I did as you said and created the images but I can't seem to make it work..

The script is divided in 3 parts, but I'm pretty sure that is the second part, Iv'e already tried @map_img.blend_type = 1

Quote

#sb:nap_minimap [gui]
=begin
Minimap Script
Version 1.22
By Napoleon

About:
A minimap class that scales automatically according to it's size and which is
only displayed when the scene is a map. It also has a 'scroll-mode' and works
with huge maps. It has many more features just see the settings section.

Instructions:
- Place below "▼ Materials" but above "▼ Main Process".
- You can combine all my minimap scripts into one big script of course.
- Configure the (default) settings in the section below as desired.
- Place mapshots of your map inside the Minimap Folder with in the (default)
  format "MAP<map_id>.png" w/o te quotes. Example: Graphics/Minimap/Map025.png
  The map must have 3 digits. So Map001 is good but Map1 or Map01 is not good.
  You may use: http://himeworks.wordpress.com/2013/02/25/map-screenshot/
- Commands (optional of course):
    $minimap.enabled = true/false # Enables/Disables the minimap
    $minimap.opacity = 0-255      # Minimap opacity
    $minimap.set_location(rect)   # Rect is of type Rect
                                  # Rect.new(x,y,width,height)
                                  # Example: Rect.new(10,10,192,192)
    $minimap.mode = x             # x can be ":default" or ":scroll"
                                  (w/o quotes)
    $minimap.overlay_enabled = x  # x can be true/false
--------------------------------------------------------------------------------
    $minimap.add_icon(icon_id,x,y,icon_index)
   
     Parameter explanation:
     - icon_id: is an identifier purely used to allow to remove it later by
       using this id again. If you do not supply an id it will default to -1.
     - x,y: the location on the real map in pixels (not in tiles).
     - icon_index: the index of the icon from the ICON_SHEET. Starts at 0 but
       the 0-index is by default an empy icon.   
--------------------------------------------------------------------------------
    $minimap.rem_icon(icon_id)    # removes all icons that match the icon_id

- Events:
    To enable events on the minimap, add a comment in their event page and add:
    <minimap: render blinks arrow>
     render, blinks & arrow are optional parameters but you need to supply at
     least one of them.
     Note: If you have multiple pages in your event then you need to add the
           'minimap-comment-tag' to every page where you want the event to be
           shown/used on the minimap.
    
     #---------------
     Tag explanation:
     render: renders the event on the minimap
     blinks: makes the event blink
     arrow:  adds an arrow on the minimap pointing to the even when the event
             is outside of the visible minimap region.
     original_size: renders the event on the minimap in it's original size
                    multiplied by the minimap's zoomfactor.
     menu_hide: does not render the event on the menu map. But the event is
                still rendered on the regular minimap if the "render" option is
                included as well.
     #---------------

     # Name for the menu. If this tag is ommited and the event is rendered in
     # the menu then the name will default to the name of the event.
     <minimap name: Name of the minimap-event here>
     
     # Description for the menu.
     <minimap desc: Description of the minimap-event here>

Requires:
- RPG Maker VX Ace
- Napoleon's Core Script version 1.15+

Important Notes:
- Map settings are currently not saved when saving your game.
- I'm aware of a bug (version 1.22) that the minimap icons for the minimap-menu-
  addon are invisible after transferring. I haven't figured out yet how this is
  caused.

Terms of Use:
- Attribution 3.0 Unported (CC BY 3.0)
  http://creativecommons.org/licenses/by/3.0/
- Attribution instructions:
    - Give Credit to: Napoleon
    - Attribution may change over time and I have the right to have it
      changed.
    - When changed I may or may not contact you to update the attribution in
      your product within reasonable time.

Known issues/bugs:
- Events on the map are not perfectly centered and currently make use of an
  offset to somewhat work around this problem.
- If the minimap-area itself is larger than the minimap image then it will
  'teleport' around within the minimap area.
      
Version History:
1.22 (1 September 2014)
  - Removed the standalone script. The Core script is now a requirement.
  - Changed get_minimap_events()
  - Changed add_ev_by_command()
  - Added add_ev_by_nap_note()
1.21 (31 August 2014)
  - Events that have no name-comment-tag set now default to their event's name.
1.20a+b+c+d (09 July 2014)
  - Added "@has_map" to prevent crashes when opening the menu/entering a battle
    when the current map has no map image.
  - Fixed a crash when loading a savegame.
  - Fixed another crash when loading a savegame caused by version 1.20.
  - Fixed another crash when an event is trying to add events to the minimap
    when the minimap is nil.
1.20 (26 June 2014)
  - Was mainly written by Breaking Owl/Lemony. Commissioned by Napoleon.
  - Fixed a crash when opening the minimap-menu.
  - Fixed a bug that caused the minimap to 'teleport' when the minimap-bitmap
    was smaller than the minimap area itself. It is now centered instead.
  - Fixed icon positioning on the minimap. They should now be perfect!
  - Added a FRAME_SKIP setting for even more performance.
  - Refactored and improved the code that hides the minimap before battles and
    such. Instead of disposing the minimap, the minimap is instead hidden.
  - The minimap menu now uses the name of the party-leader instead of the first
    Actor. 
  - Thanks to Duqueelmagoblanco for reporting 3 issues/bugs.
  - Moved the MM_Icon to "Nap 4/4| MM Event, POI & Icon".
  - Added the Fixnum & Float clamp methods to the standalone script (and renamed
    the script).
1.11b (20 June 2014)
  - Fixed a crash when entering a random battle.
1.11a (31 May 2014)
  - Added the minimap menu.
  - Some methods have been altered/added to accommodate the new addon.
  - Removed method: get_event(..)
  - Added MM_POI class.
  - Added 2 addons: "Minimap Menu" and "Minimap Menu Item".
  - Added a new notetag option: no_render
  - Fixed POI location bug & removed debug messages...
  - Increased imported version number (was forgotten in 1.11).
1.10 (03 Januari 2014)
  - Increased performance for retrieving character sprites.
  - Fixed memory leak caused by removing icons.
  - The minimap now saves&loads it's settings when saving&loading the game.
  - The minimap no longer shows in custom scenes and when calling the save
    menu directly from the map. Also refactored this code a lot. Because of this
    the HIDE_IN_BATTLE setting has been replaced by:
    HIDE_BEFORE_BATTLE_TRANSITION.
1.06 (31 December 2013)
  - Made it compatible with Napoleons Core Script 1.05
  - Applied a patch from Mario Buonocore to hide the minimap during battle.
  - Fixed a crash
  - The minimap now remembers it's transparency when it is recreated.
1.05d (02 September 2013)
  - Fixed a bug that would cause the minimap to crash when the player is not the
    minimap-blip and then transferring to another map.
  - Added the "original_size" comment tag for large(r) events.
  - Fixed a crash caused in 1.05 an increased the version number.
  - Added a custom cache to support large maps.
  - Is no longer re-created when browsing through the game-menu.
  - Fixed a bug that caused the minimap to be loaded twice after returning from
    the menu.
1.04a&b&c (21&22&23 July 2013)
  - Fixed a bug that caused the minimap to be shown in the default menu.
  - Now supports compressed and encrypted game data.
  - Increased imported version number from 1.03 to 1.04
  - Replaced the replacement-method Scene_Map.perform_transfer with an alias
    (nap_minimap_post_transfer) for compatibility reasons.
1.04 (20 June 2013) (Mainly by estriole)
  - Fixed [F12] crash.
  - Never updates the minimap when not in Scene_Map.
  - Made the dispose method 'failsafe'.
  - Disposes the minimap instead of hiding it.
  - Added new setting: SCALE_OVERLAY = true/false.
  - You can now use a switch to turn on/off the minimap.
1.03(a) (13 June 2013)
  - Fixed a crash when selecting "load game" and then cancelling back to the
    main menu.
  - You can now add (animated & blinking) events to the minimap.
  - Events can also have an arrow pointing to their location.
  - New Setting to override the displayed map (ex: show map005.png on map010).
  - The player cursor can now flicker (blink).
  - Minimap can now be shown only when the party has a specific item, weapon.
    or armor in it's possession.
  - Added various other settings.
  - Added arrows pointing to events containing the arrow-comment-tag.
  - Added minimap icons.
  - Fixed a bug that prevented the correct minimap from being loaded when
    transferring the player back to a previously visited map.
1.02(a) (11 June 2013)
  - Fixed a bug that didn't cause the Minimap to hide itself when entering
    a battle through a random battle on the map.
  - Fixed the FAQ item and removed it.
1.01 (09 June 2013)
  - The minimap now automatically hides when the default menu is active
1.00 (07 June 2013)
  - First Release
=end
#===============================================================================
module Nap; class Minimap
#===============================================================================
# Settings
#===============================================================================
  # ** Files **
  FILE_PREFIX = 'Map'                 # File prefix for the minimap images.
  FILE_EXT    = 'png'                 # File extension for minimap images.
  FOLDER      = 'Minimap'             # Folder name that contains the minimap.
                                      # images (inside the Graphics folder).
  ARROWS      = 'Arrows'              # Filename of the arrow spritesheet.
  ICON_SHEET  = 'Iconset'             # The name of the Iconset (in
                                      # Graphics/System). By default this is
                                      # 'Iconset'.

  # ** Misc **
  LOCATION = Rect.new(                # Default minimap location & size.
                  Graphics.width - 12 - 128,             
                  12,
                  128,
                  128
                ) # << do not remove this ')'
  HIDE_IN_MENU = true                 # Set to false to display minimap in
                                      # the default menu.
  HIDE_BEFORE_BATTLE_TRANSITION = true# Set to false to display the minimap
                                      # during the battle transition.
  OPACITY = 255                       # Minimap opacity.
  Z_INDEX_MAP = 500                   # Minimap Z-index.
  Z_INDEX_CURSOR = Z_INDEX_MAP + 1    # Cursor (player blip) Z-index.
  MIN_CACHE_SIZE = 40000              # When a map's width x height is equal
                                      # or bigger than this value then the 
                                      # map image is stored in cache. This
                                      # will cost more RAM but costs less
                                      # performance when re-entering a map.
                                      # The value is in grid-coordinates.
                                      # A 200x200 map = 40.000 tiles.
                                      
  # Frame cooldown between full redraws. A value of 9 means that every 9
  # frames the minimap update is skipped (unless the update forced-parameter
  # is set to true)
  # This is purely a performance setting. A lower number means more
  # performance but may cause the minimap to stutter.
  # Note: Do not use a value of 0 or the minimap will never be updated. Use a
  #       nil value to disable this.
  FRAME_SKIP = 20
  
  # - The switch that determines if the minimap is enabled. Use -1 to disable
  # this feature.
  # - true/ON = enabled, false/OFF = disabled.
  # - This is not the same as $minimap.enabled. If $minimap.enabled is set to
  #   false OR this switch is turned OFF then the minimap won't show.
  ENABLED_SWITCH = -1
  
  # The hash below configures maps to use the map from another map (if you
  # know what I mean haha). 5 => 1 means that map with id 5 uses the minimap
  # image from map with map id 1. And 6 => 1 would mean that the map with id 6
  # will use the minimap image from map with id 1.
  MAP_IMAGE_OVERRIDE = {
    #<map id that this applies to> => <map_id of the map image to use>
    9 => 6,
  } # << do not remove this '}'
  
  # ** Events on map **
  # The event comment tag value. By default this is: "<minimap>".
  # Do NOT edit the 3 settings belowif you do not know what they are for!
  EV_COMMENT_TAG = 'minimap'
  EV_NAME_COMMENT_TAG = 'minimap name'
  EV_DESC_COMMENT_TAG = 'minimap desc'
  
  
  EV_SIZE = 16                        # The size of the events on the minimap
                                      # in pixels.
  EV_OFFSET = [0, 0]                  # x,y offset on the minimap for all
                                      # events in pixels.
  
  # ** Item/Armor/Wpn Requirement **
  REQUIRE_ITEM = false                # When set to true the minimap is only
                                      # shown when the party possesses at
                                      # least one map item for the current
                                      # map.
                                      
  # Enter the item id here followed by the maps that it applies to.
  # Example: If you want the minimap to show on maps with id 1, 10, 20 then
  # when the party possesses a potion then add this to the :item section:
  # 1  => [1],
  # 10 => [1],
  # 20 => [1],
  ITEMS = { # only applies when REQUIRE_ITEM is set to true
    :item => {
      # format: <map id> => [<id of item>, <id of item>],
      4 => [1]
    },
    :weapon => {
      4 => [2, 3]
    },
    :armor => {
    }
  } # << do not remove this '}'
  
  # ** Cursor (the player/blip in the minimap): **
  USE_PLAYER_GRAPHIC = true           # Use the player graphic for the blip?
  CURSOR_IMG = 'Blip'                 # Cursor image or nil if you prefer to
                                      # use a single color instead. Only
                                      # applies if USE_PLAYER_GRAPHIC is set
                                      # to false.
  CURSOR_SIZE = 16                    # Cursor size in pixels.
  CURSOR_COLOR = Color.new(255,0,0)   # Cursor color when BORDER_IMG is nil.
  CURSOR_OPACITY = 255                # Cursor opacity.

  # ** Border **
  BORDER_IMG = 'Border'               # Name of the border image or nil if
                                      # you prefer to just use a single color.
  BORDER_SIZE = 3                     # Minimap Border size in pixels.
  BORDER_COLOR = Color.new(0,0,0)     # Minimap Border color

  # ** Blink **
  BLINK_PLAYER = false                # Blink player blip/cursor?
  BLINK_SPEED = 40                    # How fast the player and events on the
                                      # minimap blink.
  
  # ** Show/Hide overrides **
  ALWAYS_SHOW = [] # List of map id's on which the minimap is always shown
  ALWAYS_HIDE = [] # List of map id's on which the minimap is never shown

  # ** Overlay **
  OVERLAY_IMG = 'Overlay'             # Overlay image. Use nil to use none.
  OVERLAY_OFFSET = [0,0]              # The offset for the overlay image.
  Z_INDEX_OVERLAY = Z_INDEX_CURSOR + 1# Overlay Z-index.
  OVERLAY_ENABLED = true             # Determines the default overlay state.
  SCALE_OVERLAY = true               # Determines if the overlay is scaled
                                      # to the size of the minimap.
  
  # Add all scenes that you want the minimap to be visible in into this array.
  # Note: Not case sensitive.
  ONLY_VISIBLE_IN_SCENES = [
    'Scene_Map',
  ]
                                      
  #---------------------------------------------------------------------------
  # Minimap Scroll-style specific settings
  #---------------------------------------------------------------------------
  MODE = :scroll   # Sets the default modus. Can be :default, :scroll
  MAP_ZOOM_X = 0.2 # Must be a float! Use 1.0 instead of 1 for example.
                   # A value of 1.0 = 100% zoom (no zoom) and a value of 0.2
                   # means 20% zoom (zoomed out)
  MAP_ZOOM_Y = 0.2 # Must be a float! Use 1.0 instead of 1 for example.
  MAP_ZOOMS = {
    # map_id => [zoom_x (float), zoom_y (float)],
    # Sample below will set the zoom for x&y to 0.5 for map with map_id 1
    # 1 => [0.5, 0.5],       
    6 => [0.3, 0.3],
    9 => [0.1, 0.1],
  } # << do not remove this '}'
  BG_COLOR = nil                # The minimap background color in case the map
                                # plus zoomfactor is smaller than the minimap.
                                # Use a nil value to disable.
                                # Note: Does not respond to $minimap.opacity
  AUTO_CORRECT_MAP_SCROLL = true      # When true the map won't scroll further
                                      # than it's own size.
#===============================================================================
# Do not edit below this line
#===============================================================================
  $imported ||= {}
  $imported[:nap_minimap] = 1.22
  
  raise "Napoleon's Minimap script requires Napoleon's Core script version 1.15 or higher." if !$imported[:nap_core] || $imported[:nap_core] < 1.15
  #---------------------------------------------------------------------------
  # * Members
  #---------------------------------------------------------------------------
  attr_accessor :visibility_override # :hide, :normal, :show
  attr_accessor :enabled # set to true/false to enable/disable the minimap
  attr_reader   :location # Rect
  attr_reader   :arrows_src_img # Bitmap that contains the arrow spritesheet
  attr_reader   :scroll_src_rect # Rectangle that contains the source rect from the @base_img when :scroll mode is active
  attr_reader   :mm_events # array of MM_Event
  attr_accessor :show_icons # determines if icons are rendered
  attr_reader   :map_zoom_x
  attr_reader   :map_zoom_y
  attr_reader   :save_icons

  def disposed?
    @disposed
  end
  
  @@save_data = nil
  def self.save_data
    @@save_data
  end
  def self.save_data=(value)
    @@save_data = value
  end
  
  def overlay_enabled
    @overlay_enabled
  end
  def overlay_enabled=(value)
    @overlay_enabled = value
    set_visibility
  end
  
  def opacity
    @@opacity
  end
  def opacity=(value)
    if value < 0
      @@opacity = 0
    elsif value > 255
      @@opacity = 255
    else
      @@opacity = value
    end
    
    create_sprite
  end
  
  def mode
    @@mode
  end
  def mode=(value)
    set_mode(value)
  end
end; end # module Nap; class Minimap
#===============================================================================

 

Quote

#sb:nap_minimap [gui]
#===============================================================================
# Game Event
# For: Adding a name-accessor to it.
#===============================================================================
class Game_Event
  if !defined?(self.name) || !defined?(self.name=())
    attr_accessor :name

    #---------------------------------------------------------------------------
    # Initialize                                                         [ALIAS]
    #---------------------------------------------------------------------------
    alias nam_minimap_initialize initialize
    def initialize(map_id, event)
      nam_minimap_initialize(map_id, event)
      @name = event.name
    end
  end
end
#===============================================================================
# Nap::Minimap
#===============================================================================
module Nap; class Minimap
  #-----------------------------------------------------------------------------
  # Super Visible Setter
  # For hiding/unhiding the minimap
  #-----------------------------------------------------------------------------
  def super_visible=(v)
    return if !@has_map
    update(true) if v # Is required to make sure that the minimap is up2date before it becomes visible. Imagine if the player teleports to another section of the map or comes out of a battle after walking without this. Then the minimap would be off for 1 frame (which is noticable).
    @sprite.visible = v
    @overlay.visible = v if @overlay
    @border.visible = v
    @player_sprite.visible = v
  end
  #-----------------------------------------------------------------------------
  # * initialize
  #-----------------------------------------------------------------------------
  def initialize
    @save_icons = [] # contains map-icon data for saving&loading
    @@cache ||= {}
    @disposed = false
    @arrows_src_img = Cache.minimap(ARROWS) if !@arrows_src_img
    @overlay_enabled = OVERLAY_ENABLED      
    @@mode = MODE if !defined?(@@mode)
    @map_zoom_x = MAP_ZOOM_X
    @map_zoom_y = MAP_ZOOM_Y
    @border_img = Cache.minimap(BORDER_IMG) if BORDER_IMG
    @cursor_img = Cache.minimap(CURSOR_IMG) if CURSOR_IMG      
    @enabled = true
    @visible = false      
    @visibility_override = :normal
    @sprite = Sprite.new
    @@opacity = OPACITY if !defined?(@@opacity)
    @show_icons = true
    @icons = []
    @updated_count = 0

    @mm_events = Minimap.get_minimap_events
    set_location(LOCATION) # also calls: create_sprite
    create_cursor
    
    load_data
    
    # Icons for poi
    # $mm_icons contains a hash with the event_id as the key and it's
    # sprite-character as the value.
    if $imported[:nap_minimap_menu]
      $mm_icons[:events].values.each { |icon| icon.dispose } if !$mm_icons.nil?
      $mm_icons = {:events => {}}
      @mm_events.each { |mm_ev|
        if mm_ev.event.sprite
          icon = Bitmap.new(mm_ev.event.sprite.src_rect.width, mm_ev.event.sprite.src_rect.height)
          icon.blt(0, 0, mm_ev.event.sprite.bitmap, mm_ev.event.sprite.src_rect)
          $mm_icons[:events][mm_ev.event.id] = icon
        end
      }
    end
  end
  #-----------------------------------------------------------------------------
  # * store_player_source_rect
  #-----------------------------------------------------------------------------
  def store_player_source_rect
    $mm_icons[:player_src_rect] = $game_player.sprite.src_rect if $imported[:nap_minimap_menu]
  end
  #-----------------------------------------------------------------------------
  # * Create Map Events
  #-----------------------------------------------------------------------------
  def self.get_minimap_events
    mm_events = []
    # Loop through all map events
    $game_map.events.values.each { |e|
      next if e.list.nil?
      
      new_mm_ev = nil
      name      = e.name # Default name in case no name-command will be found
      desc      = nil
      
      e.nap_note.each { |note|
        new_mm_ev = add_ev_by_nap_note(e) if new_mm_ev.nil?
        
        if note =~ /<#{Regexp.escape(Minimap::EV_NAME_COMMENT_TAG)}: ([^>]*)>/ix
          name = $1
        elsif note =~ /<#{Regexp.escape(Minimap::EV_DESC_COMMENT_TAG)}: ([^>]*)>/ix
          desc = $1
        end
      } # e.nap_note.each { |note|
# Old (outcommented) code below:
#~       # Loop through all commands within the looped-event.
#~       e.list.each{ |command|
#~         # Scan for new mm_event command
#~         new_mm_ev = Minimap.add_ev_by_command(e, command) if new_mm_ev.nil?
#~         
#~         # Scan for name/desc commands
#~         if command.code == 108
#~           if command.parameters[0] =~ /<#{Regexp.escape(Minimap::EV_NAME_COMMENT_TAG)}: ([^>]*)>/ix
#~             name = $1
#~           elsif command.parameters[0] =~ /<#{Regexp.escape(Minimap::EV_DESC_COMMENT_TAG)}: ([^>]*)>/ix
#~             desc = $1
#~           end
#~         end
#~       } # Loop through all commands within the looped-event.   
      
      if !new_mm_ev.nil?
        new_mm_ev.name = name
        new_mm_ev.desc = desc
        mm_events << new_mm_ev
      end
    } # Loop through all map events
    return mm_events
  end
  #-----------------------------------------------------------------------------
  # Add Event By Nap-Note
  #-----------------------------------------------------------------------------
  def self.add_ev_by_nap_note(event)
    event.nap_note.each { |note|
      if note =~ /<#{Regexp.escape(Minimap::EV_COMMENT_TAG)}: ([^>]*)>/ix
        return MM_Event.new(event, $1.downcase.split(' '))
      end
    }
    return nil
  end
  #-----------------------------------------------------------------------------
  # * Add Event By Command
  # Returns: The minimap_event or nil if none was found.
  #-----------------------------------------------------------------------------
  def self.add_ev_by_command(ev, command)
    if command.code == 108
      if command.parameters[0] =~ /<#{Regexp.escape(Minimap::EV_COMMENT_TAG)}: ([^>]*)>/ix
        return MM_Event.new(ev, $1.downcase.split(' '))
      end
    end
    return nil
  end
  #-----------------------------------------------------------------------------
  # * Add Event Unique
  # - Only adds the event if it doesn't already exist on the minimap.
  #-----------------------------------------------------------------------------
  def add_ev_unique(ev, command)
    return if @mm_events.find {|e| e.event.id == ev.id}
    new_mm_ev = Minimap.add_ev_by_command(ev, command)
    @mm_events << new_mm_ev if !new_mm_ev.nil?
  end
  #-----------------------------------------------------------------------------
  # * Remove Event
  # - Removes the event from the minimap
  #-----------------------------------------------------------------------------
  def remove_ev(ev_id)
    @mm_events.reject!{ |e| e.event.id == ev_id}
  end
  #-----------------------------------------------------------------------------
  # * Create Cursor
  #-----------------------------------------------------------------------------    
  def create_cursor
    @player_sprite.dispose if @player_sprite
    @player_sprite = Sprite.new
    @player_sprite.bitmap = Bitmap.new(CURSOR_SIZE, CURSOR_SIZE)
    @player_sprite.ox = CURSOR_SIZE / 2.0
    @player_sprite.oy = CURSOR_SIZE / 2.0
    
    if !USE_PLAYER_GRAPHIC
      if @cursor_img
        @player_sprite.bitmap.stretch_blt(Rect.new(0,0,@player_sprite.bitmap.width, @player_sprite.bitmap.height),@cursor_img,Rect.new(0,0,@cursor_img.width,@cursor_img.height), 255)
      else
        @player_sprite.bitmap.fill_rect(0, 0, CURSOR_SIZE, CURSOR_SIZE, CURSOR_COLOR)
      end
    end
    
    @player_sprite.z = Z_INDEX_CURSOR
    @player_sprite.visible = @visible
    reset_cursor_location
  end
  #-----------------------------------------------------------------------------
  # * Update Player Cursor
  # - Only called when USE_PLAYER_GRAPHIC == true
  #-----------------------------------------------------------------------------  
  def update_player_cursor
    player_character = $game_player.sprite
    return if !player_character || player_character.disposed?
    
    @player_sprite.bitmap.clear
    @player_sprite.bitmap.stretch_blt(Rect.new(0,0,@player_sprite.bitmap.width, @player_sprite.bitmap.height),
                                      player_character.bitmap,
                                      player_character.src_rect,
                                      255)
  end
  #-----------------------------------------------------------------------------
  # * Reset Cursor Location
  #-----------------------------------------------------------------------------     
  def reset_cursor_location
    @player_sprite.x = @location.x + @location.width / 2 + 16 * @map_zoom_x
    @player_sprite.y = @location.y + @location.height / 2 + 16 * @map_zoom_y
  end
  #-----------------------------------------------------------------------------
  # * Set location
  #   Sets the new location and size of the minimap
  #-----------------------------------------------------------------------------     
  def set_location(rect)
    @location = rect      
    
    @sprite.x = rect.x
    @sprite.y = rect.y
    @sprite.z = Z_INDEX_MAP
    
    @sprite.bitmap.dispose if @sprite.bitmap
    @sprite.bitmap = Bitmap.new(rect.width, rect.height)
                
    create_overlay if OVERLAY_IMG      
    create_sprite
    reset_cursor_location if @player_sprite
  end
  #-----------------------------------------------------------------------------
  # * Refresh
  #-----------------------------------------------------------------------------     
  def refresh
    @has_map = false
    return if !SceneManager.scene.instance_of?(Scene_Map)

    @mm_events = Minimap.get_minimap_events
    create_overlay if OVERLAY_IMG
    create_sprite
    reset_cursor_location if @player_sprite
  end
  #-----------------------------------------------------------------------------
  # * Create Overlay
  #-----------------------------------------------------------------------------     
  def create_overlay
    @overlay.dispose if @overlay
    @overlay = Sprite.new
    
    # bitmap
    if SCALE_OVERLAY
      img = Cache.minimap(OVERLAY_IMG)
      @overlay.bitmap = Bitmap.new(@location.width, @location.height)
      @overlay.bitmap.stretch_blt(Rect.new(0, 0, @location.width, @location.height),
                                  img, Rect.new(0, 0, img.width, img.height))
      img.dispose
    else
      @overlay.bitmap = Cache.minimap(OVERLAY_IMG)
    end   
    
    @overlay.x = @location.x + OVERLAY_OFFSET[0]
    @overlay.y = @location.y + OVERLAY_OFFSET[1]
    @overlay.z = Z_INDEX_OVERLAY
    @overlay.visible = @visible && @overlay_enabled
  end
  #-----------------------------------------------------------------------------
  # * Get Effective Map ID
  #-----------------------------------------------------------------------------
  def self.get_effective_map_id
    if MAP_IMAGE_OVERRIDE.has_key?($game_map.map_id)
      return MAP_IMAGE_OVERRIDE[$game_map.map_id]
    else
      return $game_map.map_id
    end
  end
  #-----------------------------------------------------------------------------
  # * get_map_bitmap
  # - returns the map bitmap (or nil if non exists) and sets @has_image
  # - also saves/loads from custom cache (if applicable)
  #-----------------------------------------------------------------------------
  def get_map_bitmap
    eff_map_id = Minimap.get_effective_map_id
    filename = "#{FILE_PREFIX}#{eff_map_id.to_s.rjust(3, '0')}"
  
    # Use the bitmap from the custom cache if there is one.
    if @@cache.has_key?(Minimap.get_effective_map_id)        
      @cached = true
      @has_image = true
      return @@cache[eff_map_id]
    else
      @cached = false
    end
    
    # Rescue is required because if the game data is encrypted then
    # File.exists? will always return false (not supported by RPG Maker)
    # and Cache.load_bitmap will crash.
    # RM encryption supported methods: load_data(), Bitmap.new(),
    # Graphics.transition()
    #@has_image = (Cache.load_bitmap("Graphics/#{FOLDER}","#{filename}.#{FILE_EXT}") != nil)      
    begin
      bmp = Bitmap.new("Graphics/#{FOLDER}/#{filename}.#{FILE_EXT}")
      @has_image = true
    rescue
      @has_image = false
      return nil
    end

    # Save to cache if conditions are met
    if (bmp.width * bmp.height / 32) >= MIN_CACHE_SIZE && !@@cache.has_key?(eff_map_id)
      @@cache[eff_map_id] = bmp
      @cached = true
    end
    
    return bmp
  end
  #-----------------------------------------------------------------------------
  # * Set Zoom
  #-----------------------------------------------------------------------------
  def set_zoom
    # Set Zoom
    if MAP_ZOOMS[$game_map.map_id] == nil
      @map_zoom_x = MAP_ZOOM_X
      @map_zoom_y = MAP_ZOOM_Y
    else
      @map_zoom_x = MAP_ZOOMS[$game_map.map_id][0]
      @map_zoom_y = MAP_ZOOMS[$game_map.map_id][1]
    end
  end    
  #-----------------------------------------------------------------------------
  # * Create Sprite (the map itself)
  #-----------------------------------------------------------------------------     
  def create_sprite
    map_img = get_map_bitmap    
    if !@has_image
      @has_map = false
      return
    end
    @has_map = true
    @map_img = map_img.dup
    
    @map_w = map_img.width.to_f
    @map_h = map_img.height.to_f

    @base_map.dispose if @base_map
    case @@mode
    when :default
      @sprite.bitmap.stretch_blt(Rect.new(0, 0, @location.width, @location.height), map_img, Rect.new(0,0,@map_w,@map_h), @@opacity)
      @base_map = Bitmap.new(@location.width, @location.height)
      @base_map.stretch_blt(Rect.new(0, 0, @location.width, @location.height), map_img, Rect.new(0,0,@map_w,@map_h), @@opacity)
    when :scroll
      set_zoom        
      # Store source map (zoomed)
      @base_map = Bitmap.new(map_img.width * @map_zoom_x, map_img.height * @map_zoom_y)
      @base_map.stretch_blt(Rect.new(0,0,@base_map.width, @base_map.height), map_img, Rect.new(0,0,map_img.width,map_img.height), @@opacity)
    else
      raise "create_sprite: Unknown @@mode (#{@@mode})"
    end      
    map_img.dispose if !@cached
    
    create_border
    @sprite.visible = @visible
    render_events
  end
  
  def refresh_events
    @mm_events = Minimap.get_minimap_events
  end
  
  #-----------------------------------------------------------------------------
  # * Render Events
  #-----------------------------------------------------------------------------
  def render_events
    return if @mm_events.length == 0 || @player_sprite.nil?
    # There is no need to render a clean map (basemap w/o events) in :scroll_mode because the sets_scroll handles that.
    case @@mode
    when :default
      # Render the basemap onto the new spritemap (removing all events and such).
      @sprite.bitmap.dispose if @sprite.bitmap
      @sprite.bitmap = Bitmap.new(@location.width, @location.height)
      @sprite.bitmap.blt(0,0,@base_map, Rect.new(0,0,@sprite.bitmap.width,@sprite.bitmap.height))
    when :scroll
      # Make sur ethat the scroll_src_rect is set before rendering events in :scroll mode
      get_scroll_base_src_rect if !@scroll_src_rect
    else
      raise "render_events: Unknown @@mode (#{@@mode})"
    end
  
    @mm_events.each { |ev| ev.render(self, @sprite.bitmap, @map_zoom_x, @map_zoom_y) }
  end
  #-----------------------------------------------------------------------------
  # * Create Border
  #-----------------------------------------------------------------------------
  def create_border
    @border.dispose if @border
    @border = Sprite.new
    @border.bitmap = Bitmap.new(@location.width + BORDER_SIZE * 2, @location.height + BORDER_SIZE * 2)
    @border.x = @location.x - BORDER_SIZE
    @border.y = @location.y - BORDER_SIZE
    
    if BORDER_IMG
      @border.bitmap.stretch_blt(Rect.new(0,0,@border.bitmap.width, @border.bitmap.height),@border_img,Rect.new(0,0,@border_img.width,@border_img.height), 255)
    else
      @border.bitmap.fill_rect(0, 0, @border.bitmap.width, BORDER_SIZE, BORDER_COLOR)
      @border.bitmap.fill_rect(@border.bitmap.width - BORDER_SIZE, 0, BORDER_SIZE, @border.bitmap.height, BORDER_COLOR)
      @border.bitmap.fill_rect(0, @border.bitmap.height - BORDER_SIZE, @border.bitmap.width, BORDER_SIZE, BORDER_COLOR)
      @border.bitmap.fill_rect(0, 0, BORDER_SIZE, @border.bitmap.height, BORDER_COLOR)
    end
    
    @border.z = Z_INDEX_MAP
    @border.visible = @visible
  end
  #-----------------------------------------------------------------------------
  # * Set Mode
  #-----------------------------------------------------------------------------    
  def set_mode(mode)
    raise "Minimap.set_mode(#{mode}) Invalid mode." if mode != :default && mode != :scroll
    @@mode = mode
    
    @sprite.bitmap.clear # This line is necessary in case the opacity is < 255.
    create_sprite
    reset_cursor_location
  end
  #-----------------------------------------------------------------------------
  # * Set Cursor Location
  #-----------------------------------------------------------------------------    
  def set_cursor_location
    ratio_x = @location.width / @map_w
    ratio_y = @location.height / @map_h
    
    map_x = $game_player.real_x * 32 * ratio_x + @location.x
    map_y = $game_player.real_y * 32 * ratio_y + @location.y
    
    @player_sprite.x = map_x
    @player_sprite.y = map_y
  end
  #-----------------------------------------------------------------------------
  # * World map to minimap coordinates
  # real_x & real_y is the location in pixels (upper left corner is 0,0)
  # returns 2 values
  # Note: real_x usually requires a * 32 multiplication
  #-----------------------------------------------------------------------------
  def to_minimap_coords(real_x, real_y)
    case @@mode
    when :default
      ratio_x = @location.width.to_f / @map_w.to_f
      ratio_y = @location.height.to_f / @map_h.to_f
      x = real_x * @map_zoom_x
      y = real_y * @map_zoom_y
      return real_x * ratio_x, real_y * ratio_y
    when :scroll
      real_x += 16
      real_y += 16
      x = real_x * @map_zoom_x
      y = real_y * @map_zoom_y
      return x, y
    else
      raise "def to_minimap_coords - unknown mode: #{@@mode}"
    end
  end
  #-----------------------------------------------------------------------------
  # * Get Scroll Base Source Rectangle
  # - This method contains the real logic for drawing and calculating the
  #   scrolling map.
  #-----------------------------------------------------------------------------
  def get_scroll_base_src_rect
    half_w = @location.width / 2
    half_h = @location.height / 2
    
    # Calculate the location of the player on the basemap with zoom factor
    x = $game_player.real_x * 32 * @map_zoom_x - half_w
    y = $game_player.real_y * 32 * @map_zoom_y - half_h
    
    
    
    mw = @map_img.width.to_f  * @map_zoom_x
    mh = @map_img.height.to_f * @map_zoom_y      
    dh = @location.height - mh
    dw = @location.width - mw
    equals = @location.width > mw && @location.height > mh
    if AUTO_CORRECT_MAP_SCROLL# && equals
      # The code below makes sure that the map is not scrolled when the player
      # is near the edge of the map. Otherwise you could see the minimap bg
      # near the edge...
      if x < 0 # Prevent the map from scrolling too far to the right (otherwise creating a gap on the left side)
        delta_x = x
        x = 0 # Prevent the map from scrolling too far to the right (otherwise creating a gap on the left side)
        # Because the map did not scroll we have to adjust the player cursor so that he is stilled drawn on the correct location on the minimap.
        @player_sprite.x = @location.x + @location.width / 2 + delta_x + 16 * @map_zoom_x
      elsif x + @location.width > @base_map.width
        delta_x = (x + @location.width) - @base_map.width
        x = @base_map.width - @location.width # Prevent the map from scrolling too far to the left (otherwise creating a gap on the right side)
        # Because the map did not scroll we have to adjust the player cursor so that he is stilled drawn on the correct location on the minimap.
        @player_sprite.x = @location.x + @location.width / 2 + delta_x + 16 * @map_zoom_x
      end

      if y < 0 # Prevent the map from scrolling too far to the bottom (otherwise creating a gap on the top side)
        delta_y = y
        y = 0 # Prevent the map from scrolling too far to the right (otherwise creating a gap on the left side)
        # Because the map did not scroll we have to adjust the player cursor so that he is stilled drawn on the correct location on the minimap.
        @player_sprite.y = @location.y + @location.height / 2 + delta_y + 16 * @map_zoom_y
      elsif y + @location.height > @base_map.height
        delta_y = (y + @location.height) - @base_map.height
        y = @base_map.height - @location.height # Prevent the map from scrolling too far to the left (otherwise creating a gap on the right side)
        # Because the map did not scroll we have to adjust the player cursor so that he is stilled drawn on the correct location on the minimap.
        @player_sprite.y = @location.y + @location.height / 2 + delta_y + 16 * @map_zoom_y
      end
    end
    if equals
      if y < 0 # Prevent the map from scrolling too far to the bottom (otherwise creating a gap on the top side)
        delta_y = y
        y = 0 # Prevent the map from scrolling too far to the right (otherwise creating a gap on the left side)
        # Because the map did not scroll we have to adjust the player cursor so that he is stilled drawn on the correct location on the minimap.
        #@player_sprite.y = @location.y + @location.height / 2 + delta_y + 16 * @map_zoom_y
        @player_sprite.y -= dh
      end
      if x < 0 # Prevent the map from scrolling too far to the right (otherwise creating a gap on the left side)
        delta_x = x
        x = 0 # Prevent the map from scrolling too far to the right (otherwise creating a gap on the left side)
        # Because the map did not scroll we have to adjust the player cursor so that he is stilled drawn on the correct location on the minimap.
        @player_sprite.x -= dw
      end        
      #unless equals
        cx = (@location.width  - mw).ceil / 2
        cy = (@location.height - mh).ceil / 2
        x -= cx #* @map_zoom_x
        y -= cy #* @map_zoom_y
        @player_sprite.y += cy
        @player_sprite.x += cx
      #end
    end
    
    @scroll_src_rect = Rect.new(x,y,@location.width, @location.height)
    return @scroll_src_rect
  end
  #-----------------------------------------------------------------------------
  # * Set Scroll
  #-----------------------------------------------------------------------------
  def set_scroll
    @sprite.bitmap.clear # This line is necessary in case the opacity is < 255.      
    
    # BG Color
    if BG_COLOR != nil
      @sprite.bitmap.fill_rect(0, 0, @sprite.bitmap.width, @sprite.bitmap.height,
      Color.new(BG_COLOR.red, BG_COLOR.blue, BG_COLOR.green, @@opacity))
    end

    # Redraw the (newly) visible portion on the minimap
    @sprite.bitmap.stretch_blt(Rect.new(0,0,@location.width,@location.height),
      @base_map,
      get_scroll_base_src_rect,
      255 # opacity was already applied when caching the @sprite.bitmap. So keep it at 255 here.
    ) # stretch_blt
  end
  #-----------------------------------------------------------------------------
  # * Blink Cursor
  #-----------------------------------------------------------------------------
  def blink_cursor
    @player_sprite.visible = !BLINK_PLAYER || Nap::MM_Event.blink_visible?
  end
  #-----------------------------------------------------------------------------
  # * Update
  # Set forced to true to skip the frame-skipping.
  #-----------------------------------------------------------------------------
  def update(forced=false)
    if !forced && FRAME_SKIP
      if @updated_count < Nap::Minimap::FRAME_SKIP
        @updated_count += 1
      else
        @updated_count = 0
        return
      end
    end
    
    return if !SceneManager.scene.instance_of?(Scene_Map) || @disposed
    
    if (SceneManager.scene.instance_of?(Scene_Map) || @visibility_override == :show) && @visibility_override != :hide && @enabled && switch_enabled? && @has_image
      set_visibility(true) if !@visible
      
      MM_Event.update_blink
      blink_cursor
      update_player_cursor if USE_PLAYER_GRAPHIC
      
      case @@mode
      when :default
        set_cursor_location
      when :scroll
        set_scroll
      else
        raise "update: Unknown @@mode (#{@@mode})"
      end
          
      render_events
      @icons.each { |i| i.render(self, @sprite.bitmap) } if @show_icons
      @visible = true
    else
      set_visibility(false) if @visible
      @visible = false
    end
  end
  #-----------------------------------------------------------------------------
  # Switch Enabled?
  #-----------------------------------------------------------------------------
  def switch_enabled?
    return true if ENABLED_SWITCH == -1
    return $game_switches[ENABLED_SWITCH]
  end
  #-----------------------------------------------------------------------------
  # * Set Visibiliy Override
  # - Sets minimap visibility according to item/wpn/armor settings
  # - returns true if the map should be visible
  #-----------------------------------------------------------------------------
  def item_visiblity
    return true if !REQUIRE_ITEM # return true if items are not required
    map_id = $game_map.map_id

    if ITEMS[:item].has_key?(map_id)
      $data_items.each { |i|
        next if i.nil?
        return true if ITEMS[:item][map_id].include?(i.id) && $game_party.item_number(i) > 0
      }
    end

    if ITEMS[:weapon].has_key?(map_id)
      $data_weapons.each { |w|
        next if w.nil?
        return true if ITEMS[:weapon][map_id].include?(w.id) && $game_party.item_number(w) > 0
      }
    end

    if ITEMS[:armor].has_key?(map_id)
      $data_armors.each { |a|
        next if a.nil?
        return true if ITEMS[:armor][map_id].include?(a.id) && $game_party.item_number(a) > 0
      }
    end

    return false
  end
  #-----------------------------------------------------------------------------
  # * Set Visibiliy Override
  #-----------------------------------------------------------------------------  
  def set_visibility_override
    if !item_visiblity
      @visibility_override = :hide
      return
    end
    
    # Always hide/show on this map depending on the 2 setting arrays
    @visibility_override = :normal
    if ALWAYS_SHOW.include?($game_map.map_id)
      @visibility_override = :show
    elsif ALWAYS_HIDE.include?($game_map.map_id)
      @visibility_override = :hide
    end
  end
  #-----------------------------------------------------------------------------
  # * Set Visibility
  #-----------------------------------------------------------------------------
  def set_visibility(visibility=@visible)
    @sprite.visible = visibility
    @border.visible = visibility if @border
    @player_sprite.visible = visibility if @player_sprite
    @overlay.visible = visibility && @overlay_enabled if @overlay
  end
  #-----------------------------------------------------------------------------
  # * Add Icon
  # - icon_id: is an identifier purely used to allow to remove it later by
  #   using this id again. If you do not supply an id it will default to -1.
  # - x,y: the location on the real map in pixels (not in tiles).
  # - icon_index: the index of the icon from the ICON_SHEET. Starts at 0 but
  #   the 0-index is by default an empy icon.
  #-----------------------------------------------------------------------------
  def add_icon(icon_id=-1, x, y, icon_index)
    icon_sheet = Cache.system(ICON_SHEET)
    
    icon_img = Bitmap.new(24, 24)
    rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
    icon_img.blt(0, 0, icon_sheet, rect)
    @icons << MM_Icon.new(icon_id, x, y, icon_img)
    icon_sheet.dispose
    
    @save_icons << [icon_id, x, y, icon_index]
  end
  #-----------------------------------------------------------------------------
  # * Remove Icon
  #-----------------------------------------------------------------------------
  def rem_icon(id)
    @icons.each { |i| i.dispose if i.id == id }      
    @icons.reject! { |i| i.id == id }
    @save_icons.reject! { |i| i[0] == id}
  end
  #-----------------------------------------------------------------------------
  # * Dispose
  #-----------------------------------------------------------------------------
  def dispose      
    @disposed = true
    @map_img.dispose if @map_img
    @map_img = nil
    @sprite.dispose if @sprite && !@sprite.disposed?
    @player_sprite.dispose if @player_sprite && !@player_sprite.disposed?      
    @border.dispose if @border && !@border.disposed?
    @border_img.dispose if @border_img && !@border_img.disposed?
    @cursor_img.dispose if @cursor_img && !@cursor_img.disposed?
    @overlay.dispose if @overlay && !@overlay.disposed?
    @base_map.dispose if @base_map && !@base_map.disposed?
    @arrows_src_img.dispose if @arrows_src_img && !@arrows_src_img.disposed?
    @icons.each { |i| i.dispose if i && !i.disposed?}
  end
end; end # Nap; Minimap
#===============================================================================
# Cache
#===============================================================================
module Cache
  #-----------------------------------------------------------------------------
  # * Get Minimap Graphic                                                  [NEW]
  #-----------------------------------------------------------------------------
  def self.minimap(filename)
    load_bitmap("Graphics/#{Nap::Minimap::FOLDER}/", filename)
  end
end
#===============================================================================
# Game Party
# To show/hide the minimap whenever the party gains/loses a 'map-related' item
#===============================================================================
class Game_Party < Game_Unit
  #-----------------------------------------------------------------------------
  # Gain Item                                                            [ALIAS]
  #-----------------------------------------------------------------------------
  alias nap_minimap_gain_item gain_item
  def gain_item(item, amount, include_equip = false)
    nap_minimap_gain_item(item, amount, include_equip)
    $minimap.set_visibility_override if $minimap && Nap::Minimap::REQUIRE_ITEM
  end
  
  #-----------------------------------------------------------------------------
  # Lose Item                                                            [ALIAS]
  #-----------------------------------------------------------------------------
  alias nap_minimap_lose_item lose_item
  def lose_item(item, amount, include_equip = false)
    nap_minimap_lose_item(item, amount, include_equip)
    $minimap.set_visibility_override if $minimap && Nap::Minimap::REQUIRE_ITEM
  end
end
#===============================================================================
# Spriteset Map
# For updating the minimap
#===============================================================================
class Spriteset_Map  
  #-----------------------------------------------------------------------------
  # Update                                                               [ALIAS]
  #-----------------------------------------------------------------------------
  alias nap_minimap_update update
  def update
    nap_minimap_update
    $minimap.update if $minimap
  end
end
#===============================================================================
# Class Event
# For removing events from the minimap when the event is erased
#===============================================================================
class Game_Event < Game_Character
  #-----------------------------------------------------------------------------
  # Erase                                                                [ALIAS]
  #-----------------------------------------------------------------------------
  alias nap_minimap_erase erase
  def erase
    nap_minimap_erase
    $minimap.mm_events.reject! { |e| e.event.id == @id } if $minimap
  end
end
#===============================================================================
# Game Event
# For making sure that the event is only shown on the minimap when the page
# that contains the minimap-comment-tag is actually active.
#===============================================================================
class Game_Event < Game_Character
  #-----------------------------------------------------------------------------
  # Setup Page Settings                                                  [ALIAS]
  #-----------------------------------------------------------------------------
  alias nap_minimap_setup_page_settings setup_page_settings
  def setup_page_settings
    nap_minimap_setup_page_settings
    
    if SceneManager.scene.instance_of?(Scene_Map) && $minimap
      $minimap.remove_ev(self.id)
      return if self.list == nil
      for command in self.list
        $minimap.add_ev_unique(self, command)
      end
    end
  end
end
#===============================================================================
# Saving & Loading
#===============================================================================
module DataManager
  class << self
    alias nap_minimap_make_save_contents    make_save_contents
    alias nap_minimap_extract_save_contents extract_save_contents
  end
  #-----------------------------------------------------------------------------
  # Make Save Contents                                                   [ALIAS]
  #-----------------------------------------------------------------------------
  def self.make_save_contents    
    contents = nap_minimap_make_save_contents
    contents[:nap_minimap] = {}

    if $minimap && !$minimap.disposed?
      contents[:nap_minimap][:mode] = $minimap.mode
      contents[:nap_minimap][:visibility_override] = $minimap.visibility_override
      contents[:nap_minimap][:enabled] = $minimap.enabled
      contents[:nap_minimap][:location] = $minimap.location
      contents[:nap_minimap][:scroll_src_rect] = $minimap.scroll_src_rect
      #contents[:nap_minimap][:mm_events] = $minimap.mm_events
      contents[:nap_minimap][:show_icons] = $minimap.show_icons
      contents[:nap_minimap][:map_zoom_x] = $minimap.map_zoom_x
      contents[:nap_minimap][:map_zoom_y] = $minimap.map_zoom_y
      contents[:nap_minimap][:overlay_enabled] = $minimap.overlay_enabled
      
      contents[:nap_minimap][:opacity] = $minimap.opacity
      contents[:nap_minimap][:map_icons] = $minimap.save_icons
    end
    
    contents
  end
  #-----------------------------------------------------------------------------
  # Extract Save Contents                                             [ALIAS]
  #-----------------------------------------------------------------------------
  def self.extract_save_contents(contents)
    nap_minimap_extract_save_contents(contents)
    Nap::Minimap.save_data = contents[:nap_minimap]
  end
end
#===============================================================================
# Class Minimap
#===============================================================================
module Nap
  class Minimap
    # in case a savegame was loaded
    def load_data
      return if Minimap.save_data.nil? || @@save_data.empty?

      set_mode(@@save_data[:mode]) # no "self."
      self.visibility_override = @@save_data[:visibility_override]
      self.enabled = @@save_data[:enabled]
      location = @@save_data[:location] # no "self."
      scroll_src_rect = @@save_data[:scroll_src_rect] # no "self."
      #mm_events = @@save_data[:mm_events]
      self.show_icons = @@save_data[:show_icons]
      map_zoom_x = @@save_data[:map_zoom_x] # no "self."
      map_zoom_y= @@save_data[:map_zoom_y] # no "self."
      self.overlay_enabled = @@save_data[:overlay_enabled]
      
      @@save_data[:map_icons].each { |i|
        @save_icons << i
        add_icon(i[0], i[1], i[2], i[3])
      }
      
      self.opacity = @@save_data[:opacity]
    end
  end
end
#===============================================================================
# Scene Base
# For: Creates the minimap
#===============================================================================
class Scene_Base
  #-----------------------------------------------------------------------------
  # Post Start                                                           [ALIAS]
  #-----------------------------------------------------------------------------
  alias nap_minimap_post_start post_start
  def post_start
    if SceneManager.scene.instance_of?(Scene_Map) &&
      Nap::Minimap::ONLY_VISIBLE_IN_SCENES.include?(self.class.name)
      if $minimap
        $minimap.super_visible = true
        $minimap.refresh
      else
        $minimap = Nap::Minimap.new
      end
    else
      $minimap.super_visible = false if $minimap
    end
    nap_minimap_post_start
  end
end
#===============================================================================
# Scene Map
#===============================================================================
class Scene_Map < Scene_Base
#-------------------------------------------------------------------------------
# Pre Battle Scene                                                       [ALIAS]
# ** Mario Buonocore - Hide Napoleon's Minimap before the battle transition.
#
#    Nasconde la minimappa durante la battaglia.
#    Fa riferimento al valore della costante HIDE_IN_MENU.
#-------------------------------------------------------------------------------
  alias lm_pre_battle_scene pre_battle_scene
  def pre_battle_scene    
    $minimap.super_visible = false if Nap::Minimap::HIDE_BEFORE_BATTLE_TRANSITION    
    lm_pre_battle_scene
  end
  #-----------------------------------------------------------------------------
  # Call Menu                                                            [ALIAS]
  # For: Storing player source rect before opening the menu
  #-----------------------------------------------------------------------------
  alias nap_minimap_call_menu call_menu
  def call_menu
    $minimap.store_player_source_rect
    nap_minimap_call_menu
  end
  #-----------------------------------------------------------------------------
  # Post Transfer                                                        [ALIAS]
  #-----------------------------------------------------------------------------
  alias nap_minimap_post_transfer post_transfer
  def post_transfer
    $minimap.refresh
    nap_minimap_post_transfer
    $minimap.refresh_events
  end
end # Scene_Map
#===============================================================================

 

Quote

#sb:nap_minimap [gui]
module Nap
#===============================================================================
# Minimap Event
#===============================================================================  
  class MM_Event
    attr_accessor :event
    attr_accessor :render # false will not draw this event on the map but still display an arrow to it if applicable
    attr_accessor :blinks
    attr_accessor :arrow
    attr_accessor :original_size
    attr_accessor :name
    attr_accessor :desc
    attr_reader   :hide_in_menu
    
    @@blink_cnt = 0
    @@blink_visible = false
    
    def self.blink_visible?
      @@blink_visible
    end
    
    ARROW_DIRECTION = {
      :NA => -1,
      :N  =>  0,
      :NE =>  1,
      :E  =>  2,
      :SE =>  3,
      :S  =>  4,
      :SW =>  5,
      :W  =>  6,
      :NW =>  7
    }
    #---------------------------------------------------------------------------
    # * Initialize
    #---------------------------------------------------------------------------
    def initialize(ev, options)
      @event = ev
      @sprite_character = @event.sprite

      return if @sprite_character.nil?

      @render = options.include?('render')
      @blinks = options.include?('blinks')
      @arrow = options.include?('arrow')
      @original_size = options.include?('original_size')
      @hide_in_menu = options.include?('menu_hide')
      if @original_size && !@sprite_character.disposed?
        @dest_width = @sprite_character.src_rect.width
        @dest_height = @sprite_character.src_rect.height
        @original_offset = [@dest_width / 2, @dest_height / 2]
      else
        @dest_width = @dest_height = Minimap::EV_SIZE
      end
      
    end    
    #---------------------------------------------------------------------------
    # * Update Blink (static)
    # ! call this only ONCE per update-cycle
    #---------------------------------------------------------------------------    
    def self.update_blink
      @@blink_cnt += 1
      if @@blink_cnt == Nap::Minimap::BLINK_SPEED
        @@blink_cnt = 0
        @@blink_visible = !@@blink_visible
      end
    end   
    #---------------------------------------------------------------------------
    # * Render
    #---------------------------------------------------------------------------
    def render(minimap, img, zoom_x, zoom_y)
      return if @sprite_character.nil? || @sprite_character.disposed? || @sprite_character.bitmap.nil? || @sprite_character.bitmap.disposed? || img.disposed? # In case the player just transferred to another map
      if @render && (!@blinks || @@blink_visible)
        x, y = minimap.to_minimap_coords(@event.real_x * 32.0, @event.real_y * 32.0)#(@event.real_x * 32, @event.real_y * 32)
        
        if minimap.mode == :scroll
          x -= minimap.scroll_src_rect.x
          y -= minimap.scroll_src_rect.y
        end

        if !@original_size
          img.stretch_blt(Rect.new(x - (@dest_width  / 2 ) + Nap::Minimap::EV_OFFSET[0],
                                   y - (@dest_height / 2 ) + Nap::Minimap::EV_OFFSET[1],
                                   @dest_width,
                                   @dest_height),
                          @sprite_character.bitmap,
                          @sprite_character.src_rect)
        else
          dify = (@sprite_character.src_rect.height - 32) / 2
          y -= dify * zoom_y
          img.stretch_blt(Rect.new(x - (@original_offset[0].to_f ) * zoom_x,
                                   y - (@original_offset[1].to_f ) * zoom_y,
                                   @dest_width.to_f * zoom_x,
                                   @dest_height.to_f * zoom_y),
                          @sprite_character.bitmap,
                          @sprite_character.src_rect)
        end
              
        render_arrow(minimap, img, x, y) if @arrow && minimap.mode == :scroll
      end      
    end    
    #---------------------------------------------------------------------------
    # * Render Arrow
    #---------------------------------------------------------------------------
    def render_arrow(minimap, img, x, y)
      frame_w = minimap.arrows_src_img.width / 8 # 8 frames
      frame_h = minimap.arrows_src_img.height
      arrow_x = x
      arrow_y = y
      src_idx = :NA
      
      if x < 0
        arrow_x = Nap::Minimap::BORDER_SIZE
        src_idx = :W
      elsif x > minimap.location.width
        arrow_x = minimap.location.width - frame_w #- Nap::Minimap::BORDER_SIZE
        src_idx = :E
      end
      
      if y < 0
        arrow_y = Nap::Minimap::BORDER_SIZE
        if src_idx == :NA
          src_idx = :N
        else
          if src_idx == :W
            src_idx = :NW
          else
            src_idx = :NE
          end
        end
      elsif y > minimap.location.height
        arrow_y = minimap.location.height - frame_h - Nap::Minimap::BORDER_SIZE
        if src_idx == :NA
          src_idx = :S
        else
          if src_idx == :W
            src_idx = :SW
          else
            src_idx = :SE
          end
        end
      end
      
      return if src_idx == :NA # No arrow needed because the event is within the visible minimap area.
      
      img.stretch_blt(Rect.new(arrow_x, arrow_y, frame_w, frame_h),
                      minimap.arrows_src_img,
                      Rect.new(frame_w * ARROW_DIRECTION[src_idx], 0, frame_w, frame_h))                     
    end
    #---------------------------------------------------------------------------
    # To POI
    #---------------------------------------------------------------------------
    def to_poi
      return nil if @hide_in_menu
      return MM_POI.new(@event.real_x * 32, @event.real_y * 32, @name, @desc, $mm_icons[:events][@event.id])
    end
  end # class MM_Event
  #=============================================================================
  # Nap.MM_POI
  # For: Minimap POI Container
  #=============================================================================
  class MM_POI
    attr_reader :x
    attr_reader :y
    attr_reader :name
    attr_reader :desc # description
    attr_reader :icon # Use a nil value to not render it
    
    #---------------------------------------------------------------------------
    # Initialize
    #---------------------------------------------------------------------------
    def initialize(x, y, name, description, icon)
      @x = x
      @y = y
      @name = name
      @desc = description
      @icon = icon
    end
    #---------------------------------------------------------------------------
    # Player POI
    #---------------------------------------------------------------------------
    def self.player_poi
      return MM_POI.new($game_player.real_x * 32, $game_player.real_y * 32,
                        $game_party.leader.name, 'It\'s you!', nil)
    end
    #---------------------------------------------------------------------------
    # To string override
    #---------------------------------------------------------------------------
    def to_s
      @name
    end
  end # class MM_POI
#===============================================================================
# MM_Icon
#===============================================================================
  class MM_Icon
    attr_accessor :x
    attr_accessor :y
    attr_accessor :id
    attr_accessor :bitmap
    SRC_RECT = Rect.new(0, 0, 24, 24)
    
    #---------------------------------------------------------------------------
    # * Initialize
    #---------------------------------------------------------------------------
    def initialize(id, x, y, bitmap)
      @x = x
      @y = y
      @id = id
      @bitmap = bitmap
      @disposed = false
    end
    #---------------------------------------------------------------------------
    # * Render
    #---------------------------------------------------------------------------
    def render(minimap, map)
      r_x, r_y = minimap.to_minimap_coords(@x+32, @y+32)

      if minimap.mode == :scroll
        r_x -= minimap.scroll_src_rect.x
        r_y -= minimap.scroll_src_rect.y
      end

      map.stretch_blt(Rect.new(r_x - 12, r_y - 12, 12, 12), @bitmap, SRC_RECT)
    end
    #---------------------------------------------------------------------------
    # * Dispose
    #---------------------------------------------------------------------------
    def dispose
      bitmap.dispose
      @disposed = true
    end
    #---------------------------------------------------------------------------
    # * Disposed?
    #---------------------------------------------------------------------------
    def disposed?
      @disposed
    end
  end # MM_Icon
#===============================================================================
end # module Nap

 

I aprecciate your help :D

Share this post


Link to post
Share on other sites
54 minutes ago, PhoenixSoul said:

Ninjamida made this jukebox script, and I love it, but there's one thing I really would love if I knew how to pull it off...

Pitch and Volume settings. As is, if I wanted to have the selected sound file play back at the pitch/volume settings I have it set to, I'd have to edit the sound file and change a bunch of other things because, well...

I mean, I could maybe try to set up some kind of variable like use 'vol' for volume and 'pit' for pitch, but then I'd have to set those up and I'm not quite sure how to do so...

The other alternative is to simply set all music and sound to have default pitch and volume, but since I already use Yanfly's System Options, default volume already doesn't match up with the default volume settings of Yanfly's script...

 

Normally the game uses RPG::AudioFile subclasses (like RPG::BGM) to hold data about volume and pitch, and those classes call the Audio module to play themselves. The way Yanfly's system options volume settings work is to adjust the volume automatically as the RPG::AudioFile subclasses play themselves, but the jukebox script just uses the Audio module directly so it completely bypasses yanfly's script actually... May look into it more later.

 

16 minutes ago, Chucksaint said:

Luckily the script already has that 3 sprites that simulate what you mention.

I did as you said and created the images but I can't seem to make it work..

The script is divided in 3 parts, but I'm pretty sure that is the second part, Iv'e already tried @map_img.blend_type = 1

I aprecciate your help :D

 

How isn't it working? The tricky bit is step 2, because you can't just create a sprite for that mask. Instead you have to draw it on top of the map's bitmap (or a copy of the map's bitmap). It won't work otherwise. Remember Bitmaps and Sprites are different things! A Bitmap is the image you want to draw, a Sprite is where and how the game should draw it. I will have to look over that script in detail later I think.

Edited by Kayzee

Share this post


Link to post
Share on other sites
2 hours ago, Kayzee said:

 

Normally the game uses RPG::AudioFile subclasses (like RPG::BGM) to hold data about volume and pitch, and those classes call the Audio module to play themselves. The way Yanfly's system options volume settings work is to adjust the volume automatically as the RPG::AudioFile subclasses play themselves, but the jukebox script just uses the Audio module directly so it completely bypasses yanfly's script actually... May look into it more later.

 

 

How isn't it working? The tricky bit is step 2, because you can't just create a sprite for that mask. Instead you have to draw it on top of the map's bitmap (or a copy of the map's bitmap). It won't work otherwise. Remember Bitmaps and Sprites are different things! A Bitmap is the image you want to draw, a Sprite is where and how the game should draw it. I will have to look over that script in detail later I think.

I must be doing something wrong of course -.-

Thank you for your help :D :D

Share this post


Link to post
Share on other sites
On 8/16/2019 at 2:38 PM, Kayzee said:

Hehe, I like to help people when I can! :3 *sprinkles fairy dust on you*

HI there, sorry did you have any luck? 
I've managed to blend the images as you said, but never full transparency D:

 

Share this post


Link to post
Share on other sites

Hmmm... Think you could send me a widdle example project of that script via PM or something? Like I said, all the links I found are broken and I would like to see how a working setup for that script works with the needed images and all.

Share this post


Link to post
Share on other sites
5 minutes ago, Kayzee said:

Hmmm... Think you could send me a widdle example project of that script via PM or something? Like I said, all the links I found are broken and I would like to see how a working setup for that script works with the needed images and all.

Sure, thank youu ^^

Share this post


Link to post
Share on other sites

Oh darn... I was just looking at the minimap script you sent me and it seems it probobly won't work with my way of doing masks after all. :(

 

Well not unless the whole thing is redone anyway. It's possible to make a map script that does the mask effect, but it would probably need to be a whole new script. I somehow thought the script was simpler then it actually is. I thought it mostly just loaded a bitmap image and displayed it, but it also has a bunch of other sprites and stuff so, yeah. My mask trick is really really limited sometimes, but it's the only way I know of to do masks with RGSS...

Edited by Kayzee

Share this post


Link to post
Share on other sites

So, what I wanted to do with the jukebox script was...

filename, name of file, volume, pitch (only the first two are currently available for customization)

 

That way, if the pitch or volume of any sound is altered in game and the script picks that up, it will pick it up with those settings rather than the default.

Share this post


Link to post
Share on other sites

I still need to really look into that script, or make my own version. I was planning on having a jukebox thing somewhere in my game anyway, so it's on my todo list for sure. Though are you just planning on having a big list of pitches for each track?

Share this post


Link to post
Share on other sites

@Kayzee Not exactly, no. The point is that if I set the title screen music to 110% pitch, it won't reflect this in the script as it is.

The fix, I call future-proofing, to the end user/player, immersion enhancing.

 

I figured that using a pair of variables rather than fixed numbers in place of volume and pitch would be all this needs, but not quite sure how to go about defining them, hence, why I asked in the first place. Of course, might it be necessary to do more than just that, then it's good that I am asking.

Share this post


Link to post
Share on other sites

Sure I guess if you assumed each bit of music and/or sound would always be played with one and only one pitch, but you know what they say about assuming things right? :P

See, here is the thing: The volume and pitch setting can be set differently every time the song is played, and are kinda intended as special effects. I suppose it could create a new jukebox track for each track/pitch combo it encountered, but what would it call them? The other way is to have a giant cumbersome list of what the correct pitches are for each track to play at. None of these solutions are very satisfactory.

 

Though there is a pretty simple way to solve this problem... One which requires no scripting what so ever! Just get Audacity (which you probobly already have anyway) and use the Change Speed effect to make all the tracks sound just the way you want them to normally sound. You can set the volume and do other things too! It makes everything so much simpler that way I think. :3

 

All that being said, it might be neat to have a volume and pitch slider for the jukebox that can be used to play tracks in different ways, just for fun.

Edited by Kayzee

Share this post


Link to post
Share on other sites

RE: Audacity:

One massive issue. That works fine if there are no loop points to consider (by the way I SUCK AT THIS ALREADY and have to guess a lot or use a calculator tool), but for most files, they have set loopstart and looplength values that will require adjusting after the changes are made, and honestly, that in itself is not ideal, since it also means that the game WILL TAKE UP MORE SPACE, and um, that I will pass on. Anyway, the slider thing you mentioned would be neat, sure, but if I'm going to have to make the workload more of a burden I'd rather use a drab menu with each selection and use Hime's Choice Options for managing that. Of course, that's sloppy, but, that's me going at this with my limited capabilities.

 

By the way, I don't even know how to change where choice menus appear on the fly, so double drab emphasis.

Share this post


Link to post
Share on other sites

Actually it's pretty easy in audacity to find loop point numbers, you just need to set the selection position display to do "start and length of selection" and to display in samples, but yeah it's still a bit of a pain in the ass. I find that I actually don't actually have to use them very often, but I make my own music for my game and a lot of my music is structured to avoid loop points. Of course, you could just change the sound file's sampling rate which would change the pitch without changing the loop points or the file size, but I don't think audacity really has that option. I think you can use the Change Speed effect and then resample but I am not sure about the math on that and I am not sure I trust how exact it would be.

 

But if you are just going to use one pitch per sound file anyway, I think I will try and mode the jukebox for you anyway sometime soon, and just have it remember the v volume/pitch settings of the first time it's played. Don't think this is a good general solution though.

 

The other option I guess would maybe be to put the pitch change you want in the .OGG metadata and figure out how to read .OGG metadata in ruby.

 

 

Edited by Kayzee

Share this post


Link to post
Share on other sites
On 8/19/2019 at 11:20 PM, Kayzee said:

Oh darn... I was just looking at the minimap script you sent me and it seems it probobly won't work with my way of doing masks after all. :(

 

Well not unless the whole thing is redone anyway. It's possible to make a map script that does the mask effect, but it would probably need to be a whole new script. I somehow thought the script was simpler then it actually is. I thought it mostly just loaded a bitmap image and displayed it, but it also has a bunch of other sprites and stuff so, yeah. My mask trick is really really limited sometimes, but it's the only way I know of to do masks with RGSS...

That's alright. thanks anyway, I'll use the squared one.

No worries ^^

 

Meanwhile.... I have some other questions... sorry for hijacking (:´D)

 

EDIT: I've managed to do this one width the help of AMN DQ Battle Addon script and some editing ^^

 

I've created my own window in Scene_Battle to appear when Skill_list is opened.

In that window I've managed to display current in action actor HP/MP when I'm selecting skills..

But I wanted to display MP_Cost when the cursor is on skill.

 

(see image bellow for future reference) 

Quote

ex1.png.183956caa7e64b077458a62981dbefc5.png

 

Alsooooo,

 

Is there any way to make Critical Hits animation depending on the weapon ? 

If I remember right, some years ago when I started my first project there was one, I think it was named Golden Sun Critical hits or something related to Golden Sun, but, sadly is gone.

 

For reference:

- If Emerald Sword is equipped then Critical Hit animation is Flash.

- if current weapon is Daggers of doom  then the critical Hit animation is Meteor.

 

Thank youuu ~~

Edited by Chucksaint
Solved 1 of 2

Share this post


Link to post
Share on other sites
9 hours ago, Kayzee said:

Of course, you could just change the sound file's sampling rate which would change the pitch without changing the loop points or the file size, but I don't think audacity really has that option.


Yes, yes it most certainly does.

 

"Back when we were ripping the song files from the Wii discs, the only way to get decent sounding rips was to put them through Audacity, and after we did a f*ck ton of work, we upped their frequency to 48k. The end result is better than what it sounded like on the Wii, but it was also very loud."



I'm sure that quote block isn't going to appear properly, but whatever. Since I quoted a user from the Frets on Fire Fan Forums, it's not like they're gonna know I did...

 

9 hours ago, Kayzee said:

...you just need to set the selection position display to do "start and length of selection" and to display in samples...


I've found that even samples are imprecise. I've done lots of work in Audacity (it's how I have the original versions of many songs thanks to the individual quoted above), so I've had to try my best to get certain things in order, often times having to actually run with fragments of imprecision.

One major example of this is me combining the stems for TTFAF from three different sources: Guitar Hero III, Guitar Hero Smash Hits, and Rock Band 3 DLC. All three sets have different offsets that I did not completely sync accurately, but to most people, it doesn't sound off-sync. Of course, this is going off-topic now, so back onto the topic at hand.
 

 

4 hours ago, Chucksaint said:

Golden Sun Critical hits or something related to Golden Sun

 

I'll look in the repositories I have, see if it is there.

 

Share this post


Link to post
Share on other sites
21 hours ago, PhoenixSoul said:

Yes, yes it most certainly does. 

 

I mean I wasn't sure if you could changing the sample rate without resampling, but looks like you can from a track's little pull down menu! Neat! I think just changing the sample rate and the project sample rate will make it basically use the same data, so the loop points would still be valid and it won't take up more space.

 

21 hours ago, PhoenixSoul said:

I've found that even samples are imprecise. I've done lots of work in Audacity (it's how I have the original versions of many songs thanks to the individual quoted above), so I've had to try my best to get certain things in order, often times having to actually run with fragments of imprecision.

One major example of this is me combining the stems for TTFAF from three different sources: Guitar Hero III, Guitar Hero Smash Hits, and Rock Band 3 DLC. All three sets have different offsets that I did not completely sync accurately, but to most people, it doesn't sound off-sync. Of course, this is going off-topic now, so back onto the topic at hand.

 

Well how precise samples are depends on the sound file's sampling rate you know and you can always resample to a higher sampling rate, but I don't think not having enough precision Is really the problem very often. The problem I have most often is just finding the exact right loop points.

Share this post


Link to post
Share on other sites

@Chucksaint I don't even know if there was ever such a script, or if there was, who authored it. Therefore, I have no way of knowing if it exists in the (rather large) script repository I have.

@Kayzee It's still a lot of guesswork. That said, it was not something I was looking to do, especially since not everyone will have the same level of ability when using software. I wanted to add the features to the script for everyone else to use, not just me. However, I'm pretty sure this is a dead pursuit. Anyway, thanks for the advice.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×