Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Jaiden

1
I don't post here (or many forums) often, but I've updated the main post to support all of the changes I've done since my last update!

You can also read a devlog about it here: https://studioalemni.itch.io/legends-of-astravia/devlog/135301/battle-improvements-intro-cutscene-more
2
RMXP Script Database / [XP] Extra Fogs & Panorama Lock
October 22, 2019, 01:27:01 pm
Extra Fogs & Panorama Lock
Authors: Jaiden
Version: 1.0
Type: Mapping Enhancement
Key Term: Environment Add-on

Introduction

This is a script that I've used to enhance XP's mapping even further. It allows for an additional fog that is exclusive to the map ID instead of the tileset, plus an additional two fogs: one drawn as a "lightmap" to add lighting effects and one drawn as a "parallax" (like RMVXA's parallax mapping) to add additional little details to the map like vegetation, etc.

Lastly, there is an option to lock the panorama (background image) of a map so it can also be used as a ground layer, effectively giving you two more layers to work with if you know how to drive it.

I've included a demo to help solidify the concept a bit. Note that you will still need to understand how to make parallaxes and lightmaps in GIMP/Photoshop. There are lots of tutorials on this--this script just makes it much easier to apply them.

Features

  • Allows for an additional fog, which is per map instead of per tileset
  • Allows a panorama to lock so it doesn't scroll, allowing it to be used as a ground layer
  • Designated fog for parallax/detail mapping
  • Designated fog for lighting overlay

Screenshots

Nothing to show here, just try the demo if you'd like.

Demo

https://drive.google.com/open?id=1z6Xas94VmIQca1KVA1T_BbLssb_C3l4w

Script

Place this script above main just as you would any other custom script.
Spoiler: ShowHide

#==============================================================================
# Extra Fogs & Panorama Lock
# - - -
# By Jaiden (RPGmaker.net / rpgmakerweb.com)
# (Twitter: @studioalemni)
# v1.0 - September 2019
# * Allows for an additional fog, which is per map instead of per tileset
# * Allows a panorama to lock so it doesn't scroll, allowing it to be used
#  as a ground layer
#  (Thanks to Game_Guy from www.chaos-project.com for help on this)
# * Designated fog for parallax/detail mapping
# * Designated fog for lighting overlay
#
# [[Compatibility]]
# This script aliases the Spriteset_Map class. Place it above main
# like any other custom script.
# It hasn't been extensively tested, but should otherwise play nicely
# with other map scripts.
#
# [[How to Use]]
# The "fogs" folder should contains two subfolders:
# /Fogs/Lightmaps
# /Fogs/Parallax
#
# In these folders, place a file named "Map[MAPID]", such as "Map002.png"
# If the file is detected, it will be applied to the map.
#
# ***NOTE: In order to get the desired effect, these files MUST be the same size
# as the map they're applied to. If they are not, the panorama/lights will not
# match up with the tilemap / player.
#
# Lightmaps will always have subtractive blending, and "parallax" will always
# be drawn above the ground layer but below the player. This means the player
# can always walk over items in the parallax, and is best reserved for things
# like vegetation, etc.
#
#==============================================================================
module CustomFogsPanorama
  def self.fogs(map_id)
    case map_id
    #==============================================================================
    #
    # BEGIN CONFIGURATION
    #
    # When a fog is specified here, it will be drawn in addition to the
    # already existing map fog.
    #
    # Configuration values are identical to that of the editor.
    # Please follow the format exactly, and do not modify the "else"
    # or the lines below it. Mind your commas!
   
    # when MAPID then ["Name", Zoom_x (%), Zoom_y (%), Opacity (0-255), Blend (0:norm, 1:add, 2:sub), Tone.new(r,g,b), scroll x, scroll y]
      when 1 then ["003-Shade01", 100, 100, 50, 2, Tone.new(0,0,0), -1, 5]
    # when 2 then ["Fog Name", 100, 100, 255, 2, Tone.new(0,0,0), 0, 0]
   
    #
    #---- End Extra Fog Config -------------------------------------------------
    else
      [""]
    end
  end
  #--------------------------------------------------------------------------
  # * Lock Panorama
  #
  # Specify a list of map IDs that will stop the panorama from scrolling
  # Separated by commas: [ID, ID, ID]
  #
  LOCK_PANORAMA_IDS = [2]
#
# END CONFIGURATION
# (Do not modify below this line unless you know what you're doing!)
#
#==============================================================================
end


class Game_Map
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :parallax_lock
  attr_accessor :fog2_ox
  attr_accessor :fog2_oy
  #--------------------------------------------------------------------------
  # * Setup
  #    map_id : map ID
  #--------------------------------------------------------------------------
  alias jaiden_parallax_map_setup setup
  def setup(map_id)
    # Call original
    jaiden_parallax_map_setup(map_id)
    # Initialize fog variables
    @fog2_ox = 0
    @fog2_oy = 0
    # Get fog sx/sy
    @fog2 = CustomFogsPanorama.fogs(@map_id)
    @fog2_sx = @fog2[6]
    @fog2_sy = @fog2[7]
    # Check if map_id includes parallax
    if CustomFogsPanorama::LOCK_PANORAMA_IDS.include?(@map_id)
      @parallax_lock = true
    else
      @parallax_lock = false
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias jaiden_second_fog_update update
  def update
    # Call original / aliases
    jaiden_second_fog_update
    # Manage fog scrolling
    if @fog2[0] != ""
      @fog2_ox -= @fog2_sx / 8.0
      @fog2_oy -= @fog2_sy / 8.0
    end
  end
end

class Spriteset_Map
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  alias jaiden_lights_initialize_spritemap initialize
  def initialize
    # Call original
    jaiden_lights_initialize_spritemap
    # Reassign fog plane if a custom one is assigned
    second_fog = CustomFogsPanorama.fogs($game_map.map_id)
    if second_fog[0] != ""
      @fog2 = Plane.new(@viewport1)
      @fog2.bitmap = RPG::Cache.fog(second_fog[0], 0)
      @fog2.zoom_x = second_fog[1] / 100.0
      @fog2.zoom_y = second_fog[2] / 100.0
      @fog2.opacity = second_fog[3]
      @fog2.blend_type = second_fog[4]
      @fog2.tone = second_fog[5]
      @fog2.z = 3500
    end
    # Create parallax (unlike panorama, this overlays the map and should always = map size)
    if FileTest.exist?("Graphics/Fogs/Parallax/Map#{$game_map.map_id}.png")
      @parallax = Plane.new(@viewport1)
      @parallax.bitmap = RPG::Cache.fog("/Parallax/Map#{$game_map.map_id}", 0)
      @parallax.blend_type = 0 # Normal blending
      @parallax.opacity = 255
      @parallax.ox = $game_map.display_x / 4
      @parallax.oy = $game_map.display_y / 4
    end
    # Create lightmap (above everything else)
    if FileTest.exist?("Graphics/Fogs/Lightmaps/Map#{$game_map.map_id}.png")
      @lightmap = Plane.new(@viewport1)
      @lightmap.z = 4000 
      @lightmap.bitmap = RPG::Cache.fog("/Lightmaps/Map#{$game_map.map_id}", 0)
      @lightmap.blend_type = 2 # Subtractive blending
      @lightmap.opacity = 255
      @lightmap.ox = $game_map.display_x / 4
      @lightmap.oy = $game_map.display_y / 4
    end
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  alias jaiden_lights_dispose_spritemap dispose
  def dispose
    @fog2.dispose if @fog2
    @parallax.dispose if @parallax
    @lightmap.dispose if @lightmap
    # Call original
    jaiden_lights_dispose_spritemap
  end 
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  alias jaiden_lights_spriteset_update update
  def update
    # Update second fog
    if @fog2
      @fog2.ox = $game_map.display_x / 4 + $game_map.fog2_ox
      @fog2.oy = $game_map.display_y / 4 + $game_map.fog2_oy
    end
    # Update parallax
    if @parallax
      @parallax.ox = $game_map.display_x / 4
      @parallax.oy = $game_map.display_y / 4
    end
    # Update lightmap
    if @lightmap
      @lightmap.ox = $game_map.display_x / 4
      @lightmap.oy = $game_map.display_y / 4
    end
    # Call original / aliased methods
    jaiden_lights_spriteset_update
    # Check for locked parallax
    if $game_map.parallax_lock
      @panorama.ox = $game_map.display_x / 4
      @panorama.oy = $game_map.display_y / 4
    else
      @panorama.ox = $game_map.display_x / 8
      @panorama.oy = $game_map.display_y / 8
    end
  end
end


Instructions

Please see the script for instructions, or check out the demo.

Compatibility

This script aliases the Spriteset_Map class. Place it above main like any other custom script.
It hasn't been extensively tested, but should otherwise play nicely with other map scripts.

Credits and Thanks

  • Game_Guy (for helping with the parallax lock)

Author's Notes

Feel free to let me know if there are any bugs. Commercial use is OK, but I would really appreciate it if you credited me (and showed me what kind of awesome game you're making with it!)

I made this script specifically for use in my game Legends of Astravia. Consider supporting it if you were happy with this script!
3
First, stick this in a blank script above the two I sent you:

Spoiler: ShowHide

alias old_rand rand
def rand(max = 0)
  if max.is_a?(Range)
    diff = max.last - max.first + (max.exclude_end? ? 0 : 1)
    old_rand(diff) + max.first
  else
    old_rand(max)
  end
end


And I've edited my original post, so update the scripts with those.
4
Alright, took a crack at it. Range config is a little bit ugly, but it should do the job.

I can't test it, so let me know how it works out:

Regular
Spoiler: ShowHide

#==============================================================================
# Job-based Level Up Stats                                            Ver 1.0
# By KK20                                                             Dec 14 18
#------------------------------------------------------------------------------
# Purpose:
#  Allows actors to gain bonus stats based on their class/job upon leveling up.
#  For example, a Warrior gains more STR and Max HP while Mages gain more INT
#  and Max MP.
#
# Instructions:
#  Place below default scripts but above Main (the usual). The lower the better.
#  Configure the stat bonuses below (instructions provided there).
#
#==============================================================================
module JobLevelUp
  def self.level_up_stats(id)
    case id
    #-------------------------------------------------------------------------
    # Configure:
    #
    #   when CLASS_ID
    #     [MAX_HP, MAX_SP, STR, DEX, AGI, INT]
    #
    # where CLASS_ID is the database index of the class and each range in the
    # array indicates a random value in which the stat will increase per level up.
    #
    # When a single integer is used, it will select between 1 and the value selected
    # Otherwise, use a range. For example:
    # [2..5, 3, 5..7, 4, 8, 3..10]
    # On level up, they'll get between 2 and 5 HP points, 1 and 3 SP points...etc.
    #-------------------------------------------------------------------------
    #  MAX_HP   MAX_SP   STR      DEX      AGI      INT
    # [low..hi, low..hi, low..hi, low..hi, low..hi, low..hi]
    # If a low value is ommited, selects a value between
    when 1 # Fighter
      [2..7, 2, 3..5, 2..6, 3..8, 2]
    when 2 # Lancer
      [8, 3, 4, 3, 2, 3]
    when 3 # Warrior
      [10, 1, 7, 1, 4, 1]
    when 4 # Thief
      [4, 3, 2, 6, 6, 4]
    else # Classes not defined will use this default value
      [5, 5, 5, 5, 5, 5]
    end
  end
end

class Game_Actor
  alias job_level_up_stats_level level=
  def level=(val)
    start_level = @level
    job_level_up_stats_level(val)
    level_difference = @level - start_level
   
    stat_array = JobLevelUp.level_up_stats(self.class_id)
    level_difference.times {
        self.maxhp += stat_array[0].is_a?(Range) ? rand(stat_array[0]) : stat_array[0]
        self.maxsp += stat_array[1].is_a?(Range) ? rand(stat_array[1]) : stat_array[1]
        self.str   += stat_array[2].is_a?(Range) ? rand(stat_array[2]) : stat_array[2]
        self.dex   += stat_array[3].is_a?(Range) ? rand(stat_array[3]) : stat_array[3]
        self.agi   += stat_array[4].is_a?(Range) ? rand(stat_array[4]) : stat_array[4]
        self.int   += stat_array[5].is_a?(Range) ? rand(stat_array[5]) : stat_array[5]
    }
  end
 
  alias job_level_up_stats_exp exp=
  def exp=(val)
    start_level = @level
    job_level_up_stats_exp(val)
    level_difference = @level - start_level
   
    stat_array = JobLevelUp.level_up_stats(self.class_id)
    level_difference.times {
        self.maxhp += stat_array[0].is_a?(Range) ? rand(stat_array[0]) : stat_array[0]
        self.maxsp += stat_array[1].is_a?(Range) ? rand(stat_array[1]) : stat_array[1]
        self.str   += stat_array[2].is_a?(Range) ? rand(stat_array[2]) : stat_array[2]
        self.dex   += stat_array[3].is_a?(Range) ? rand(stat_array[3]) : stat_array[3]
        self.agi   += stat_array[4].is_a?(Range) ? rand(stat_array[4]) : stat_array[4]
        self.int   += stat_array[5].is_a?(Range) ? rand(stat_array[5]) : stat_array[5]
    }
  end
end


RO Edit
Spoiler: ShowHide

#==============================================================================
# Job-based Level Up Stats (RO Edit)                                    Ver 1.0
# By KK20                                                             Jul 10 19
#------------------------------------------------------------------------------
# Purpose:
#  Allows actors to gain bonus stats based on their class/job upon leveling up.
#  For example, a Warrior gains more STR and Max HP while Mages gain more INT
#  and Max MP.
#
# Instructions:
#  Place below default scripts but above Main (the usual). The lower the better.
#  Place below RO Job/Skill System.
#  Configure the stat bonuses below (instructions provided there).
#
#==============================================================================
module JobLevelUp
  def self.level_up_stats(id)
    case id
    #-------------------------------------------------------------------------
    # Configure:
    #
    #   when CLASS_ID
    #     [MAX_HP, MAX_SP, STR, DEX, AGI, INT]
    #
    # where CLASS_ID is the database index of the class and each range in the
    # array indicates a random value in which the stat will increase per level up.
    #
    # When a single integer is used, it will select between 1 and the value selected
    # Otherwise, use a range. For example:
    # [2..5, 3, 5..7, 4, 8, 3..10]
    # On level up, they'll get between 2 and 5 HP points, 1 and 3 SP points...etc.
    #-------------------------------------------------------------------------
    #  MAX_HP   MAX_SP   STR      DEX      AGI      INT
    # [low..hi, low..hi, low..hi, low..hi, low..hi, low..hi]
    # If a low value is ommited, selects a value between
    when 1 # Fighter
      [2..7, 2, 3..5, 2..6, 3..8, 2]
    when 2 # Lancer
      [8, 3, 4, 3, 2, 3]
    when 3 # Warrior
      [10, 1, 7, 1, 4, 1]
    when 4 # Thief
      [4, 3, 2, 6, 6, 4]
    else # Classes not defined will use this default value
      [5, 5, 5, 5, 5, 5]
    end
  end
end

class Game_Actor
  def level_up_stat_gain(levels, class_id)
    stat_array = JobLevelUp.level_up_stats(class_id)
    # Perform random selection per level gained
    levels.times {
        self.maxhp += stat_array[0].is_a?(Range) ? rand(stat_array[0]) : stat_array[0]
        self.maxsp += stat_array[1].is_a?(Range) ? rand(stat_array[1]) : stat_array[1]
        self.str   += stat_array[2].is_a?(Range) ? rand(stat_array[2]) : stat_array[2]
        self.dex   += stat_array[3].is_a?(Range) ? rand(stat_array[3]) : stat_array[3]
        self.agi   += stat_array[4].is_a?(Range) ? rand(stat_array[4]) : stat_array[4]
        self.int   += stat_array[5].is_a?(Range) ? rand(stat_array[5]) : stat_array[5]
    }
  end

  #----------------------------------------------------------------------------
  # job_level_change
  #  val  - new level value
  #  id   - class ID
  #  flag - determines whether EXP should be updated or not
  #  This method processes change of a job level.
  #----------------------------------------------------------------------------
  alias get_job_level_change_diff job_level_change
  def job_level_change(val, id = @class_id, flag = true)
    old_level = job_level(id)
    get_job_level_change_diff(val, id, flag)
    level_diff = job_level(id) - old_level
    level_up_stat_gain(level_diff, id)
  end

end



5
How do you want to manage this? Do you want a configuration where you set each actor to get 1-5 points per stat per level?
6
The game has been updated to version 2.3! There are a ton of updates to this new version, check out the full release notes and download the game here! The new demo is about ~3 hours long.
7
Updated to v2.0
Now you can specify what directions the animation displays! Also, KK20 fixed all the bugs and bad logic :)
8
Here are the faces from Pandora's Box, should include at least some of the ones that were in this pack: https://drive.google.com/open?id=1HL8XusXKbqfn-_VeehfyBstAsYm_sHvt
9
Updated it so it can be used in vanilla XP without the save BGM function. Should be OK to put it in the XP DB now.
10
RMXP Script Database / [XP] Audio Extras
February 05, 2019, 12:15:26 pm
Audio Extras
Authors: Jaiden
Version: 1.2
Type: Game System Utility
Key Term: Misc Add-on




Introduction

This script contains a few extra audio functions, and thanks to RPG Maker XP Ace, includes a feature that was only available via RGSS3.

Note that you must have RPG Maker XP Ace installed in order to use the "Pause/Resume BGM" feature of this script.
You can get it here: https://forum.chaos-project.com/index.php/topic,12899.0.html

Otherwise, only the master volume and map volume change features will be available.




Features

  • Ability to pause and resume BGM at the position it was paused [RGSS3/XPA ONLY]

  • Master volume controls for BGM, BGS, and SE

  • Automatic BGM/BGS volume decrease when entering "houses" or any other marked map




Screenshots

Not relevant to the script.


Demo

None at this time.


Script
Spoiler: ShowHide

#==============================================================================
# Audio Extras [+Additional Features with XPA]
# Author: Jaiden
# Version 1.2 - Feb 6th, 2019
#   - Changed the script so it would work in either vanilla RMXP or XPA.
# Version 1.1 - Feb 5th, 2019
#   - Fixed a typo in the directions
#   - Shortened the "change_bgm/bgs/se_volume" methods to "change_bgm/bgs/se_vol"
#     so they would be friendlier with script calls.
# Version 1.0 - Feb 4th, 2019
#   - Initial release
# ---------------------------------------------------------------------------
# This script includes a few small audio features, as well as a special
# functionality to pause and resume an audio track if paired with
# RPG Maker XP Ace.
#
# Features:
# -> Ability to pause and resume an audio track at any point [RGSS3/XPA ONLY]
# -> Decreasing the volume of BGM/BGS when entering / exiting buildings
# -> Master volume for decreasing and increasing all tracks throughout the game
#
# [[NOTE]]
# The pause/resume audio feature is only available through an audio method
# from RGSS3 (RPG Maker XP ACE). Because of this, that feature will only
# work if you are running the RPG Maker XP Ace.
#
# For more information on RPG Maker XP ACE, visit this thread:
# https://forum.chaos-project.com/index.php?topic=12899.0
#
# This script is not intended for use in RPG Maker VX or VXA.
#
# ---------------------------------------------------------------------------
# ** Instructions:
# ---------------------------------------------------------------------------
# [XPA ONLY]
# -> To "Pause" the BGM at the current position, use the following script call:
#
#    AudioExtras.save_bgm
#
# [XPA ONLY]
# -> To "Resume" a saved BGM track, use the following script call:
#
#    AudioExtras.resume_bgm
#
# Note that this function does not support MIDI; they will always resume from the beginning.
# ---------------------------------------------------------------------------
#
# -> To mark a map as "Indoors" and automatically decrease the volume,
#
#    Use the following tag in your maps: [ind]
#
# For example, a map named "[ind]Inside House" will have its volume
# lowered when you enter it. Note that the "[ind]" is automatically removed
# from the map name to avoid conflict with map name display scripts.
#
# Note that when the player moves from the next map without an [ind] tag,
# the volume will increase back to the original level.
#
# -> To disable changing the volume level even when a map is marked [ind],
#
#   Set a switch with the same ID set in the configuration below.
#
# This is useful for cutscenes where you change the audio track, but don't want
# the volume to increase or decrease further when the player changes maps.
#
# ---------------------------------------------------------------------------
# ** Additional Features:
# ---------------------------------------------------------------------------
# This script also gives access to a master volume control, which can be
# used to control the overall game volume, such as via events or a menu.
#
# -> The follow values are responsible for the master volume:
#
#    AudioExtras.bgm_volume
#    AudioExtras.bgs_volume
#    AudioExtras.se_volume
#
# -> You can set the master volume to any value (0 to 100):
#
#    AudioExtras.bgm_volume = VALUE
#    AudioExtras.bgs_volume = VALUE
#    AudioExtras.se_volume = VALUE
#
# -> Conversely, if you would like to INCREMENT/DECREMENT the value (-100 to 100):
#
#    AudioExtras.change_bgm_vol = VALUE
#    AudioExtras.change_bgs_vol = VALUE
#    AudioExtras.change_se_vol = VALUE
#
# This is useful when creating volume controls in-game where you want
# to change the master volume by a set amount.
#
# For example to set the BGM volume to 80%, you would use:
#
#   AudioExtras.bgm_volume = 80
#
# But if you wanted to DECREASE the SE volume by 20%, you would use:
#
#   AudioExtras.change_se = -20
#
#==============================================================================
  module AudioExtras
  # ======================== # BEGIN CONFIGURATION # ========================= 
 
    # Switch ID to disable decreasing the game volume when entering a house
    DISABLE_BGM_CHANGE = 14
 
    # Level (as a percentage) to decrease the volume when going indoors.
    # The default value is 20%
    LEVEL_DECREASE = 20
 
  #
  # = Please do not edit below this line unless you know what you are doing. =
  #
  # ======================== # END CONFIGURATION # ===========================
    # Skip these methods if running RGSS1
    unless defined?(Hangup)
      def self.save_bgm
        # Save the currently playing BGM 
        $game_system.bgm_save if !$game_system.playing_bgm.nil?
      end
     
      def self.resume_bgm
        # Resume the saved BGM
        $game_system.bgm_resume
      end
    end
    # End Skip
 
    def self.bgm_volume
      $game_system.bgm_master_vol
    end
 
    def self.bgs_volume
      $game_system.bgs_master_vol
    end
 
    def self.se_volume
      $game_system.se_master_vol
    end
 
    def self.bgm_volume=(value)
      # Set the master BGM volume
      $game_system.bgm_master_vol = [[value, 0].max, 100].min
      # Set new BGM if playing
      if $game_system.playing_bgm != nil
        $game_system.bgm_play($game_system.playing_bgm)
      end 
    end
   
    def self.bgs_volume=(value)
      # Set the master BGS volume
      $game_system.bgs_master_vol = [[value, 0].max, 100].min
      # Set new BGS if playing
      if $game_system.playing_bgs != nil
        $game_system.bgs_play($game_system.playing_bgs)
      end 
    end
 
    def self.se_volume=(value)
      # Set the master SE volume
      $game_system.se_master_vol = [[value, 0].max, 100].min
    end
 
    def self.change_bgm_vol=(value)
      # Increment / Decrement the BGM volume
      $game_system.bgm_master_vol = $game_system.bgm_master_vol + value
      # Ensure the value isn't higher than 100 or lower than 0
      $game_system.bgm_master_vol = [[$game_system.bgm_master_vol, 0].max, 100].min
      # Set new BGM if playing
      if $game_system.playing_bgm != nil
        $game_system.bgm_play($game_system.playing_bgm)
      end     
    end
 
    def self.change_bgs_vol=(value)
      # Increment / Decrement the BGM volume
      $game_system.bgs_master_vol = $game_system.bgs_master_vol + value
      # Ensure the value isn't higher than 100 or lower than 0
      $game_system.bgs_master_vol = [[$game_system.bgs_master_vol, 0].max, 100].min
      # Set new BGS if playing
      if $game_system.playing_bgs != nil
        $game_system.bgs_play($game_system.playing_bgs)
      end 
    end
 
    def self.change_se_vol=(value)
      # Increment / Decrement the BGM volume
      $game_system.se_master_vol = $game_system.se_master_vol + value
      # Ensure the value isn't higher than 100 or lower than 0
      $game_system.se_master_vol = [[$game_system.se_master_vol, 0].max, 100].min
    end
  end
 
 
  #==============================================================================
  # ** Game_System
  #------------------------------------------------------------------------------
  #  This class handles data surrounding the system. Backround music, etc.
  #  is managed here as well. Refer to "$game_system" for the instance of
  #  this class.
  #==============================================================================
  class Game_System
    #--------------------------------------------------------------------------
    # * Public Instance Variables
    #--------------------------------------------------------------------------
    attr_accessor :bgm_master_vol  # store bgm volume
    attr_accessor :bgs_master_vol  # store sfx volume
    attr_accessor :se_master_vol   # store se volume
    attr_accessor :saved_bgm_vol   # Saves the BGM volume
    attr_accessor :saved_bgs_vol   # Saves the BGS volume
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    alias system_options_jaiden_initialize initialize
    def initialize
      system_options_jaiden_initialize
      # Initialize volume settings
      @bgm_master_vol = 100
      @bgs_master_vol = 100
      @se_master_vol = 100
      @saved_bgm_vol = nil
      @saved_bgs_vol = nil
    end
    #==========================================================================
    # The following methods for playing music and sounds have been REWRITTEN
    #--------------------------------------------------------------------------
    # * Play Background Music
    #--------------------------------------------------------------------------
    def bgm_play(bgm)
      @playing_bgm = bgm
      if bgm != nil and bgm.name != ""
        Audio.bgm_play("Audio/BGM/" + bgm.name, bgm.volume * @bgm_master_vol / 100, bgm.pitch)
      else
        Audio.bgm_stop
      end
      Graphics.frame_reset
    end
    #--------------------------------------------------------------------------
    # * Play Background Sound
    #--------------------------------------------------------------------------
    def bgs_play(bgs)
      @playing_bgs = bgs
      if bgs != nil and bgs.name != ""
        Audio.bgs_play("Audio/BGS/" + bgs.name, bgs.volume * @bgs_master_vol / 100, bgs.pitch)
      else
        Audio.bgs_stop
      end
      Graphics.frame_reset
    end
    #--------------------------------------------------------------------------
    # * Play Music Effect
    #--------------------------------------------------------------------------
    def me_play(me)
      if me != nil and me.name != ""
        Audio.me_play("Audio/ME/" + me.name, me.volume * @se_master_vol / 100, me.pitch)
      else
        Audio.me_stop
      end
      Graphics.frame_reset
    end
    #--------------------------------------------------------------------------
    # * Play Sound Effect
    #     se : sound effect to be played
    #--------------------------------------------------------------------------
    def se_play(se)
      if se != nil and se.name != ""
        Audio.se_play("Audio/SE/" + se.name, se.volume * @se_master_vol / 100, se.pitch)
      end
    end
    # Skip these methods if running RGSS1
    unless defined?(Hangup)
      #--------------------------------------------------------------------------
      # * Memorize BGM
      #--------------------------------------------------------------------------
      def bgm_save
        @memorized_bgm = @playing_bgm
        @position = Audio.bgm_pos
      end
      #--------------------------------------------------------------------------
      # * Resume memorized bgm
      #--------------------------------------------------------------------------
      def bgm_resume
        bgm = @memorized_bgm
        return if @position.nil? || bgm.nil? || bgm.name == ""
        Audio.bgm_play("Audio/BGM/" + bgm.name, bgm.volume * @bgm_master_vol / 100, bgm.pitch, @position)
      end
    end
    # End Skip
  end
 
 
  #==============================================================================
  # ** Game_Map
  #==============================================================================
  class Game_Map
    #--------------------------------------------------------------------------
    # * Public Instance Variables
    #--------------------------------------------------------------------------
    attr_reader    :is_house # Determines if the map is a house
    attr_accessor  :name     # Map name
    #--------------------------------------------------------------------------
    # * Initialize
    #--------------------------------------------------------------------------
    alias jaiden_house_initialize initialize
    def initialize
      jaiden_house_initialize
      @name = ""
    end
    #--------------------------------------------------------------------------
    # * Setup
    #     map_id : map ID
    #--------------------------------------------------------------------------
    alias jaiden_house_setup setup
    def setup(map_id)   
      jaiden_house_setup(map_id)
      # Store the map name
      @name = get_name(map_id)
      # Determine if it's a house, strip the name if it is.=
      @is_house = !self.name.scan(/\[ind\]/i).first.nil?
      self.name.gsub!(/\[ind\]/i, '')
    end
    #--------------------------------------------------------------------------
    # * Get name
    # Get the map name
    #-------------------------------------------------------------------------- 
    def get_name(id = @map_id)
      map_info = load_data("Data/MapInfos.rxdata")
      return map_info[id].name
    end
    #--------------------------------------------------------------------------
    # * Automatically Change Background Music and Backround Sound < needs to move to scene_map
    #--------------------------------------------------------------------------
    def setup_house_bgm
      # If the map is indoors
      if @is_house
        # And we didn't already reduce the volume
        if $game_system.saved_bgm_vol.nil?
          # Save the current volume
          $game_system.saved_bgm_vol = $game_system.bgm_master_vol
          # Decrease the volume
          AudioExtras.change_bgm_vol = -AudioExtras::LEVEL_DECREASE
        end
        if $game_system.saved_bgs_vol.nil?
          # Save the current volume
          $game_system.saved_bgs_vol = $game_system.bgs_master_vol
          # Decrease the volume
          AudioExtras.change_bgs_vol = -AudioExtras::LEVEL_DECREASE
        end
      # If the map is not outdoors
      elsif
        # And there is a saved volume
        unless $game_system.saved_bgm_vol.nil?
          # Set the master volume to the saved volume
          AudioExtras.bgm_volume = $game_system.saved_bgm_vol
          # Clear the saved volume
          $game_system.saved_bgm_vol = nil
        end
        unless $game_system.saved_bgs_vol.nil?
          # Set the master volume to the saved volume
          AudioExtras.bgs_volume = $game_system.saved_bgs_vol
          # Clear the saved volume
          $game_system.saved_bgs_vol = nil
        end
      end
    end
  end
  #==============================================================================
  # ** Scene_Map
  #==============================================================================
  class Scene_Map
    alias jaiden_house_transfer transfer_player
    def transfer_player
      jaiden_house_transfer
      # Check if BGM changing is disabled
      unless $game_switches[AudioExtras::DISABLE_BGM_CHANGE]
        $game_map.setup_house_bgm
      end
    end
  end




Instructions

Install this script above main as you would any other script.

If you create an options menu that controls the master volume, make sure this script is ABOVE that menu.

See the script for directions on how to use this script. Note that the pause and resume function will not work with MIDI (it can be used, but the MIDI will always start from the beginning).


Compatibility

This script makes modifications to the Game_System class, including re-writing the "bgm/bgs/se_play" methods. Use with caution with any other audio scripts.

As noted above, this script has a feature that will only be accessible if used with RPG Maker XP Ace. This is highly recommended.



Credits and Thanks

  • KK20, as always, for helping me make it not-garbage.





Author's Notes
I created this script for my game, Legends of Astravia, but I figured anyone else using XPA would love to have access to these functions.

I may create an options menu that goes along with this at a later time! Let me know if you run into any bugs.
11
Hey Heretic, someone else saw this error in battle when using MMW:


I don't know if you want to update MMW with the fix I posted earlier in the thread, but I figured I'd give you a heads up.
13
You don't need to bump and spam, you know. That's only if a post gets buried under pages of other posts, which simply won't happen here.
Also, it'll be a while before you get a decent response. No one uses VXA here--we're all mostly XP users.

Can you post the whole script, the command you used to add the actor, or a demo? I need more context than that, but I'm guessing you are using an actor that is becoming nil or aren't setting it correctly.
14
Updated to v1.1; fixed a bug where the map wasn't refreshing correctly and the animation wouldn't always display.
15
RMXP Script Database / [XP] "Inspect" Event Animation
October 01, 2018, 11:14:56 pm
"Inspect" Event Animation
Authors: Jaiden, KK20
Version: 2.0
Type: Event Feature
Key Term: Environment Add-on



Introduction

Do you want to indicate that an event can be interacted with using a nifty animation? This is the script for you! Similar to how most games have some sort of a "press to interact" indicator, this script displays an animation when the player is facing events you've marked for "inspection".


Features


  • Easy to select which event / event page to display on

  • Animation displayed is customizable

  • Should be reasonably compatible with most scripts




Screenshots

Gif example using a custom animation:
Spoiler: ShowHide



Demo

(N/A)


Script

Spoiler: ShowHide

#==============================================================================
# Inspect Event
# by Jaiden, KK20 (mostly KK20)
# v2.0 March 2019
# - Added the capability to configure the inspect direction
# - KK20 fixed all that logic 'cuz it was bad
# v1.0 September 2018
# - Initial release
#==============================================================================
# Checks if an event is flagged for "inspection" and displays an
# animation above the player indicating it can be interacted with.
# -----
# This script aliases methods in the following classes:
# * Game_Character
# * Game_Event
# * Game_Map
# * Sprite_Character
# It may not be compatible with other scripts that have heavily
# modified these classes
#==============================================================================
# HOW TO USE THIS SCRIPT
# -----
# Create a comment with the text \inspect_event in the page of
# an event that you want to have display an animaton over the player when
# they are facing it. Then, set the animation ID below.
#
# [Multiple Directions]
# You can also set specific directions that will trigger the animation.
# Assuming the player is 0, imagine the directions like this:
#    8
# 4  0  6
#    2
#
# For example, \inspect_event[4,6] will only display the animation when
# the player is facing the event from the left and right.
# Use \inspect_event[0] to only display when the player is on top of the event.
#
# Specifying no direction will show the animation when the player faces
# the event from any direction.
#==============================================================================
module InspectEvent
  #--------------------------------------------------------------------------
  # Animation ID
  #--------------------------------------------------------------------------
  # Set this value to the ID in your animation database that you want
  # to display to indicate that an event can be inspected
  EVENT_ANIMATION_ID = 120
  #--------------------------------------------------------------------------
end
#==============================================================================
# END CONFIGURATION / DOCUMENTATION
#==============================================================================

#==============================================================================
# ** Game_Character
#==============================================================================
class Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  # inspect_event - flags an event for interation
  # inspect_dir_flags - Array of directions for inspection
  #   0 = Center (animation displays when player is on the event)
  #   4 = Left
  #   8 = Above
  #   6 = Right
  #   2 = Below
  # animation_loop_id - id for a looped animation
  #--------------------------------------------------------------------------
  attr_accessor    :inspect_event
  attr_accessor    :inspect_dir_flags
  attr_accessor    :animation_loop_id
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias inspect_event_initialize initialize
  def initialize
    inspect_event_initialize
    # Flag to determine if an event can be inspected
    @inspect_event = false
    # Array of directions
    @inspect_dir_flags = []
    # ID for looped animations
    @animation_loop_id = 0
  end
end

#==============================================================================
# ** Game_Event
#==============================================================================
class Game_Event
  alias inspect_event_refresh refresh
  def refresh
    prev_page = @page
    # Call original
    inspect_event_refresh
    return if prev_page == @page
    # Initialize flags
    @inspect_event = false
    # Initialize direction array
    @inspect_dir_flags = []
    # Check each list item for a comment
    return if @list.nil?
    @list.each do |cmd|
      # Check if it's a comment
      if cmd.code == 108
        # Set comment
        comment = cmd.parameters[0]
        comment_check = comment.scan(/^\\inspect_event/).flatten[0]
        # Check if the comment contains the string "\inspect_event"
        if comment_check == "\\inspect_event"
          # Flag it
          @inspect_event = true
          # Set directional array
          @inspect_dir_flags = comment.scan(/(\d)+/).flatten
          # Convert to ints
          @inspect_dir_flags.map!{|c| c.to_i}
          break
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Check if player is adjacent to and facing an event
  # directions = an array containing the different directions to register
  # the animation by returning true:
  #    8
  # 4  0  6
  #    2
  #--------------------------------------------------------------------------
  def player_facing?(directions = @inspect_dir_flags)
    # Exit if we're not checking directions
    return false if directions.nil?
    # Initialize variable
    check = false
    # Test each direction
    case $game_player.direction
    when 2 # Facing down
      if directions.include?(8) || directions == [] # Player is above event
        check = (self.y == $game_player.y + 1 && self.x == $game_player.x)
      else
        check = false
      end
    when 4 # Facing left
      if directions.include?(6) || directions == [] # Player is right of event
        check = (self.x == $game_player.x - 1 && self.y == $game_player.y)
      else
        check = false
      end
    when 6 # Facing right
      if directions.include?(4) || directions == [] # Player is left of event
        check = (self.x == $game_player.x + 1 && self.y == $game_player.y)
      else
        check = false
      end
    when 8 # Facing up
      if directions.include?(2) || directions == [] # Player is below event
        check = (self.y == $game_player.y - 1 && self.x == $game_player.x)
      else
        check = false
      end
    end
    # Check for 0 (player on event)
    if directions.include?(0)
      check = (self.y == $game_player.y && self.x == $game_player.x)
    end
    return check
  end
end
#==============================================================================
# ** Game_Map
#==============================================================================
class Game_Map
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias inspect_event_map_update update
  def update
    # Call original
    inspect_event_map_update
    # Call animation method
    inspect_event_anim
  end
  #--------------------------------------------------------------------------
  # * Inspect Event Animation
  #--------------------------------------------------------------------------
  def inspect_event_anim
    if $game_player.moving?
      $game_player.animation_loop_id = 0
      return
    end
   
    @events.values.each do |event|
      next unless event.inspect_event
      next if (event.x - $game_player.x).abs + (event.y - $game_player.y).abs > 1
      if event.player_facing?
        $game_player.animation_loop_id = InspectEvent::EVENT_ANIMATION_ID
        return
      end
    end
    $game_player.animation_loop_id = 0

  end
end

#==============================================================================
# ** Sprite_Character
#==============================================================================
class Sprite_Character
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias inspect_event_character_update update
  def update
    # Call original
    inspect_event_character_update
    # Set loop animation (not if message windows are showing)
    if $game_temp.message_window_showing == true
      loop_animation(nil)
    elsif @character.animation_loop_id != 0
      anim = $data_animations[@character.animation_loop_id]
      loop_animation(anim)
    else
      loop_animation(nil)
    end
  end
end



Instructions

Instructions are in the script, but it is as simple as putting a comment with "\inspect_event" in the event page you want the animation to display on. Note that the default animation used, "EM Exclamation" plays a sound every time it is looped. I suggest creating a new, silent animation and setting its ID in the configuration.


Compatibility

This script aliases the Game_Map, Game_Event, Game_Character and Sprite_Character classes. This will not be compatible with any scripts that heavily re-write those classes.


Credits and Thanks


  • KK20 for helping with 90% of this

  • Everyone else in the Discord server for helping out and/or dealing with my ramblings




Author's Notes

This is my first script. I figured I'd make a contribution back to Chaos Project since this community has been so helpful in my game's development. Hopefully this script treats someone else just as well!

Credit for this script isn't required, but greatly appreciated, with the exception of redistribution. If you post this script elsewhere, please link back to this original post.
17
Quote from: Kise on March 13, 2018, 01:53:30 pm
Script under this link http://downloads.chaos-project.com/scripts/Blizz-ABSEAL.txt and in the demo are identical. They both reduce the boundary within the screen.

I do believe that's the point. You're supposed to get an idea of how it works and then modify the configuration of the script to fit your needs.
18
New Projects / Re: Places to get your game hosted
March 02, 2018, 09:51:49 am
WOW OZZY FIRST POST IS A NECROPOST WAY TO GO FAM

(actually that doesn't matter, I have a forum post for my game and I link to RMN/itch.io to host it)
19
Updated main post--a bit more organized now.
20
Awesome stuff Heretic, I've been using a majority of your scripts from this bundle in my project so far and love them.

Just a heads up, it seems there is a bug when trying to position a message window over an enemy, I was getting "can't convert Fixnum into String" on line 1489, since it was checking for "abcd" first. Looks like a line in the def reposition method:
  
def reposition
    if $game_temp.in_battle
      if "abcd".include?(@float_id) # must be between a and d
        @float_id = @float_id[0] - 97 # a = 0, b = 1, c = 2, d = 3
        if $scene.spriteset.actor_sprites[@float_id] == nil
          @tail.visible = false
          return
        end
        sprite = $scene.spriteset.actor_sprites[@float_id]
      else
        @float_id -= 1 # account for, e.g., player entering 1 for index 0
        if $scene.spriteset.enemy_sprites[@float_id] == nil
          @tail.visible = false
          return
        end
        sprite = $scene.spriteset.enemy_sprites[@float_id]
      end
#def reposition continues below...


The fix was to replace the line:
if "abcd".include?(@float_id) # must be between a and d


with:
if "abcd".include?(@float_id.to_s) # must be between a and d