#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Visual Equipment for Blizz-ABS by Blizzard
# Version: 1.0
# Type: Blizz-ABS Add-on
# Date: 1.2.2010
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This script is to be distributed under the same terms and conditions like
# the script it was created for: Blizz-ABS.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Information:
#
# This script must be placed below Blizz-ABS and requires Blizz-ABS v2.57 or
# higher to work properly. It will display equipment on the map. All sprites
# are placed in the Graphics/Characters folder. Also keep in mind that using
# this script can cause additional lag due to additional sprite display.
#
#
# Configuration:
#
# EXCLUDE_WEAPONS - weapons that should not be drawn
# EXCLUDE_ARMORS - armors that should not be drawn
# DRAW_ORDER - drawing order from first to last sprite (0 for weapon;
# 1, 2, 3 and 4 for armor kinds)
# PREFIX_WEAPON - prefix for each spriteset file for weapons (can include
# a full path)
# PREFIX_ARMOR - prefix for each spriteset file for armors (can include
# a full path)
# ACTOR_UNIQUE - allows separate equipment files for every single actor
#
#
# Notes:
#
# - The default file naming convention is:
#
# WPREFIX + WID - weapon files
# APREFIX + AID - armor files
# WPREFIX + WID + SUFFIX - weapon action files
# APREFIX + AID + SUFFIX - armor action files
#
# WPREFIX - by default "Equipment/w", but it can be changed
# APREFIX - by default "Equipment/a", but it can be changed
# WID - weapon ID
# AID - armor ID
# SUFFIX - action suffix (i.e. _atk1, _skl, etc.)
#
# examples:
#
# Equipment/w3.png - weapon ID 3
# Equipment/a41.png - armor ID 41
# Equipment/w1_atk1.png - weapon ID 1, attack type 1
# Equipment/a76_skl.png - armor ID 1, skill use
#
# If you are using the ACTOR_UNIQUE option, then the naming convention are:
#
# WPREFIX + BID + SEPARATOR + WID - weapon files
# APREFIX + BID + SEPARATOR + AID - armor files
# WPREFIX + BID + SEPARATOR + WID + SUFFIX - weapon action files
# APREFIX + BID + SEPARATOR + AID + SUFFIX - armor action files
#
# BID - actor ID
# SEPARATOR - the character _ (underscore)
#
# examples:
#
# Equipment/w4_2.png - actor ID 4, weapon ID 2
# Equipment/a1_22.png - actor ID 1, armor ID 22
# Equipment/w77_7_def.png - actor ID 77, weapon ID 7, defending
# Equipment/a3_8_atk5.png - actor ID 3, armor ID 8, attack type 5
#
# The default prefixes can be changed in the configuration, but the other
# parts are fixed.
#
# - If you are not using the ACTOR_UNIQUE option and Blizz-ABS's action
# animation frames other than the default, you have to adjust the action
# animation frames. In this case all actors will use the same equipment
# files for display and the files' frame number has to match the animation
# frames number for every actor which also means that all actors need to
# have the same number of action sprites for the various actions. i.e. All
# actors have to have the same number of frames for attack type 1, the same
# number of frames for attack type 2, the same number of frames for skill
# use, the same number of frames for defending, etc.
#
# - Keep in mind that the dimensions of the spriteset and the equipment
# sprite should match. i.e. If the actor spriteset is 192x192 pixels, then
# the equipment for that sprite has to be 192x192 pixels as well. If you
# have actors that use different spritesets among each other
#
# - You can disable / enable Visual Equipment for specific characters by
# using a Call Script event command with the following code:
#
# $game_actors[ID].visual_equipment = true/false
# $game_party.actors[POS].visual_equipment = true/false
#
# ID - the actor's ID in the database
# POS - the actor's position in the party (STARTS FROM 0, not 1!)
#
# - You can disable / enable Visual Equipment globally by using a Call Script
# event command with the following code:
#
# $game_system.visual_equipment = true/false
#
#
# If you find any bugs, please report them here:
#
http://forum.chaos-project.com#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
if !$BlizzABS || BlizzABS::VERSION < 2.57
raise 'ERROR: The "Visual Equipment" plugin requires Blizz-ABS 2.57 or higher.'
end
#==============================================================================
# module BlizzCFG
#==============================================================================
module BlizzCFG
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
EXCLUDE_WEAPONS = [1, 25, 33]
EXCLUDE_ARMORS = [46]
DRAW_ORDER = [1, 0, 2, 3, 4]
PREFIX_WEAPON = 'Equipment.w'
PREFIX_ARMOR = 'Equipment.a'
ACTOR_UNIQUE = false
def
self.equipment_offset(character_name)
case character_name
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Equipment Sprite Offset
#
# Here you can define the equipment Y offset in pixels. This can be used
# to adjust the equipment sprites' position for smaller or tall
# character spritesets. Configure which spritesets have an offset:
#
# when NAME then return OFFSET
#
# NAME - spriteset name
# OFFSET - offset in pixels
#
# Make sure you don't mispell the filenames.
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
when '011-Lancer03' then return -1
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Equipment Sprite Offset
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
end
return 0
end
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
$blizzabs_visual_equipment = 1.0
end
#==============================================================================
# Game_System
#==============================================================================
class Game_System
attr_accessor :visual_equipment
alias init_blizzabsve_later initialize
def initialize
init_blizzabsve_later
@visual_equipment = true
end
end
#==============================================================================
# Game_Actor
#==============================================================================
class Game_Actor
attr_accessor :visual_equipment
alias init_blizzabsve_later initialize
def initialize(actor_id)
init_blizzabsve_later(actor_id)
@visual_equipment = true
end
def weapons
return (self.weapon_ids - BlizzCFG::EXCLUDE_WEAPONS -
- ) if defined?(G7_MS_MOD)
return ([@weapon_id] - BlizzCFG::EXCLUDE_WEAPONS - - )
end
def armors
return (self.armor_ids - BlizzCFG::EXCLUDE_ARMORS - - ) if defined?(G7_MS_MOD)
return ([@armor1_id, @armor2_id, @armor3_id, @armor4_id] -
BlizzCFG::EXCLUDE_ARMORS - - )
end
end
#==============================================================================
# Sprite_CharacterEquipment
#==============================================================================
class Sprite_CharacterEquipment < RPG::Sprite
def initialize(viewport, character)
super(viewport)
@character = character
update
end
def update
super
weapons = @character.battler.weapons
armors = @character.battler.armors
if @weapons != weapons || @armors != armors ||
@character_name != @character.character_name
@weapons = weapons
@armors = armors
@character_name = @character.character_name
self.create_bitmap
@cw = self.bitmap.width / @character.pattern_size
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
self.src_rect.x = @character.pattern * @cw
self.src_rect.width = @cw
end
self.visible = !@character.transparent
sx = @character.pattern * @cw
sy = (@character.direction - 2) / 2 * @ch
self.src_rect.set(sx, sy, @cw, @ch)
self.x = @character.screen_x
self.y = @character.screen_y
self.z = @character.screen_z(@ch)
self.opacity = @character.opacity
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
end
def create_bitmap
self.bitmap.dispose if self.bitmap != nil
bitmap = RPG::Cache.character(@character_name, 0)
self.bitmap = Bitmap.new(bitmap.width, bitmap.height)
equipment = []
a_id = (BlizzCFG::ACTOR_UNIQUE ? "#{@character.battler.id}_" : '')
BlizzCFG::DRAW_ORDER.each {|index|
if index == 0
@weapons.each {|id|
equipment.push("#{BlizzCFG::PREFIX_WEAPON}#{a_id}#{id}")}
else
@armors.each {|id|
if $data_armors[id].kind == index
equipment.push("#{BlizzCFG::PREFIX_ARMOR}#{a_id}#{id}")
end}
end}
sprite_name = @character.character_name.sub(
@character.character_name_org) {''}
y = BlizzCFG.equipment_offset(@character.character_name_org)
equipment.each {|name|
b = RPG::Cache.character("#{name}#{sprite_name}", 0)
self.bitmap.blt(0, y, b, Rect.new(0, 0, b.width, b.height))}
end
end
#==============================================================================
# Control_Sprite_Character
#==============================================================================
class Control_Sprite_Character
alias update_blizzabsve_later update
def update
update_blizzabsve_later
return if !@character.is_a?(Map_Actor)
if $game_system.visual_equipment && @character.valid? &&
@character.battler.visual_equipment && @sprite != nil &&
(@character.battler.weapons.size > 0 ||
@character.battler.armors.size > 0)
if @equipment == nil
@equipment = Sprite_CharacterEquipment.new(@viewport, @character)
else
@equipment.update
end
elsif @equipment != nil
@equipment.dispose if !@equipment.disposed?
@equipment = nil
end
end
alias dispose_blizzabsve_later dispose
def dispose
dispose_blizzabsve_later
@equipment.dispose unless @equipment == nil || @equipment.disposed?
@equipment = nil
end
end