blinkrocket182
Member
Hey guys, i just installed MOGS Menu's, They look great. But i found a problem when you also have Taryn's Weapon Ammunition script. I have placed The Ammo script below the menu script and all seems to work fine until i select the character. The ammo select window pops up, but when i go to move up or down, it doesn't move the cursor in the ammo box, but the cursor in the item menu. I would like someone to maybe tell me how i can fix this or possibly merge the two scripts. Thanks.
here are the scripts
here are the scripts
Code:
#==============================================================================
# ** Taryn's Weapon Ammunition System
#------------------------------------------------------------------------------
# by DerVVulfman
# version 2.2
# 06-28-2007
# Full SDK 2.2 Compatible (Does not need or require SDK 2.2)
#------------------------------------------------------------------------------
#
# INTRODUCTION:
# This script allows you to create weapons that require ammunition for their
# use. This system makes it a requirement to load/reload your weapon with ammo
# before you can perform an attack, and can play a pre-defined sound effect if
# the weapon in use runs out of available ammunition.
#
# What this system requires is that certain items in your game's database be
# defined in the config section as either 'Clips' or 'Bullets'
#
# A CLIP is an item that is used to reload your weapon during battle. You de-
# fine in the configuration system below, the weapon that uses a certain clip,
# the number of 'rounds' that a clip can hold, and the ammunition ('Bullets')
# that the clip can handle.
#
# BULLETS are the ammunition that your weapon uses, and only one variety of
# bullets may be used at a time for each weapon. They are defined below in the
# configuration system at the same time as the clips that hold them.
#
#------------------------------------------------------------------------------
#
# COMPATABILITY:
# This script was designed based on the architecture of the default, the RTAB
# battle systems, and was heavily 'aliased' in compliance and accordance to the
# SDK systems. As such, this system adjusts certain functions after detecting
# either one of these two systems. However, preliminary tests have confirmed
# its compatability with ParaDog's v 2.58 and XRXS 65 CP system.
#
#------------------------------------------------------------------------------
#
# USAGE:
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# In The Field Menu:
# The Item menu allows weapon users to select 'CLIPS' that are usable for their
# weapon, and bring up a 'CLIP' menu. This menu has but two windows. The top
# window shows the currently selected ammo for the player while the bottom one
# shows the ammunition available for use.
#
# By highlighting and hitting [Select] on the ammunition desired, you load your
# weapon's CLIP with the BULLETS of your choice. This system also unloads all
# of the BULLETS previously loaded in the clip.
#
# The Equip menu has been considered with this system, and the changing of wea-
# pons in this system will unload the CLIP of BULLETS and return them to the
# Party's pool of items.
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# In The Battle Menu:
# The Item menu allows you to load or reload your weapon by selecting and using
# the proper CLIP for your weapon.
#
# While on the FIELD, you get to select the ammo you wish to use,it's in BATTLE
# where you actually load the weapon. When you enter battle after selecting the
# bullets for your clip, the weapon is empty and you have to load it. But, af-
# ter that, you won't have to reload your weapon until the weapon runs our or
# until you choose another form of ammunition from the FIELD menu.
#
# If a player who does not have the required weapon for a clip attempts to USE
# a clip, the system will buzz as if the item doesn't work.
#
#------------------------------------------------------------------------------
#
# THANKS:
# Thanks to Kalier for requesting this script, and beta-testing it during it's
# development. Also, thanks to SephirothSpawn for correcting a section of the
# script that could cause a 'stack error' when using Connected Attacking. And
# to Lockheart for requesting (and reminding me of) a system to automatically
# load the weapon with a selected ammunition from the field menu's ammo selec-
# tion screen. And to darksora for finding a minor bug related to the basic
# attack branching system.
#
#------------------------------------------------------------------------------
#
# CONFIGURATION:
#
# The AMMO_TYPE values defines the weapons used by this system as ammo-using
# weapons, and assigns to it an item to be used as the weapon's CLIP. As an
# example, the code below assigns the BRONZE GUN (weapon #21) to use a POUCH
# (item #26) as the weapon's CLIP, and assigns the IRON GUN (weapon #22) to
# use the LETTER (item #27) as THAT weapon's CLIP. Granted, this is without
# me renaming anything in the RMXP database. Woulda made sense if I renamed
# those two as BRONZE CLIP and IRON BULLETHOLDER.
#
# AMMO_TYPE = {21 => 26, 22 => 24}
#
# Limitations: A single clip MAY be assigned to different types of weapons,
# but no weapon can be assigned multiple types of clips. As an
# example, you may have an archer with three types of bows at
# her disposal and two quivers to hold her arrows. You can set
# the system so all three bows can use ONE of those quivers or
# two of the bows to use one quiver and the third bow to use
# the second quiver. None of the bows can use BOTH quivers.
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# The AMMO_EMPTY values define the sound effect used if the player attempts to
# use a weapon that is not loaded, or had run out of BULLETS. The example I
# have drawn up shows that the BRONZE GUN(#21) is using one of the RTP sound
# effects, while the IRON GUN(#22) is also using an RTP sound effect.
#
# AMMO_EMPTY = {21 => "043-Knock04", 22 => "042-Knock03"}
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# The AMMO_FILL values define the sound effect used if the player attempts to
# load a weapon with a clip whether he ran out of BULLETS or not. The effect
# only performs the desired effect if bullets are available for use, and the
# system will (regardless of this array) play a 'buzzer' sound effect if the
# party is out of that form of ammunition. The example that I have drawn up
# shows that the BRONZE GUN(#21) is using one of the RTP sound effects,while
# the IRON GUN(#22) is also using an RTP sound effect.
#
# AMMO_FILL = {21 => "028-Door05", 22 => "091-Attack03"}
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# The AMMO_CLIP_LIMIT value tells the system just how many 'ROUNDS' of BULLETS
# that is available for the player to use before reloading. The below ex-
# ample shows two clips: The clip for the BRONZE GUN (item #26: Pouch) &
# the clip for the IRON GUN (item #27: Letter). The 'POUCH' has been set
# to hold up to and use 6 rounds of BULLETS before needing to reload. But
# the 'LETTER' in the below example has a value of '0' in place of a normal
# value. If it had been set to 13, then the 'Letter' would hold up to and
# use up to 13 rounds of ammo. The value of zero (0) in it's place allows
# you to load ALL the ammunition for that weapon from the Party's pool.
#
# AMMO_CLIP_LIMIT = {26 => 6, 27 => 0}
#
# NOTE: This allows you to go beyond 99 rounds of ammo for your weapon when
# the clip is loaded. But, if you change weapons o r select another ammo
# type, all ammunition up to 99 rounds is returned to the pool. Any excess
# beyond the RMXP system's limit of 99 for a given item is lost.
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# The AMMO_CLIP_TYPE value is a more advanced HASH that stores the BULLETS us-
# able for each CLIP. As each CLIP brings up a list of BULLETS to select
# from in the Field menu's Item menu, it is this HASH that actually defines
# what items are deemed as ammunition for use BY the weapon. The below ex-
# ample shows that the POUCH (item #26) loads items #1, #2 and #3 (potions
# mostly) into the clip's menu for use as BULLETS, and shows that the LETTER
# (item #27) uses items #4 and 5 (potions or tonics) into THAT clip's menu
# for use as BULLETS. As the BRONZE GUN (weapon #21) uses the POUCH as its
# CLIP, then by using the Bronze Gun as a weapon, you must have items #1, #2
# and/or #3 as its ammunition.
#
# AMMO_CLIP_TYPE = {26 => [1, 2, 3],
# 27 => [4, 5] }
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# The AMMO_AUTOLOAD value is a boolean (true/false) value that loads/reloads a
# weapon once you select the ammunition to use for your clip. Fairly simple
# to use. Just don't expect any change in the ammo menu when choosing an
# ammo to use. The ammo selection and recovery system needs the menu to
# NOT change so it can tell ammo types apart.
#
# The AMMO_AUTO_SE value is a boolean (true/false) value that determines whe-
# ther you want to play the AMMO_FILL sound effect (see above) in the field
# menu.
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# The RTAB_CONNECTED value is a switch that informs the script whether or not
# the RTAB script (Connected Attacking) is in use. While RTAB itself is auto
# detected, Connected Attacking is not and this switch is a necessary evil.
#
#------------------------------------------------------------------------------
#
# PREPARING THE ITEMS IN USE:
# This system does not disable the items in any way, nor does it remove any of
# the uses of the items. As such, it would be a good idea to flag all BULLET
# items in your database as having 'NO SCOPE' and 'NEVER' for the occasion of
# use (that means they aren't used in either the Field or Battle menu).
#
# The CLIPS on the other hand should be tagged as having "NO SCOPE", but they
# should be set for "ALWAYS" for their occasion, so they could be used in both
# the FIELD and BATTLE menus. Just remember to remove any special effect or
# condition from their stats, and tag them as 'non-consumable' items.
#
#------------------------------------------------------------------------------
#
# SPECIAL THINGS TO NOTE:
# Damage that is inflicted by ammo-using weapons is based on the ammo itself
# and NOT from the weapon using the ammo. As such, all damage calculations
# are derived from the values in the ITEM database. Damage to HP (and SP),
# Element and Status Effect states, and Damage Variance values all have their
# part to play in inflicting damage. However, only the flat-rate values for
# the HP (and SP)... not the '%' values. Also, no 'Parameter' conditions such
# as STRENGTH, INTELLIGENCE, HP MAX are affected by this system. As a note,
# I have to point out that items turned into BULLETS with this system will
# not allow for common event to play apart in any damage occurred. If you
# link a BULLET item to a common event, it won't perform same said event.
#
# To ensure that values always inflict damage (and avoid confusion), the sys-
# tem will take the ABSOLUTE value of the values stored in the database. This
# means that if the ammunition is assigned either -75 OR 75 in the item's HP
# section, it will apply it as 75 points of damage (assuming no changes done
# by element, status or variances).
#
# The system works with the DBS and the RTAB system. Note that while this
# system allows damage to be inflicted to the target's SP score, unless an
# extra script has been written, the damage done to the SP will only show for
# the RTAB system. RTAB has already made allowances to show SP damage, which
# the DBS system had not.
#
#==============================================================================
#==============================================================================
# **** **** **** CONFIGURATION SECTION **** **** ****
#==============================================================================
# Weapon / Clip Assignment Array
AMMO_TYPE =
{
190 => 29, 191 => 29, 192 => 29, 193 => 29, 194 => 29, 195 => 29, 196 => 29, 197 => 29, 198 => 29,
200 => 30, 201 => 30, 202 => 30, 203 => 30, 204 => 30, 205 => 30, 206 => 30, 207 => 30, 208 => 30,
210 => 31, 211 => 31, 212 => 31, 213 => 31, 214 => 31, 215 => 31, 216 => 31, 217 => 31, 218 => 31,
288 => 32,
292 => 35}
# Weapon Empty SE Array
AMMO_EMPTY =
{
190 => "gun_empty", 191 => "gun_empty", 192 => "gun_empty", 193 => "gun_empty", 194 => "gun_empty", 195 => "gun_empty", 196 => "gun_empty", 197 => "gun_empty", 198 => "gun_empty",
200 => "gun_empty", 201 => "gun_empty", 202 => "gun_empty", 203 => "gun_empty", 204 => "gun_empty", 205 => "gun_empty", 206 => "gun_empty", 207 => "gun_empty", 208 => "gun_empty",
210 => "gun_empty", 211 => "gun_empty", 212 => "gun_empty", 213 => "gun_empty", 214 => "gun_empty", 215 => "gun_empty", 216 => "gun_empty", 217 => "gun_empty", 218 => "gun_empty",
288 => "gun_empty",
292 => "gun_empty"
}
# Weapon ReFill SE Array
AMMO_FILL =
{
190 => "gun_reload", 191 => "gun_reload", 192 => "gun_reload", 193 => "gun_reload", 194 => "gun_reload", 195 => "gun_reload", 196 => "gun_reload", 197 => "gun_reload", 198 => "gun_reload",
200 => "gun_reload", 201 => "gun_reload", 202 => "gun_reload", 203 => "gun_reload", 204 => "gun_reload", 205 => "gun_reload", 206 => "gun_reload", 207 => "gun_reload", 208 => "gun_reload",
210 => "gun_reload", 211 => "gun_reload", 212 => "gun_reload", 213 => "gun_reload", 214 => "gun_reload", 215 => "gun_reload", 216 => "gun_reload", 217 => "gun_reload", 218 => "gun_reload",
288 => "gun_reload",
292 => "gun_reload"
}
# Clip Max Fill Array
AMMO_CLIP_LIMIT =
{
29 => 12,
30 => 8,
31 => 35,
32 => 2,
35 => 8}
# Clip's Ammo Available Array
AMMO_CLIP_TYPE =
{
29 => [10,12,13,14,15,16,17,18,19],
30 => [20,21,22,23,24,25,26,27,28],
31 => [10,12,13,14,15,16,17,18,19],
32 => [33],
35 => [34]
}
# If true, weapon is loaded when the ammo is chosen in the ammo window.
AMMO_AUTOLOAD = true
# If true, the Weapon ReFill SE will play in menu
AMMO_AUTO_SE = true
# Connected Attacking Adaptation Switch
RTAB_CONNECTED = false
#==============================================================================
# ** Click
#------------------------------------------------------------------------------
# This class performs the empty/full click sound associated with the loading
# of a weapon.
#==============================================================================
module Click
#--------------------------------------------------------------------------
# * Perform Empty Click
#--------------------------------------------------------------------------
def perform_click(ammo_click)
# Error checking. Makes sure that even the default sound file is available.
# If it is missing, then the system will set the click to >none<.
#
# If the ammo click isn't nil
if ammo_click != nil
begin
clk = RPG::AudioFile.new(ammo_click)
Audio.se_play("Audio/SE/" + clk.name,0,100)
# Sound file is true
rescue Errno::ENOENT
# Sound file is invalid (restore default)
ammo_click = nil
end
# Play the Click
if ammo_click != nil
Audio.se_play("Audio/SE/"+clk.name)
end
end
end
end
#==============================================================================
# ** RMXP Standard Development Kit (SDK)
#------------------------------------------------------------------------------
# A system aimed to increase compatibility between RGSS scripts
#==============================================================================
module SDK
# Set Autodetect global to false
$ammo_sdk_detect = false
# SDK Autodetect routine
if defined?(log_alias)
# Set Autodetect global to true
$ammo_sdk_detect = true
end
end
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# This class handles temporary data that is not included with save data.
# Refer to "$game_temp" for the instance of this class.
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :clip_number
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias ammo_init initialize
def initialize
# Perform the original call
ammo_init
@clip_number = 0
end
end
#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
# This class deals with battlers. It's used as a superclass for the Game_Actor
# and Game_Enemy classes.
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :ammo_left # battler's weapon load
attr_accessor :ammo_type # ammo type in weapon
attr_accessor :ammo_used_bool # ammo used (true/false)
attr_accessor :ammo_load_bool # ammo loaded (true/false)
attr_accessor :ammo_empty_bool # ammo empty (true/false)
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias ammo_init initialize
def initialize
ammo_init
@ammo_left = 0
@ammo_type = 0
@ammo_used_bool = false
@ammo_load_bool = false
@ammo_empty_bool = false
end
#--------------------------------------------------------------------------
# * Applying Normal Attack Effects
# attacker : battler
#--------------------------------------------------------------------------
alias ammo_attack attack_effect
def attack_effect(attacker)
if attacker.ammo_used_bool != true
ammo_attack(attacker)
else
full_attack(attacker)
end
end
#--------------------------------------------------------------------------
# * RTAB Damage operation
# * Edited alias ONLY for RTAB Add-On: Connected Attacking
#--------------------------------------------------------------------------
if RTAB_CONNECTED
if @derv_ammo_rpgs_stack.nil?
@derv_ammo_rpgs_stack = true
alias ammo_de damage_effect
def damage_effect(battler, item)
if self.damage[battler] != nil
ammo_de(battler,item)
end
end
end
end
#--------------------------------------------------------------------------
# * Applying Normal Attack Effects with AMMO
# attacker : battler
#--------------------------------------------------------------------------
def full_attack(attacker)
# Obtain the proper ammo for the battler
item = $data_items[attacker.ammo_type]
# Branch on Cogwheel system usage
if $ammo_rtab_detect
# Clear critical flag (Cogwheel)
self.critical[attacker] = false
state_p[attacker] = []
state_m[attacker] = []
else
# Clear critical flag (default)
self.critical = false
end
# Clear effective flag
effective = false
# Set effective flag if common ID is effective
effective |= item.common_event_id > 0
# First hit detection
hit_result = (rand(100) < attacker.hit)
# If hit occurs
if hit_result == true
# Calculate amount of ammo damage
damage_hp = item.recover_hp
damage_sp = item.recover_sp
# Prevent negative values from ammo damage in database
damage_hp = damage_hp.abs
damage_sp = damage_sp.abs
# Consider battler defenses vs ammo
damage_hp -= self.pdef * item.pdef_f / 20
damage_sp -= self.mdef * item.mdef_f / 20
# Keep the ammo damage range positive
if damage_hp < 0
damage_hp = [damage_hp, 0].max
end
if damage_sp < 0
damage_sp = [damage_sp, 0].max
end
# Element correction
damage_hp *= elements_correct(item.element_set)
damage_hp /= 100
damage_sp *= elements_correct(item.element_set)
damage_sp /= 100
# If damage value is strictly positive
if damage_hp > 0
# Critical correction
if rand(100) < 4 * attacker.dex / self.agi
damage_hp *= 2
damage_sp *= 2
# Branch on Cogwheel system usage
if $ammo_rtab_detect
self.critical[attacker] = true
else
self.critical = true
end
end
# Guard correction
if self.guarding?
damage_hp /= 2
damage_sp /= 2
end
end
# Dispersion
if item.variance > 0
amph = [damage_hp * item.variance / 100, 1].max
amps = [damage_sp * item.variance / 100, 1].max
damage_hp += rand(amph+1) + rand(amph+1) - amph
damage_sp += rand(amps+1) + rand(amps+1) - amps
end
# Branch on Cogwheel system usage
if $ammo_rtab_detect
# Set damage value
self.damage[attacker] = damage_hp
self.damage_sp[attacker] = damage_sp
# Do not show '0' SP damage
self.damage_sp[attacker] = '' if damage_sp < 1
else
# Set damage value
self.damage = damage_hp
end
# Second on-target hit decision
eva = 8 * self.agi / attacker.dex + self.eva
# Branch on Cogwheel system usage
if $ammo_rtab_detect
hit = self.damage[attacker] < 0 ? 100 : 100 - eva
else
hit = self.damage < 0 ? 100 : 100 - eva
end
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
end
# If hit occurs
if hit_result == true
# State Removed by Shock
remove_states_shock
# Substract damage from HP
self.hp -= ($ammo_rtab_detect ? self.damage[attacker] : self.damage)
# Subtract damage from SP
self.sp -= damage_sp
# State change
@state_changed = false
# Branch on Cogwheel system usage
if $ammo_rtab_detect
effective |= states_plus(attacker, item.plus_state_set)
effective |= states_minus(attacker, item.minus_state_set)
else
effective |= states_plus(item.plus_state_set)
effective |= states_minus(item.minus_state_set)
end
# In case of miss
else
# Branch on Cogwheel system usage
if $ammo_rtab_detect
# Setting "Miss" to the damage
self.damage[attacker] = "Miss"
# Clearing the critical flag
self.critical[attacker] = false
else
# Setting "Miss" to the damage
self.damage = "Miss"
# Clearing the critical flag
self.critical = false
end
end
# Method end
return effective
end
end
#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
# This class performs item screen processing.
#==============================================================================
class Scene_Item
include Click
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias ammo_main main
def main
# Make ammo window (set to invisible / inactive)
@ammo_window = Window_Ammo.new
@ammo_window.visible = false
@ammo_window.active = false
# Make ammo help window
@hammo_window = Window_Ammo_Help.new
@hammo_window.visible = false
@hammo_window.active = false
# Perform the Initial Call
ammo_main
# Dispose of Windows
@ammo_window.dispose
@hammo_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias ammo_update update
def update
# Update the windows (done automatically with the SDK)
unless $ammo_sdk_detect
@ammo_window.update
end
# Perform the Initial Call
ammo_update
# If target window is active: call update_target
if @ammo_window.active
update_ammo
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when item window is active)
#--------------------------------------------------------------------------
alias ammo_update_item update_item
def update_item
# Obtain current hero battler value
target = $game_party.actors[@target_window.index]
$game_temp.clip_number = 0
# Perform the Initial Call
ammo_update_item
# If C button was pressed
if Input.trigger?(Input::C)
# Ensure it is an item that can be used (like loading during battle)
if @item.is_a?(RPG::Item)
# If we have an ammo clip that matches...
if AMMO_CLIP_TYPE.include?(@item.id)
# Set the clip we're using
$game_temp.clip_number = @item.id
# Activate target window
@item_window.active = false
@target_window.visible = true
@target_window.active = true
# Position window horizontally, dependant on item
@target_window.x = (@item_window.index + 1) % 2 * 304
# Set to Single Ally
@target_window.index = 0
end
end
end
end
#--------------------------------------------------------------------------
# * Frame Update (when target window is active)
#--------------------------------------------------------------------------
alias ammo_target update_target
def update_target
if $game_temp.clip_number != 0
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# If unable to use because items ran out
unless $game_party.item_can_use?(@item.id)
# Remake item window contents
@item_window.refresh
end
# Erase target window
@item_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Obtain current hero battler value
target = $game_party.actors[@target_window.index]
# Perform switch only if the clip works for the weapon
if AMMO_TYPE[target.weapon_id] == $game_temp.clip_number
# Refresh the Ammo Window with the current clip
@ammo_window.refresh
# Erase target window
@target_window.active = false
# Show the available ammo window
@ammo_window.visible = true
@ammo_window.active = true
# Obtain the current ammo window's index
ammo_idx = @ammo_window.ammos.size
ammo_idx = @ammo_window.ammos.index(target.ammo_type) if target.ammo_type != 0
if ammo_idx == nil; ammo_idx = @ammo_window.ammos.size ; end
@ammo_window.index = ammo_idx
# Show the current ammo window
@hammo_window.visible = true
@hammo_window.active = true
# Show currently selected ammo
update_ammo_help(target.ammo_type)
return
else
# Play cancel SE
$game_system.se_play($data_system.buzzer_se)
end
return
end
return
end
# Perform the Initial Call
ammo_target
end
#--------------------------------------------------------------------------
# * Frame Update (when ammo window is active)
#--------------------------------------------------------------------------
def update_ammo
# Obtain current hero battler value
target = $game_party.actors[@target_window.index]
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Erase ammo window
@target_window.active = true
@ammo_window.visible = false
@ammo_window.active = false
@hammo_window.visible = false
@hammo_window.active = false
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Create an empty hash
ammo_list = {}
# Load hash with proper ammo list for that clip
ammo_list = AMMO_CLIP_TYPE[$game_temp.clip_number] if $game_temp.clip_number != 0
# Unload old ammunition, if any
if target.ammo_type != ammo_list[@ammo_window.index]
# if there's a clip loaded.
if target.ammo_type != 0
# If the autoload feature is on...
if AMMO_AUTOLOAD
$game_party.gain_item(target.ammo_type, target.ammo_left)
target.ammo_left = 0
# Load with a new clip
update_clip
end
# If no clip was loaded
else
# If the autoload feature is on...
if AMMO_AUTOLOAD
$game_party.gain_item(target.ammo_type, target.ammo_left)
target.ammo_left = 0
# Load with a new Clip
update_clip
end
end
end
if ammo_list[@ammo_window.index] == nil
target.ammo_type = 0
else
# Set the ammunition type for the clip
if ammo_list.include?(@ammo_window.item.id)
target.ammo_type = @ammo_window.item.id
else
target.ammo_type = 0
end
end
# Show currently selected ammo
update_ammo_help(target.ammo_type)
# Refresh the game party
$game_party.refresh
# Refresh the ammo & item windows
return
end
end
#--------------------------------------------------------------------------
# * Help Window Update (when ammo window is active)
#--------------------------------------------------------------------------
def update_clip
# Obtain current hero battler value
target = $game_party.actors[@target_window.index]
# Create an empty hash
ammo_list = {}
# Load hash with proper ammo list for that clip
ammo_list = AMMO_CLIP_TYPE[$game_temp.clip_number] if $game_temp.clip_number != 0
# reset loading amount
ammo_loading = 0
# Get the Ammo ID from the selected window
ammo_type = ammo_list[@ammo_window.index]
# Get the total count in your party's stash (if any)
if ammo_type == nil
ammo_count = 0
else
ammo_count = $game_party.item_number(ammo_type)
end
# Determine how many emptied
ammo_loading = AMMO_CLIP_LIMIT[@item_window.item.id]
# load/fill the gun with a new clip (drawing from the total ammo)
if ammo_count <= ammo_loading
ammo_loading = ammo_count
end
# Ensure no 'nil' error
if ammo_type != nil
# If the ammo clip is limited in size
if AMMO_CLIP_LIMIT[@item_window.item.id] != 0
target.ammo_left += ammo_loading
$game_party.lose_item(ammo_type, ammo_loading)
# Otherwise, take the whole amount
else
target.ammo_left += ammo_count
$game_party.lose_item(ammo_type,ammo_count)
end
# If the Weapon ReFill SE plays in menu
if AMMO_AUTO_SE
# Reset the SE file to nil
ammo_click = nil
# Retrieve a sound effect from the SE Array for clicks (if any)
ammo_click = AMMO_FILL[target.weapon_id] if AMMO_EMPTY != nil
# Perform click SE
perform_click(ammo_click)
end
end
end
#--------------------------------------------------------------------------
# * Help Window Update (when ammo window is active)
#--------------------------------------------------------------------------
def update_ammo_help(ammunition)
# Display current ammo in ammo window
if ammunition != nil
if ammunition == 0
textme = "[Empty]"
else
textme = $data_items[ammunition]
end
@hammo_window.set_text(textme)
end
end
end
#==============================================================================
# ** Window_Ammo
#------------------------------------------------------------------------------
# This window displays items in possession on the item and battle screens.
#==============================================================================
class Window_Ammo < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :ammos
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(160, 96, 320, 224)
@column_max = 1
refresh
self.z += 20
@ammos = []
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
@ammos = []
# create empty hash
ammo_list = {}
# load hash with proper ammo list for that clip
ammo_list = AMMO_CLIP_TYPE[$game_temp.clip_number] if $game_temp.clip_number != 0
# Add item
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
itemno = $data_items[i].id
if ammo_list.include?(itemno)
@data.push($data_items[i])
@ammos.push($data_items[i].id)
end
end
end
# Add blank page
@data.push(nil)
# If item count is not 0, make a bit map and draw all items
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(idx)
item = @data[idx]
self.contents.font.color = normal_color
x = 4 + idx
y = idx * 32
rect = Rect.new(x, y, self.width, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
if item != nil
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
number = $game_party.item_number(item.id)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#==============================================================================
# ** Window_Ammo_Help
#------------------------------------------------------------------------------
# This window shows skill and item explanations along with actor status.
#==============================================================================
class Window_Ammo_Help < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(160, 32, 320, 64)
self.z += 20
self.contents = Bitmap.new(width - 32, height - 32)
end
#--------------------------------------------------------------------------
# * Set Text
# text : text string displayed in window
# align : alignment (0..flush left, 1..center, 2..flush right)
#--------------------------------------------------------------------------
def set_text(ammo)
# Redraw text
self.contents.clear
self.contents.font.color = normal_color
# Only if the index has a value
if ammo != nil
rect = Rect.new(x, y, self.width, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
if ammo != "[Empty]"
bitmap = RPG::Cache.icon(ammo.icon_name)
self.contents.blt(0, 4, bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.draw_text(28, 0, 212, 32, ammo.name, 0)
else
self.contents.draw_text(28, 0, 212, 32, "[Empty]", 0)
end
end
end
end
#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
# This class performs equipment screen processing.
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
alias ammo_e_main update_item
def update_item
# Obtain current hero
target = $game_party.actors[@actor_index]
# Obtain the older weapon
old_weapon = target.weapon_id
# Perform the Original Call
ammo_e_main
target = $game_party.actors[@actor_index]
# Obtain the newer weapon
new_weapon = target.weapon_id
# If the weapon changed
if old_weapon != new_weapon
# Create an empty hash
ammo_list = {}
# Load hash with proper ammo list for that clip
ammo_list = AMMO_CLIP_TYPE[$game_temp.clip_number] if $game_temp.clip_number != 0
# Unload old ammunition when switching weapon
if target.ammo_type != 0
$game_party.gain_item(target.ammo_type,target.ammo_left)
target.ammo_left = 0
target.ammo_type = 0
end
end
end
end
#==============================================================================
# ** Scene_Battle (part 3)
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : item selection)
#--------------------------------------------------------------------------
alias ammo_upis update_phase3_item_select
def update_phase3_item_select
# New Value... allows for [Esc] detection.
@item = -1
ammo_upis
end
#--------------------------------------------------------------------------
# * End Item Selection
#--------------------------------------------------------------------------
alias ammo_eis end_item_select
def end_item_select
# Dependant on RTAB or not RTAB
if $ammo_rtab_detect
battler = @active_actor
else
battler = @active_battler
end
# Only perform if [Esc] not selected
if @item.id != -1
# Perform switch only if the clip works for the weapon
if @item_window.item.id != AMMO_TYPE[battler.weapon_id]
# Only if the item IS a clip
if AMMO_CLIP_LIMIT.include?(@item.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
end
end
end
# Perform the Original Call
ammo_eis
end
end
#==============================================================================
# ** Scene_Battle (part 4)
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
include Click
#--------------------------------------------------------------------------
# * Frame renewal (main phase step 2: Action start)
# * Edited alias ONLY for RTAB Add-On: Connected Attacking
#--------------------------------------------------------------------------
if RTAB_CONNECTED
alias ammo_up4s2 update_phase4_step2
def update_phase4_step2(battler)
if battler.is_a?(Game_Actor) and battler.ammo_left == 0 and
AMMO_TYPE != nil and AMMO_TYPE.include?(battler.weapon_id)
# Copy and remove the weapon
temp_anime = battler.weapon_id
battler.equip(0,0)
# Perform routine (without possible weapon animation)
ammo_up4s2(battler)
# Perform animation
battler.equip(0, temp_anime)
else
ammo_up4s2(battler)
end
end
end
#--------------------------------------------------------------------------
# * Make Basic Action Results
#--------------------------------------------------------------------------
alias ammo_mbar make_basic_action_result
def make_basic_action_result(battler = @active_battler)
# Detect RTAB
@rtab = !@target_battlers
# Only perform if there are ammo-using weapons
if AMMO_TYPE != nil
# If the weapon in use requires ammunition
if AMMO_TYPE.include?(battler.weapon_id)
# Get WeaponID for Ammunition
ammo_type = battler.weapon_id
# Retrieve the amount of ammunition left
ammo_count = battler.ammo_left
# Set ammunition available to 'TRUE'
can_attack = true
# Set damage routine for ammunition
battler.ammo_used_bool = true
# Perform check if ammunition is empty
if ammo_count <= 0
# Set ammunition available to 'FALSE'
can_attack=false
@ammo_used_bool = false
end
# Only perform if you cannot attack
unless can_attack
# If actually attacking
if battler.current_action.basic == 0
# Set the sound effect to nil
ammo_click = nil
# Retrieve a sound effect from the SE Array for clicks (if any)
ammo_click = AMMO_EMPTY[battler.weapon_id] if AMMO_EMPTY != nil
# Perform click SE
perform_click(ammo_click)
# Still obtain a target (needed for Animated Battlers)
if battler.restriction == 3
target = $game_party.random_target_actor
elsif battler.restriction == 2
target = $game_troop.random_target_enemy
else
index = battler.current_action.target_index
target = $game_troop.smooth_target_enemy(index)
end
# Select target (for RTAB or DBS system) for Animated Battlers
if @rtab;battler.target=[target];else;@target_battlers=[target];end
# Exit from Call (Do not apply Damage Effect like the call would)
return
end
end
end
end
# Perform the Initial Call (RTAB & DBS)
@rtab ? ammo_mbar(battler) : ammo_mbar
end
#--------------------------------------------------------------------------
# * Make Item Action Results
#--------------------------------------------------------------------------
alias ammo_miar make_item_action_result
def make_item_action_result(battler = @active_battler)
# Detect RTAB
@rtab = !@target_battlers
# Only perform routine if a weapon was loaded
if battler.ammo_load_bool == true
# Set the sound effect to nil
ammo_click = nil
# Retrieve a sound effect from the SE Array for clicks (if any)
ammo_click = AMMO_FILL[battler.weapon_id] if AMMO_EMPTY != nil
# Perform click SE
perform_click(ammo_click)
# Turn the loading effect switch off
battler.ammo_load_bool = false
end
# Only perform routine if no ammo left to load
if battler.ammo_empty_bool == true
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
end
# Perform the Initial Call (RTAB & DBS)
@rtab ? ammo_miar(battler) : ammo_miar
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 5 : damage display)
#--------------------------------------------------------------------------
alias ammo_up4s5 update_phase4_step5
def update_phase4_step5(battler = @active_battler)
# Detect RTAB
@rtab = !@target_battlers
# Only perform this if a weapon-based action
if battler.current_action.kind == 0 and battler.current_action.basic == 0
# Only perform if there are ammo-using weapons
if AMMO_TYPE != nil
# Only perform if the weapon in use requires ammunition
if AMMO_TYPE.include?(battler.weapon_id)
# Um... ensure no negatives, please...
if battler.ammo_left != 0
# Get the weapon & ammo type
ammo_type=battler.weapon_id
# Reduce the ammunition by 1
battler.ammo_left -= 1
end
end
end
end
# Perform the Initial Call (RTAB & DBS)
@rtab ? ammo_up4s5(battler) : ammo_up4s5
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : item selection)
#--------------------------------------------------------------------------
alias ammo_up3is update_phase3_item_select
def update_phase3_item_select
# Obtain battler in DBS before switching to next battler
current_battler = @active_battler
# Dependant on RTAB or not RTAB
if $ammo_rtab_detect
battler = @active_actor
else
battler = current_battler
end
# Perform the Initial Call
ammo_up3is
# If C button was pressed
if Input.trigger?(Input::C)
# Ensure it is an item that can be used (like loading during battle)
if @item.is_a?(RPG::Item)
# Obtain the proper clip type for current weapon, if any...
current_clip = nil
current_clip = AMMO_TYPE[battler.weapon_id] if AMMO_TYPE != nil
if current_clip != nil
# If the item selected doesn't work with the current weapon
if current_clip != @item.id
# Only if the item IS a clip
if AMMO_CLIP_LIMIT.include?(@item.id)
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
end
# But, if it does work with the current weapon
else
# If the weapon in use requires ammunition
if AMMO_TYPE.include?(battler.weapon_id)
# Only perform if the item is an ammo container
if AMMO_CLIP_TYPE.include?(@item.id)
# reset loading amount
ammo_loading = 0
# Get the Ammo ID from the battler
ammo_type = battler.ammo_type
# get the total count in your party's stash
ammo_count = $game_party.item_number(ammo_type)
# Determine how many emptied
ammo_loading = AMMO_CLIP_LIMIT[@item.id] - battler.ammo_left
# load/fill the gun with a new clip (drawing from the total ammo)
if ammo_count <= ammo_loading
ammo_loading = ammo_count
end
# If the ammo clip is limited in size
if AMMO_CLIP_LIMIT[@item.id] != 0
battler.ammo_left += ammo_loading
$game_party.lose_item(ammo_type,ammo_loading)
# Otherwise, take the whole amount
else
battler.ammo_left += ammo_count
$game_party.lose_item(ammo_type,ammo_count)
end
if ammo_count != 0
battler.ammo_load_bool = true
else
battler.ammo_empty_bool = true
end
end
end
end
end
end
end
end
end
#==============================================================================
# ** Spriteset_Battle
#------------------------------------------------------------------------------
# This class brings together battle screen sprites. It's used within
# the Scene_Battle class.
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# * Change Enemy Viewport
#--------------------------------------------------------------------------
# Special note: When the normal method for detecting RTAB fails, I do this
alias am_rtab_init initialize
def initialize
am_rtab_init
if @real_zoom != nil
$ammo_rtab_detect = true
end
end
end
#==============================================================================
# ** Module RPG & Class SPRITE
#------------------------------------------------------------------------------
# Module RPG is a module containing RPGXP's data structures and more.
# The SPRITE Class adds various effect handling routines used within RPGXP.
#==============================================================================
module RPG
class Sprite < ::Sprite
#--------------------------------------------------------------------------
# * Damage Display routine
# * Edited alias ONLY for RTAB Add-On: Connected Attacking
#--------------------------------------------------------------------------
if RTAB_CONNECTED
alias ammo_d damage
def damage(value, critical, type = 0)
# Prevent errors
if value != nil
# Prevent '0' damage display (only when using Connected Attacking)
if value != 0
# Perform the Initial Call
ammo_d(value, critical, type)
end
end
end
end
end
end
Code:
#_______________________________________________________________________________
# MOG Scene Item Laura V1.0
#_______________________________________________________________________________
# By Moghunter
#_______________________________________________________________________________
if true # True = Enable / False = Disable (Script)
module MOG
#Transition Time.
MNIT = 20
#Transition Type(Name).
MNITT = "004-Blind04"
end
$mogscript = {} if $mogscript == nil
$mogscript["menu_laura"] = true
###############
# Window_Base #
###############
class Window_Base < Window
def nada
face = RPG::Cache.picture("")
end
def drw_face(actor,x,y)
face = RPG::Cache.picture(actor.name + "_fc") rescue nada
cw = face.width
ch = face.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, face, src_rect)
end
def draw_maphp3(actor, x, y)
back = RPG::Cache.picture("BAR0")
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, back, src_rect)
meter = RPG::Cache.picture("HP_Bar")
cw = meter.width * actor.hp / actor.maxhp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, meter, src_rect)
text = RPG::Cache.picture("HP_Tx")
cw = text.width
ch = text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 35, y - ch + 30, text, src_rect)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 81, y - 1, 48, 32, actor.hp.to_s, 2)
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(x + 80, y - 2, 48, 32, actor.hp.to_s, 2)
end
def draw_mapsp3(actor, x, y)
back = RPG::Cache.picture("BAR0")
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, back, src_rect)
meter = RPG::Cache.picture("SP_Bar")
cw = meter.width * actor.sp / actor.maxsp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, meter, src_rect)
text = RPG::Cache.picture("SP_Tx")
cw = text.width
ch = text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 35, y - ch + 30, text, src_rect)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 81, y - 1, 48, 32, actor.sp.to_s, 2)
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(x + 80, y - 2, 48, 32, actor.sp.to_s, 2)
end
def draw_mexp_it(actor, x, y)
lv_tx = RPG::Cache.picture("LV_tx")
cw = lv_tx.width
ch = lv_tx.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 60 , y - ch + 32, lv_tx, src_rect)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 101, y + 5, 24, 32, actor.level.to_s, 1)
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(x + 100, y + 4, 24, 32, actor.level.to_s, 1)
end
def draw_actor_state_it(actor, x, y, width = 80)
text = make_battler_state_text(actor, width, true)
self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
self.contents.draw_text(x, y, width, 32, text,1)
end
end
######################
# Window_Target_Item #
######################
class Window_Target_Item < Window_Selectable
def initialize
super(0, 130, 280, 300)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Georgia"
self.z += 10
@item_max = $game_party.actors.size
refresh
end
def refresh
self.contents.clear
for i in 0...$game_party.actors.size
x = 4
y = i * 65
actor = $game_party.actors[i]
drw_face(actor,x,y + 55)
draw_mexp_it(actor, x + 110, y + 25 )
draw_actor_state_it(actor, x + 165, y )
draw_maphp3(actor, x + 20, y + 0)
draw_mapsp3(actor, x + 20, y + 32)
end
end
def update_cursor_rect
if @index <= -2
self.cursor_rect.set(0, (@index + 10) * 65, self.width - 32, 60)
elsif @index == -1
self.cursor_rect.set(0, 0, self.width - 32, @item_max * 64 )
else
self.cursor_rect.set(0, @index * 65, self.width - 32, 60)
end
end
end
############
# Type_Sel #
############
class Type_Sel < Window_Base
attr_reader :index
attr_reader :help_window
def initialize(x, y, width, height)
super(x, y, width, height)
@item_max = 1
@column_max = 1
@index = -1
end
def index=(index)
@index = index
end
def row_max
return (@item_max + @column_max - 1) / @column_max
end
def top_row
return self.oy / 32
end
def top_row=(row)
if row < 0
row = 0
end
if row > row_max - 1
row = row_max - 1
end
self.oy = row * 32
end
def page_row_max
return (self.height - 32) / 32
end
def page_item_max
return page_row_max * @column_max
end
def update
super
if self.active and @item_max > 0 and @index >= 0
if Input.repeat?(Input::RIGHT)
if (@column_max == 1 and Input.trigger?(Input::RIGHT)) or
@index < @item_max - @column_max
$game_system.se_play($data_system.cursor_se)
@index = (@index + @column_max) % @item_max
end
end
if Input.repeat?(Input::LEFT)
if (@column_max == 1 and Input.trigger?(Input::LEFT)) or
@index >= @column_max
$game_system.se_play($data_system.cursor_se)
@index = (@index - @column_max + @item_max) % @item_max
end
end
end
end
end
###############
# Window_Type #
###############
class Window_Type < Type_Sel
def initialize
super(0, 0, 0, 0)
@item_max = 3
self.index = 0
end
end
##################
# Window_Item_Ex #
##################
class Window_Item_Ex < Window_Selectable
def initialize
super(250, 50, 295, 350)
@column_max = 1
refresh
self.index = 0
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 160
end
end
def item
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 1 * (288 + 32)
y = index / 1 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.font.name = "Georgia"
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 190, 32, item.name, 0)
self.contents.draw_text(x + 215, y, 16, 32, ":", 1)
self.contents.draw_text(x + 230, y, 24, 32, number.to_s, 2)
end
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#################
# Window_Weapon #
#################
class Window_Weapon < Window_Selectable
def initialize
super(250, 50, 295, 350)
@column_max = 1
refresh
self.index = 0
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 160
end
end
def item
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data[index]
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 1 * (288 + 32)
y = index / 1 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.font.name = "Georgia"
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 190, 32, item.name, 0)
self.contents.draw_text(x + 215, y, 16, 32, ":", 1)
self.contents.draw_text(x + 230, y, 24, 32, number.to_s, 2)
end
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
################
# Window_Armor #
################
class Window_Armor < Window_Selectable
def initialize
super(250, 50, 295, 350)
@column_max = 1
refresh
self.index = 0
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 160
end
end
def item
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data[index]
case item
when RPG::Armor
number = $game_party.armor_number(item.id)
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 1 * (288 + 32)
y = index / 1 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.font.name = "Georgia"
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 190, 32, item.name, 0)
self.contents.draw_text(x + 215, y, 16, 32, ":", 1)
self.contents.draw_text(x + 230, y, 24, 32, number.to_s, 2)
end
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
##############
# Scene_Item #
##############
class Scene_Item
def main
@back = Plane.new
@back.bitmap = RPG::Cache.picture("MN_BK")
@back.z = 100
@item_lay = Sprite.new
@item_lay.bitmap = RPG::Cache.picture("Item_lay")
@item_lay.z = 100
@item_com = Sprite.new
@