kazandraus
Member
I have two scripts which use the battle menu and was wondering how I go about making it so that both functions work (both sem to be taking the same function spot in the battle menu), the words of both are both there but the last one in the batle menu doesn't function, you see the words but can't click to make it work.
The two functions I have are Sephiroth's battle equipting and Selwyn's draw skill from enemy...I previously tried to get Eladia's battle equiptment script to work with Selwyn's but had teh same problem...I have a funny feeling that it's something very small, like a line in the scripting of Selwyn's that makes it so that his function work on the specific slot in the battle menu, then in Sephiroth's and Eladia's the same type thing is in theirs but for the same exact slot as Selwyn's... any help woud be greatly appreciated. Atttached are a link to Eladia's and the scripts for Sephiroths battle equipping and Selwyn's Draw system (Magic Number).
Eladia's Battle Equipment Menu
http://www.rmxp.org/forums/showthread.php?t=16672
SephirothSpawn Battle Equipping
Selwyn's Magic Number System Script
For some reason the won't play nice together..it goes all smoothly until I get into battle and try to use one of them,only the script closest to the Main script (currently the Magic Number script) works perfectly while the other one either doesn't do it's function acting like there isn't one. And when it's the other way around having the Equip script colsest to Main the Equip works perfectly but when I try to use the Magic Number the battle freezes/game freezes...DerVVulfman suggested it may have to do with the phase3 section but didn't seem to work....
any suggestions would be greatly appreciated! :D :thumb:
The two functions I have are Sephiroth's battle equipting and Selwyn's draw skill from enemy...I previously tried to get Eladia's battle equiptment script to work with Selwyn's but had teh same problem...I have a funny feeling that it's something very small, like a line in the scripting of Selwyn's that makes it so that his function work on the specific slot in the battle menu, then in Sephiroth's and Eladia's the same type thing is in theirs but for the same exact slot as Selwyn's... any help woud be greatly appreciated. Atttached are a link to Eladia's and the scripts for Sephiroths battle equipping and Selwyn's Draw system (Magic Number).
Eladia's Battle Equipment Menu
http://www.rmxp.org/forums/showthread.php?t=16672
SephirothSpawn Battle Equipping
#==============================================================================
# ** Battle Equipping
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1.01
# 2007-08-05
# SDK : Version 2.0+, Parts I, III & IV
#------------------------------------------------------------------------------
# * Version History :
#
# Version 1 ---------------------------------------------------- (2007-07-18)
# Version 1.01 ------------------------------------------------ (2007-08-05)
# - Minor Addition : Enhanced Equipment Change Text (Thanks to tibuda)
#------------------------------------------------------------------------------
# * Requirements :
#
# Method & Class Library (2.1+)
#------------------------------------------------------------------------------
# * Description :
#
# This script was designed to allow your change your actors equipment during
# battle.
#------------------------------------------------------------------------------
# * Instructions :
#
# Place The Script Below the SDK and Above Main.
# To customize Battle Equip options, refer to customization.
# To see a list of possible equip options, refer to syntax.
#------------------------------------------------------------------------------
# * Customization :
#
# Disable Switches : When Switches are on (true) the actors cannot use
# the switch command
# - DisableEquip = { actor_id => [switch_id, ...], ... }
#
# Disable Switches Default (When these switches are on (true), all non-
# defined actors will use this array
# - DisableEquip.default = [switch_id, ...]
#
# Actors That Can Use the Equip Command By Default
# - Actors_That_Can_Switch_BD = [actor_id, ...] (0 for all actors)
#
# Actors That Can By Switched By Default
# - Actors_That_Can_Be_Switched_BD = [actor_id, ...] (0 for all actors)
#
# Show Picture Type (0 : None, 1 : Battler, 2 : Non-Animated Sprite,
# 3 : Animated Sprite, 4 : Face)
# - Show_Picture_Type = 0 - 4
#
# Equip Out Animation
# - Switch_Out_Animation_ID = { actor_id => id }
#
# Default Equip Out Animation
# - Switch_Out_Animation_ID.default = id
#
# Equip In Animation
# - Switch_Out_Animation_ID = { actor_id => id }
#
# Default Equip In Animation
# - Switch_Out_Animation_ID.default = id
#
# Equip Commands By Actor
# - ::SDK ... ::Equip = { actor_id => 'Equip Word', ... }
#
# Equip Command By Actor (Default for all non-defined)
# - ::SDK ... ::Equip.default = 'Equip Word'
#------------------------------------------------------------------------------
# * Syntax :
#
# Change Ability to Use Equip Command in Battle
# - <game_actor>.can_switch_in_battle
#
# Change Ability to Be Switched in Battle
# - <game_actor>.can_be_switched_in_battle
#==============================================================================
#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('Battle Equipping', 'SephirothSpawn', 1.01, '2007-08-05')
SDK.check_requirements(2.0, [3, 4], {'Method & Class Library' => 2.1})
#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.enabled?('Battle Equipping')
#==============================================================================
# ** BattleEquipper
#==============================================================================
module BattleEquipper
#--------------------------------------------------------------------------
# * Options
#
# Disable Switches : When Switches are on (true) the actors cannot use
# the equip command
# - DisableEquip = { actor_id => [switch_id, ...], ... }
#
# Disable Switches Default (When these switches are on (true), all non-
# defined actors will use this array
# - DisableEquip.default = [switch_id, ...]
#
# Actors That Can Use the Equip Command By Default
# - Actors_That_Can_Equip_BD = [actor_id, ...] (0 for all actors)
#
# Equip Animation
# - Equip_Animation_ID = { actor_id => id }
#
# Equip Commands By Actor
# - ::SDK ... ::Equip = { actor_id => 'Equip Word', ... }
#
# Equip Command By Actor (Default for all non-defined)
# - ::SDK ... ::Equip.default = 'Equip Word'
#--------------------------------------------------------------------------
DisableEquip = {}
DisableEquip.default = []
Actors_That_Can_Equip_BD = [0]
Equip_Animation_ID = {}
Equip_Animation_ID.default = 0
SDK::Scene_Commands::Scene_Battle::Equip = {2 => 'Equipment'}
SDK::Scene_Commands::Scene_Battle::Equip.default = 'Equip'
end
#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :can_equip_in_battle
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias_method :seph_battleequipping_gmactr_setup, :setup
#--------------------------------------------------------------------------
# * Setup
#--------------------------------------------------------------------------
def setup(actor_id)
# Original Setup
seph_battleequipping_gmactr_setup(actor_id)
# Setup Battle Equip Variables
can_equip = BattleEquipper::Actors_That_Can_Equip_BD
@can_equip_in_battle = can_equip.include?(actor_id) ||
can_equip.include?(0)
end
#--------------------------------------------------------------------------
# * Can Use Equip Command?
#--------------------------------------------------------------------------
def can_use_equip_in_battle?
BattleEquipper::DisableEquip.each do |switch_id|
return false if $game_switches[switch_id]
end
return true
end
#--------------------------------------------------------------------------
# * Equip Command Word
#--------------------------------------------------------------------------
def equip_command_word
return SDK::Scene_Commands::Scene_Battle::Equip[@actor_id]
end
end
#==============================================================================
# ** Window_BattleEquipment
#==============================================================================
class Window_BattleEquipment < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor_id)
# Creates Window & Contents
super(32, 96, 272, 196)
self.contents = Bitmap.new(width - 32, height - 32)
# Saves Actor Information
@actor = $game_actors[actor_id]
@item_max, self.opacity, self.index = 5, 160, 0
refresh
end
#--------------------------------------------------------------------------
# * Item
#--------------------------------------------------------------------------
def item(index = self.index)
return @data[index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
# Creates Data
@data = []
@data << $data_weapons[@actor.weapon_id]
@data << $data_armors[@actor.armor1_id]
@data << $data_armors[@actor.armor2_id]
@data << $data_armors[@actor.armor3_id]
@data << $data_armors[@actor.armor4_id]
# Draws Equipment : Weapon
self.contents.draw_equipment(@data[0], 0, 0, 240, 32, 0, 0)
# Draws Equipment : Shield
self.contents.draw_equipment(@data[1], 0, 32, 240, 32, 0, 1)
# Draws Equipment : Helmet
self.contents.draw_equipment(@data[2], 0, 64, 240, 32, 0, 2)
# Draws Equipment : Body armor
self.contents.draw_equipment(@data[3], 0, 96, 240, 32, 0, 3)
# Draws Equipment : Accessory
self.contents.draw_equipment(@data[4], 0, 128, 240, 32, 0, 4)
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item.nil? ? '' : self.item.description)
end
end
#==============================================================================
# ** Window_BattleEquipmentInventory
#==============================================================================
class Window_BattleEquipmentInventory < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor_id, type = 0)
super(336, 96, 272, 196)
@actor = $game_actors[actor_id]
self.opacity, self.index, self.active = 160, 0, false
refresh(type)
end
#--------------------------------------------------------------------------
# * Item
#--------------------------------------------------------------------------
def item(index = self.index)
return @data[index] == 0 ? nil : @type == 0 ?
$data_weapons[@data[index]] : $data_armors[@data[index]]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(type)
# Return if Type Same
return if @type == type
# Save Type
@type = type
# Delete Existing Contents
unless self.contents.nil?
self.contents.dispose
self.contents = nil
end
# Create Data
@data = [0]
if type == 0
for i in 1...$data_weapons.size
next unless @actor.equippable?($data_weapons)
@data << i if $game_party.weapon_number(i) > 0
end
else
for i in 1...$data_armors.size
next unless @actor.equippable?($data_armors)
next unless $data_armors.kind == type - 1
@data << i if $game_party.armor_number(i) > 0
end
end
# Create Contents
@item_max = @data.size
self.contents = Bitmap.new(width - 32, @item_max * 32)
for i in 0...@item_max
self.contents.draw_equipment(self.item(i), 0, i * 32, 240, 32, 0, @type)
end
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item.nil? ? 'Unequip' : self.item.description)
end
end
#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias_method :seph_btlequip_scnbtl_p3scw, :phase3_setup_command_window
alias_method :seph_btlequip_scnbtl_p3bci, :phase3_basic_command_input
alias_method :seph_btlequip_scnbtl_up3, :update_phase3
alias_method :seph_btlequip_scnbtl_p3bcd?, :phase3_basic_command_disabled?
alias_method :seph_btlequip_scnbtl_up4s2, :update_phase4_step2
alias_method :seph_btlequip_scnbtl_up4s4, :update_phase4_step4
#--------------------------------------------------------------------------
# * Actor Command Window Setup
#--------------------------------------------------------------------------
def phase3_setup_command_window
# Original Command Window Setup
seph_btlequip_scnbtl_p3scw
# Gets Actor Information
actor = $game_party.actors[@actor_index]
# If Actor Can Equip
if actor.can_equip_in_battle
# If Equip Command Doesn't Exist
if @seph_equip_command_is_set.nil?
# Set Equip Command True
@seph_equip_command_is_set = true
# Set Equip Command Word
@seph_equip_command_word = actor.equip_command_word
# Get Window Commands
commands = @actor_command_window.commands.dup
# Insert Equip Command
commands << @seph_equip_command_word
# Reset Command Window Commands
@actor_command_window.commands = commands
# If Equip Command Exist
else
# If Equip Word Is Changing
unless @seph_equip_command_word == actor.equip_command_word
# Get Window Commands
commands = @actor_command_window.commands.dup
# Replaces Existing Command Word
index = commands.index(@seph_equip_command_word)
commands[index] = actor.equip_command_word
# Reset Command Window Commands
@actor_command_window.commands = commands
# Set Equip Command Word
@seph_equip_command_word = actor.equip_command_word
end
end
# If Actor Cannot Equip
else
# If Equip Command Does Exist
unless @seph_equip_command_is_set.nil?
# Get Window Commands
commands = @actor_command_window.commands.dup
# Delete Equip Command
commands.delete(@seph_equip_command_word)
# Reset Command Window Commands
@actor_command_window.commands = commands
# Erase Equip Command Flag
@seph_equip_command_is_set = nil
# Erase Equip Command Word
@seph_equip_command_word = nil
end
end
end
#--------------------------------------------------------------------------
# * Frame Update : Phase 3
#--------------------------------------------------------------------------
def update_phase3
# If Equip Window Exist
if @equip_window != nil && @equip_window.active
# Update Equip Select
update_equip_select
return
# If Equip Inventory Window Exist
elsif @equipinventory_window != nil && @equipinventory_window.active
# Update Equip Inventory Select
update_equip_inventory_select
return
end
# Original Update Phase 3
seph_btlequip_scnbtl_up3
end
#--------------------------------------------------------------------------
# * Phase 3 - Basic : Command Disabled? Test
#--------------------------------------------------------------------------
def phase3_basic_command_disabled?
# If Command is Equip
if @actor_command_window.command == @seph_equip_command_word
# If Equip Disabled
unless @active_battler.can_use_equip_in_battle?
# Return True
return true
end
end
# Return Previous Test
return seph_btlequip_scnbtl_p3bcd?
end
#--------------------------------------------------------------------------
# * Phase 3 Basic : Command Input
#--------------------------------------------------------------------------
def phase3_basic_command_input
# Original Command Input
seph_btlequip_scnbtl_p3bci
# If Command is Equip
if @actor_command_window.command == @seph_equip_command_word
# Command Equip
phase3_command_equip
end
end
#--------------------------------------------------------------------------
# * Phase 3 Basic : Command - Equip
#--------------------------------------------------------------------------
def phase3_command_equip
# Set action
@active_battler.current_action.kind = 'equipping'
@active_battler.current_action.basic = nil
# Start Equip Select
start_equip_select
end
#--------------------------------------------------------------------------
# * Update Equip Select
#--------------------------------------------------------------------------
def update_equip_select
# Refresh Inventory
@equipinventory_window.refresh(@equip_window.index)
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# End Equip Select
end_equip_select
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make Equip Window Inactive
@equip_window.active = false
# Make Equip Inventory Window Active
@equipinventory_window.active = true
return
end
end
#--------------------------------------------------------------------------
# * Update Equip Inventory Select
#--------------------------------------------------------------------------
def update_equip_inventory_select
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Make Equip Inventory Window Inactive
@equipinventory_window.active = false
# Make Equip Window Active
@equip_window.active = true
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Get currently selected data on the item window
item = @equipinventory_window.item
id = item.nil? ? 0 : item.id
# Change Active Battler Equip Setup
@active_battler.current_action.basic = [@equip_window.index, id]
# End Equip Select
end_equip_select
# Go to command input for next actor
phase3_next_actor
return
end
end
#--------------------------------------------------------------------------
# * Start Equip Select
#--------------------------------------------------------------------------
def start_equip_select
# Turn Off Actor Command Window
@actor_command_window.visible = false
@actor_command_window.active = false
# Create Equip Windows
id = @active_battler.id
@equip_window = Window_BattleEquipment.new(id)
@equipinventory_window = Window_BattleEquipmentInventory.new(id)
# Set Help Window
@equip_window.help_window = @help_window
@equipinventory_window.help_window = @help_window
end
#--------------------------------------------------------------------------
# * End Equip Select
#--------------------------------------------------------------------------
def end_equip_select
# Dispose Equip Windows
@equip_window.dispose
@equip_window = nil
@equipinventory_window.dispose
@equipinventory_window = nil
# Hide help window
@help_window.visible = false
# Turn On Actor Command Window
@actor_command_window.visible = true
@actor_command_window.active = true
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 2 : start action)
#--------------------------------------------------------------------------
def update_phase4_step2
# Original Phase 4 Setp 2
seph_btlequip_scnbtl_up4s2
# Return if Step 1
return if @phase4_step == 1
# If Action is Equip
if @active_battler.current_action.kind == 'equipping'
# Make Equip Action Result
make_equip_action_result
end
end
#--------------------------------------------------------------------------
# * Make Equip Action Results
#--------------------------------------------------------------------------
def make_equip_action_result
# Pass Through Equipment Changes
b = @active_battler.current_action.basic
@active_battler.equip(b[0], b[1])
# Set Help Text
text = b[1] > 0 ? 'Equipping ' : 'Removing '
if b[1] < 1
text += b[0] == 0 ? $data_system.words.weapon :
eval("$data_system.words.armor#{b[1]}")
elsif b[0] == 0
text += $data_weapons[b[1]].name
else
text += $data_armors[b[1]].name
end
@help_window.set_text(text, 1)
# Set Animation IDS
@animation1_id = BattleEquipper::Equip_Animation_ID[@active_battler.id]
# Play equip SE
$game_system.se_play($data_system.equip_se)
end
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end
# ** Battle Equipping
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1.01
# 2007-08-05
# SDK : Version 2.0+, Parts I, III & IV
#------------------------------------------------------------------------------
# * Version History :
#
# Version 1 ---------------------------------------------------- (2007-07-18)
# Version 1.01 ------------------------------------------------ (2007-08-05)
# - Minor Addition : Enhanced Equipment Change Text (Thanks to tibuda)
#------------------------------------------------------------------------------
# * Requirements :
#
# Method & Class Library (2.1+)
#------------------------------------------------------------------------------
# * Description :
#
# This script was designed to allow your change your actors equipment during
# battle.
#------------------------------------------------------------------------------
# * Instructions :
#
# Place The Script Below the SDK and Above Main.
# To customize Battle Equip options, refer to customization.
# To see a list of possible equip options, refer to syntax.
#------------------------------------------------------------------------------
# * Customization :
#
# Disable Switches : When Switches are on (true) the actors cannot use
# the switch command
# - DisableEquip = { actor_id => [switch_id, ...], ... }
#
# Disable Switches Default (When these switches are on (true), all non-
# defined actors will use this array
# - DisableEquip.default = [switch_id, ...]
#
# Actors That Can Use the Equip Command By Default
# - Actors_That_Can_Switch_BD = [actor_id, ...] (0 for all actors)
#
# Actors That Can By Switched By Default
# - Actors_That_Can_Be_Switched_BD = [actor_id, ...] (0 for all actors)
#
# Show Picture Type (0 : None, 1 : Battler, 2 : Non-Animated Sprite,
# 3 : Animated Sprite, 4 : Face)
# - Show_Picture_Type = 0 - 4
#
# Equip Out Animation
# - Switch_Out_Animation_ID = { actor_id => id }
#
# Default Equip Out Animation
# - Switch_Out_Animation_ID.default = id
#
# Equip In Animation
# - Switch_Out_Animation_ID = { actor_id => id }
#
# Default Equip In Animation
# - Switch_Out_Animation_ID.default = id
#
# Equip Commands By Actor
# - ::SDK ... ::Equip = { actor_id => 'Equip Word', ... }
#
# Equip Command By Actor (Default for all non-defined)
# - ::SDK ... ::Equip.default = 'Equip Word'
#------------------------------------------------------------------------------
# * Syntax :
#
# Change Ability to Use Equip Command in Battle
# - <game_actor>.can_switch_in_battle
#
# Change Ability to Be Switched in Battle
# - <game_actor>.can_be_switched_in_battle
#==============================================================================
#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('Battle Equipping', 'SephirothSpawn', 1.01, '2007-08-05')
SDK.check_requirements(2.0, [3, 4], {'Method & Class Library' => 2.1})
#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.enabled?('Battle Equipping')
#==============================================================================
# ** BattleEquipper
#==============================================================================
module BattleEquipper
#--------------------------------------------------------------------------
# * Options
#
# Disable Switches : When Switches are on (true) the actors cannot use
# the equip command
# - DisableEquip = { actor_id => [switch_id, ...], ... }
#
# Disable Switches Default (When these switches are on (true), all non-
# defined actors will use this array
# - DisableEquip.default = [switch_id, ...]
#
# Actors That Can Use the Equip Command By Default
# - Actors_That_Can_Equip_BD = [actor_id, ...] (0 for all actors)
#
# Equip Animation
# - Equip_Animation_ID = { actor_id => id }
#
# Equip Commands By Actor
# - ::SDK ... ::Equip = { actor_id => 'Equip Word', ... }
#
# Equip Command By Actor (Default for all non-defined)
# - ::SDK ... ::Equip.default = 'Equip Word'
#--------------------------------------------------------------------------
DisableEquip = {}
DisableEquip.default = []
Actors_That_Can_Equip_BD = [0]
Equip_Animation_ID = {}
Equip_Animation_ID.default = 0
SDK::Scene_Commands::Scene_Battle::Equip = {2 => 'Equipment'}
SDK::Scene_Commands::Scene_Battle::Equip.default = 'Equip'
end
#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :can_equip_in_battle
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias_method :seph_battleequipping_gmactr_setup, :setup
#--------------------------------------------------------------------------
# * Setup
#--------------------------------------------------------------------------
def setup(actor_id)
# Original Setup
seph_battleequipping_gmactr_setup(actor_id)
# Setup Battle Equip Variables
can_equip = BattleEquipper::Actors_That_Can_Equip_BD
@can_equip_in_battle = can_equip.include?(actor_id) ||
can_equip.include?(0)
end
#--------------------------------------------------------------------------
# * Can Use Equip Command?
#--------------------------------------------------------------------------
def can_use_equip_in_battle?
BattleEquipper::DisableEquip.each do |switch_id|
return false if $game_switches[switch_id]
end
return true
end
#--------------------------------------------------------------------------
# * Equip Command Word
#--------------------------------------------------------------------------
def equip_command_word
return SDK::Scene_Commands::Scene_Battle::Equip[@actor_id]
end
end
#==============================================================================
# ** Window_BattleEquipment
#==============================================================================
class Window_BattleEquipment < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor_id)
# Creates Window & Contents
super(32, 96, 272, 196)
self.contents = Bitmap.new(width - 32, height - 32)
# Saves Actor Information
@actor = $game_actors[actor_id]
@item_max, self.opacity, self.index = 5, 160, 0
refresh
end
#--------------------------------------------------------------------------
# * Item
#--------------------------------------------------------------------------
def item(index = self.index)
return @data[index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
# Creates Data
@data = []
@data << $data_weapons[@actor.weapon_id]
@data << $data_armors[@actor.armor1_id]
@data << $data_armors[@actor.armor2_id]
@data << $data_armors[@actor.armor3_id]
@data << $data_armors[@actor.armor4_id]
# Draws Equipment : Weapon
self.contents.draw_equipment(@data[0], 0, 0, 240, 32, 0, 0)
# Draws Equipment : Shield
self.contents.draw_equipment(@data[1], 0, 32, 240, 32, 0, 1)
# Draws Equipment : Helmet
self.contents.draw_equipment(@data[2], 0, 64, 240, 32, 0, 2)
# Draws Equipment : Body armor
self.contents.draw_equipment(@data[3], 0, 96, 240, 32, 0, 3)
# Draws Equipment : Accessory
self.contents.draw_equipment(@data[4], 0, 128, 240, 32, 0, 4)
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item.nil? ? '' : self.item.description)
end
end
#==============================================================================
# ** Window_BattleEquipmentInventory
#==============================================================================
class Window_BattleEquipmentInventory < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor_id, type = 0)
super(336, 96, 272, 196)
@actor = $game_actors[actor_id]
self.opacity, self.index, self.active = 160, 0, false
refresh(type)
end
#--------------------------------------------------------------------------
# * Item
#--------------------------------------------------------------------------
def item(index = self.index)
return @data[index] == 0 ? nil : @type == 0 ?
$data_weapons[@data[index]] : $data_armors[@data[index]]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(type)
# Return if Type Same
return if @type == type
# Save Type
@type = type
# Delete Existing Contents
unless self.contents.nil?
self.contents.dispose
self.contents = nil
end
# Create Data
@data = [0]
if type == 0
for i in 1...$data_weapons.size
next unless @actor.equippable?($data_weapons)
@data << i if $game_party.weapon_number(i) > 0
end
else
for i in 1...$data_armors.size
next unless @actor.equippable?($data_armors)
next unless $data_armors.kind == type - 1
@data << i if $game_party.armor_number(i) > 0
end
end
# Create Contents
@item_max = @data.size
self.contents = Bitmap.new(width - 32, @item_max * 32)
for i in 0...@item_max
self.contents.draw_equipment(self.item(i), 0, i * 32, 240, 32, 0, @type)
end
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item.nil? ? 'Unequip' : self.item.description)
end
end
#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias_method :seph_btlequip_scnbtl_p3scw, :phase3_setup_command_window
alias_method :seph_btlequip_scnbtl_p3bci, :phase3_basic_command_input
alias_method :seph_btlequip_scnbtl_up3, :update_phase3
alias_method :seph_btlequip_scnbtl_p3bcd?, :phase3_basic_command_disabled?
alias_method :seph_btlequip_scnbtl_up4s2, :update_phase4_step2
alias_method :seph_btlequip_scnbtl_up4s4, :update_phase4_step4
#--------------------------------------------------------------------------
# * Actor Command Window Setup
#--------------------------------------------------------------------------
def phase3_setup_command_window
# Original Command Window Setup
seph_btlequip_scnbtl_p3scw
# Gets Actor Information
actor = $game_party.actors[@actor_index]
# If Actor Can Equip
if actor.can_equip_in_battle
# If Equip Command Doesn't Exist
if @seph_equip_command_is_set.nil?
# Set Equip Command True
@seph_equip_command_is_set = true
# Set Equip Command Word
@seph_equip_command_word = actor.equip_command_word
# Get Window Commands
commands = @actor_command_window.commands.dup
# Insert Equip Command
commands << @seph_equip_command_word
# Reset Command Window Commands
@actor_command_window.commands = commands
# If Equip Command Exist
else
# If Equip Word Is Changing
unless @seph_equip_command_word == actor.equip_command_word
# Get Window Commands
commands = @actor_command_window.commands.dup
# Replaces Existing Command Word
index = commands.index(@seph_equip_command_word)
commands[index] = actor.equip_command_word
# Reset Command Window Commands
@actor_command_window.commands = commands
# Set Equip Command Word
@seph_equip_command_word = actor.equip_command_word
end
end
# If Actor Cannot Equip
else
# If Equip Command Does Exist
unless @seph_equip_command_is_set.nil?
# Get Window Commands
commands = @actor_command_window.commands.dup
# Delete Equip Command
commands.delete(@seph_equip_command_word)
# Reset Command Window Commands
@actor_command_window.commands = commands
# Erase Equip Command Flag
@seph_equip_command_is_set = nil
# Erase Equip Command Word
@seph_equip_command_word = nil
end
end
end
#--------------------------------------------------------------------------
# * Frame Update : Phase 3
#--------------------------------------------------------------------------
def update_phase3
# If Equip Window Exist
if @equip_window != nil && @equip_window.active
# Update Equip Select
update_equip_select
return
# If Equip Inventory Window Exist
elsif @equipinventory_window != nil && @equipinventory_window.active
# Update Equip Inventory Select
update_equip_inventory_select
return
end
# Original Update Phase 3
seph_btlequip_scnbtl_up3
end
#--------------------------------------------------------------------------
# * Phase 3 - Basic : Command Disabled? Test
#--------------------------------------------------------------------------
def phase3_basic_command_disabled?
# If Command is Equip
if @actor_command_window.command == @seph_equip_command_word
# If Equip Disabled
unless @active_battler.can_use_equip_in_battle?
# Return True
return true
end
end
# Return Previous Test
return seph_btlequip_scnbtl_p3bcd?
end
#--------------------------------------------------------------------------
# * Phase 3 Basic : Command Input
#--------------------------------------------------------------------------
def phase3_basic_command_input
# Original Command Input
seph_btlequip_scnbtl_p3bci
# If Command is Equip
if @actor_command_window.command == @seph_equip_command_word
# Command Equip
phase3_command_equip
end
end
#--------------------------------------------------------------------------
# * Phase 3 Basic : Command - Equip
#--------------------------------------------------------------------------
def phase3_command_equip
# Set action
@active_battler.current_action.kind = 'equipping'
@active_battler.current_action.basic = nil
# Start Equip Select
start_equip_select
end
#--------------------------------------------------------------------------
# * Update Equip Select
#--------------------------------------------------------------------------
def update_equip_select
# Refresh Inventory
@equipinventory_window.refresh(@equip_window.index)
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# End Equip Select
end_equip_select
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make Equip Window Inactive
@equip_window.active = false
# Make Equip Inventory Window Active
@equipinventory_window.active = true
return
end
end
#--------------------------------------------------------------------------
# * Update Equip Inventory Select
#--------------------------------------------------------------------------
def update_equip_inventory_select
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Make Equip Inventory Window Inactive
@equipinventory_window.active = false
# Make Equip Window Active
@equip_window.active = true
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Get currently selected data on the item window
item = @equipinventory_window.item
id = item.nil? ? 0 : item.id
# Change Active Battler Equip Setup
@active_battler.current_action.basic = [@equip_window.index, id]
# End Equip Select
end_equip_select
# Go to command input for next actor
phase3_next_actor
return
end
end
#--------------------------------------------------------------------------
# * Start Equip Select
#--------------------------------------------------------------------------
def start_equip_select
# Turn Off Actor Command Window
@actor_command_window.visible = false
@actor_command_window.active = false
# Create Equip Windows
id = @active_battler.id
@equip_window = Window_BattleEquipment.new(id)
@equipinventory_window = Window_BattleEquipmentInventory.new(id)
# Set Help Window
@equip_window.help_window = @help_window
@equipinventory_window.help_window = @help_window
end
#--------------------------------------------------------------------------
# * End Equip Select
#--------------------------------------------------------------------------
def end_equip_select
# Dispose Equip Windows
@equip_window.dispose
@equip_window = nil
@equipinventory_window.dispose
@equipinventory_window = nil
# Hide help window
@help_window.visible = false
# Turn On Actor Command Window
@actor_command_window.visible = true
@actor_command_window.active = true
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 2 : start action)
#--------------------------------------------------------------------------
def update_phase4_step2
# Original Phase 4 Setp 2
seph_btlequip_scnbtl_up4s2
# Return if Step 1
return if @phase4_step == 1
# If Action is Equip
if @active_battler.current_action.kind == 'equipping'
# Make Equip Action Result
make_equip_action_result
end
end
#--------------------------------------------------------------------------
# * Make Equip Action Results
#--------------------------------------------------------------------------
def make_equip_action_result
# Pass Through Equipment Changes
b = @active_battler.current_action.basic
@active_battler.equip(b[0], b[1])
# Set Help Text
text = b[1] > 0 ? 'Equipping ' : 'Removing '
if b[1] < 1
text += b[0] == 0 ? $data_system.words.weapon :
eval("$data_system.words.armor#{b[1]}")
elsif b[0] == 0
text += $data_weapons[b[1]].name
else
text += $data_armors[b[1]].name
end
@help_window.set_text(text, 1)
# Set Animation IDS
@animation1_id = BattleEquipper::Equip_Animation_ID[@active_battler.id]
# Play equip SE
$game_system.se_play($data_system.equip_se)
end
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end
Selwyn's Magic Number System Script
module RPG
#============================================================================
# â– RPG::Skill
#============================================================================
class Skill
#------------------------------------------------------------------------
# â— define instance variable
#------------------------------------------------------------------------
attr_accessor :stealable
attr_accessor :consumable
#------------------------------------------------------------------------
# â— define wether a skill can be stolen or not
# change this part with skills's id that you don't want to be stolen
# false : non-stealable
# true : stealable
# id : id of the skill (found in the database)
#
# the part below litteraly means : if the skill's id is 1 or 2 then
# the skill cannot be stolen if else : it can be...
#------------------------------------------------------------------------
def stealable
case @id
when 1
@stealable = true
when 2
@stealable = false
else
@stealable = true
end
end
#------------------------------------------------------------------------
# â— define wether a skill can be stolen or not
# change this part with skills's id that you don't want to be consumed
# false : non-consumable meaning permanent skill
# true : consumable
# id : id of the skill (found in the database)
#
# the part below litteraly means : if the skill's id is 5 or 7 then
# the skill cannot be consumed if else : it can be...
#------------------------------------------------------------------------
def consumable
case @id
when 4
@consumable = false
when 7
@consumable = false
else
@consumable = true
end
end
end
end
#==============================================================================
# â– Game_Party
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# â— define instance variable
#--------------------------------------------------------------------------
attr_accessor :actors
attr_accessor :skills
attr_reader :gold
attr_reader :steps
#--------------------------------------------------------------------------
# â— initialize
#--------------------------------------------------------------------------
def initialize
@skills = []
@actors = []
@gold = 0
@steps = 0
@items = {}
@weapons = {}
@armors = {}
end
end
#==============================================================================
# â– Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# â— define wether a skill can be used or not
#--------------------------------------------------------------------------
def skill_can_use?(skill_id)
if self.is_a?(Game_Actor)
if self.skill_number(skill_id) <= 0
return false
end
end
if self.is_a?(Game_Enemy)
if $data_skills[skill_id].sp_cost > self.sp
return false
end
end
if dead?
return false
end
if $data_skills[skill_id].atk_f == 0 and self.restriction == 1
return false
end
occasion = $data_skills[skill_id].occasion
if $game_temp.in_battle
return (occasion == 0 or occasion == 1)
else
return (occasion == 0 or occasion == 2)
end
end
end
#==============================================================================
# â– Game_BattleAction
#==============================================================================
class Game_BattleAction
#--------------------------------------------------------------------------
# â— define instance variable
#--------------------------------------------------------------------------
attr_accessor :steal_kind
attr_accessor :steal_target
#--------------------------------------------------------------------------
# â— clear
#--------------------------------------------------------------------------
def clear
@speed = 0
@kind = 0
@basic = 3
@skill_id = 0
@item_id = 0
@steal_kind = 0
@target_index = -1
@steal_target = -1
@forcing = false
end
end
#==============================================================================
# â– Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# â— setup
#--------------------------------------------------------------------------
def setup(actor_id)
actor = $data_actors[actor_id]
@actor_id = actor_id
@name = actor.name
@character_name = actor.character_name
@character_hue = actor.character_hue
@battler_name = actor.battler_name
@battler_hue = actor.battler_hue
@class_id = actor.class_id
@weapon_id = actor.weapon_id
@armor1_id = actor.armor1_id
@armor2_id = actor.armor2_id
@armor3_id = actor.armor3_id
@armor4_id = actor.armor4_id
@level = actor.initial_level
@exp_list = Array.new(101)
make_exp_list
@exp = @exp_list[@level]
#here we set that skills will be a Hash and not an Array
#this allow to have the skills and a value for the skills
#for this situation we use the value as the number of the skill we possess
@skills = {}
@hp = maxhp
@sp = maxsp
@states = []
@states_turn = {}
@maxhp_plus = 0
@maxsp_plus = 0
@str_plus = 0
@dex_plus = 0
@agi_plus = 0
@int_plus = 0
for i in 1..@level
for j in $data_classes[@class_id].learnings
if j.level == i
gain_skill(j.skill_id, 10) # add 10 of each skills actor learns
# at level 1...
end
end
end
update_auto_state(nil, $data_armors[@armor1_id])
update_auto_state(nil, $data_armors[@armor2_id])
update_auto_state(nil, $data_armors[@armor3_id])
update_auto_state(nil, $data_armors[@armor4_id])
end
#--------------------------------------------------------------------------
# â— define a method to change the exp value
# I redefine this one because of the skill learning
#--------------------------------------------------------------------------
def exp=(exp)
@exp = [[exp, 9999999].min, 0].max
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
@level += 1
for j in $data_classes[@class_id].learnings
if j.level == @level
gain_skill(j.skill_id, 10)
end
end
end
while @exp < @exp_list[@level]
@level -= 1
end
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end
#--------------------------------------------------------------------------
# â— gain a skill (skill id, number) MN_skill_value
#--------------------------------------------------------------------------
def gain_skill(skill_id, n)
if skill_id > 0
@skills[skill_id] = [[skill_number(skill_id) + n, 0].max, 99].min
#the "unless" part is needed to determine if a skill has ever been stolen
unless $game_party.skills.include?(skill_id)
$game_party.skills.push(skill_id)
end
end
end
#--------------------------------------------------------------------------
# â— lose a skill (skill id, number)
#--------------------------------------------------------------------------
def lose_skill(skill_id, n)
gain_skill(skill_id, -n)
end
#--------------------------------------------------------------------------
# â— check and return the value (number) of a skill
#--------------------------------------------------------------------------
def skill_number(skill_id)
return @skills.include?(skill_id) ? @skills[skill_id] : 0
end
#--------------------------------------------------------------------------
# â— define wether a skill can be used or not
#--------------------------------------------------------------------------
def skill_can_use?(skill_id)
if skill_number(skill_id) <= 0
return false
end
return super
end
end
#==============================================================================
# â– Window_Skill
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# â— initialize
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 128, 640, 352)
@actor = actor
@column_max = 2
refresh
self.index = 0
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 160
end
end
#--------------------------------------------------------------------------
# â— define skill
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# â— refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_skills.size
if @actor.skill_number(i) > 0
@data.push($data_skills)
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# â— draw_item
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.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)
if skill.consumable
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
self.contents.draw_text(x + 232, y, 48, 32, @actor.skill_number(skill.id).to_s, 2)
else
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
end
end
#--------------------------------------------------------------------------
# â— help window text settings
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
end
#==============================================================================
# â– Window_Steal
#==============================================================================
class Window_SkillSteal < Window_Selectable
#--------------------------------------------------------------------------
# â— initialize
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 64, 640, 256)
@actor = actor
@column_max = 2
refresh
self.index = 0
self.back_opacity = 160
end
#--------------------------------------------------------------------------
# â— define skill
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# â— refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for action in @actor.actions
if action.kind == 1
unless $data_skills[action.skill_id].stealable == false
@data.push($data_skills[action.skill_id])
end
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# â— draw item
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 160
if $game_party.skills.include?(skill.id)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
else
self.contents.draw_text(x, y, 204, 32, "???", 0)
end
end
#--------------------------------------------------------------------------
# â— help window text settings
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
end
#==============================================================================
# â– Window_StealSelect
#==============================================================================
class Window_StealSelect < Window_Selectable
#--------------------------------------------------------------------------
# â— initialize
#--------------------------------------------------------------------------
def initialize
@item_max = $game_troop.enemies.size
super(0, 160 + (160 - @item_max * 32 - 32), 160, @item_max * 32 + 32)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
self.index = 0
self.back_opacity = 160
end
#--------------------------------------------------------------------------
# â— enemy
#--------------------------------------------------------------------------
def enemy
return @data[self.index]
end
#--------------------------------------------------------------------------
# â— refresh
#--------------------------------------------------------------------------
def refresh
@data = []
for i in 0...$game_troop.enemies.size
enemy = $game_troop.enemies
if enemy != nil
@data.push(enemy)
end
end
@item_max = @data.size
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# â— draw item
#--------------------------------------------------------------------------
def draw_item(index)
enemy = @data[index]
if enemy.dead?
self.contents.font.color = disabled_color
else
self.contents.font.color = normal_color
end
x = 4
y = index * 32
self.contents.draw_text(4, y, 80, 32, enemy.name)
end
end
#==============================================================================
# â– Interpreter
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# â— skill MN_event_magic
#--------------------------------------------------------------------------
def command_318
actor = $game_actors[@parameters[0]]
if actor != nil
algo = rand(3)
algo *= 10/3
chance = [[algo, 10].min, 10].max
if @parameters[1] == 0
actor.gain_skill(@parameters[2], chance) #chance for number of skills earned
else
actor.lose_skill(@parameters[2], chance) #chance for number of skills loosed
end
end
return true
end
end
#==============================================================================
# â– Scene_Skill
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
# â— initialize
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
# â— main
#--------------------------------------------------------------------------
def main
@actor = $game_party.actors[@actor_index]
@help_window = Window_Help.new
@status_window = Window_SkillStatus.new(@actor)
@skill_window = Window_Skill.new(@actor)
@skill_window.help_window = @help_window
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
@status_window.dispose
@skill_window.dispose
@target_window.dispose
end
#--------------------------------------------------------------------------
# â— update the windows
#--------------------------------------------------------------------------
def update
@help_window.update
@status_window.update
@skill_window.update
@target_window.update
if @skill_window.active
update_skill
return
end
if @target_window.active
update_target
return
end
end
#--------------------------------------------------------------------------
# â— update the skill window
#--------------------------------------------------------------------------
def update_skill
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(1)
return
end
if Input.trigger?(Input::C)
@skill = @skill_window.skill
if @skill == nil or not @actor.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
if @skill.scope >= 3
@skill_window.active = false
@target_window.x = (@skill_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
if @skill.scope == 4 || @skill.scope == 6
@target_window.index = -1
elsif @skill.scope == 7
@target_window.index = @actor_index - 10
else
@target_window.index = 0
end
else
if @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$game_system.se_play(@skill.menu_se)
# we substract one to the skill value
unless @skill.consumable == false
@actor.lose_skill(@skill.id, 1)
end
@status_window.refresh
@skill_window.refresh
@target_window.refresh
$scene = Scene_Map.new
return
end
end
return
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill.new(@actor_index)
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill.new(@actor_index)
return
end
end
#--------------------------------------------------------------------------
# â— update the target window
#--------------------------------------------------------------------------
def update_target
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@skill_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
if Input.trigger?(Input::C)
unless @actor.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
if @target_window.index == -1
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
if @target_window.index <= -2
target = $game_party.actors[@target_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
if @target_window.index >= 0
target = $game_party.actors[@target_window.index]
used = target.skill_effect(@actor, @skill)
end
if used
$game_system.se_play(@skill.menu_se)
# we substract one to the skill value
unless @skill.consumable == false
@actor.lose_skill(@skill.id, 1)
end
@status_window.refresh
@skill_window.refresh
@target_window.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
return
end
if @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$scene = Scene_Map.new
return
end
end
unless used
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
#==============================================================================
# â– Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# â— main
#--------------------------------------------------------------------------
def main
$game_temp.in_battle = true
$game_temp.battle_turn = 0
$game_temp.battle_event_flags.clear
$game_temp.battle_abort = false
$game_temp.battle_main_phase = false
$game_temp.battleback_name = $game_map.battleback_name
$game_temp.forcing_battler = nil
$game_system.battle_interpreter.setup(nil, 0)
@troop_id = $game_temp.battle_troop_id
$game_troop.setup(@troop_id)
s1 = $data_system.words.attack
s2 = $data_system.words.skill
s5 = "Steal Skill"
s4 = $data_system.words.item
s3= $data_system.words.guard
@actor_command_window = Window_Command.new(160, [s1, s2, s3, s4, s5])
@actor_command_window.y = 160
@actor_command_window.height = 160
@actor_command_window.back_opacity = 160
@actor_command_window.active = false
@actor_command_window.visible = false
@party_command_window = Window_PartyCommand.new
@help_window = Window_Help.new
@help_window.back_opacity = 160
@help_window.visible = false
@status_window = Window_BattleStatus.new
@message_window = Window_Message.new
@spriteset = Spriteset_Battle.new
@wait_count = 0
if $data_system.battle_transition == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$data_system.battle_transition)
end
start_phase1
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
$game_map.refresh
Graphics.freeze
@actor_command_window.dispose
@party_command_window.dispose
@help_window.dispose
@status_window.dispose
@message_window.dispose
if @skill_window != nil
@skill_window.dispose
end
if @steal_window != nil
@steal_window.dispose
end
if @item_window != nil
@item_window.dispose
end
if @select_window != nil
@select_window.dispose
end
if @result_window != nil
@result_window.dispose
end
@spriteset.dispose
if $scene.is_a?(Scene_Title)
Graphics.transition
Graphics.freeze
end
if $BTEST and not $scene.is_a?(Scene_Gameover)
$scene = nil
end
end
#--------------------------------------------------------------------------
# â— update the windows
#--------------------------------------------------------------------------
def update_phase3
if @enemy_arrow != nil
update_phase3_enemy_select
elsif @actor_arrow != nil
update_phase3_actor_select
elsif @skill_window != nil
update_phase3_skill_select
elsif @item_window != nil
update_phase3_item_select
elsif @steal_window != nil
update_steal
elsif @select_window != nil
update_steal_select
elsif @type_window != nil
update_type
elsif @actor_command_window.active
update_phase3_basic_command
end
end
#--------------------------------------------------------------------------
# â— make the basic commands results
#--------------------------------------------------------------------------
def update_phase3_basic_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
phase3_prior_actor
return
end
if Input.trigger?(Input::C)
case @actor_command_window.index
when 0 # Attack
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
start_enemy_select
when 1 # Skill
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 1
start_skill_select
when 2 # Defend
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 1
phase3_next_actor
when 3 # Item
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 2
start_item_select
when 4 # Steal
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 3
start_steal_type
end
return
end
end
#--------------------------------------------------------------------------
# â— update the type window (Steal Part1)
#--------------------------------------------------------------------------
def update_type
@type_window.visible = true
@type_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
end_steal_type
@actor_command_window.active = true
@actor_command_window.visible = true
@active_battler.current_action.steal_kind = 0
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
end_steal_type
start_steal_enemy_select
return
end
end
#--------------------------------------------------------------------------
# â— update the steal enemy select window (Steal Part2)
#--------------------------------------------------------------------------
def update_steal_select
@select_window.visible = true
@select_window.update
if Input.trigger?(Input::B)
end_steal_enemy_select
start_steal_type
return
end
if Input.trigger?(Input::C)
if @select_window.enemy.dead?
$game_system.se_play($data_system.cancel_se)
return
end
$game_system.se_play($data_system.decision_se)
end_steal_enemy_select
start_steal_select
return
end
end
#--------------------------------------------------------------------------
# â— update the steal window (Steal Part3)
#--------------------------------------------------------------------------
def update_steal
@steal_window.visible = true
@steal_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
end_steal_select
start_steal_enemy_select
return
end
if Input.trigger?(Input::C)
@skill = @steal_window.skill
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.skill_id = @skill.id
@steal_window.visible = false
if @active_battler.current_action.steal_kind == 1
if $data_skills[@skill.id].scope == 1
start_enemy_select
elsif $data_skills[@skill.id].scope == 3
start_actor_select
else
$game_system.se_play($data_system.buzzer_se)
return
end
else
end_steal_select
phase3_next_actor
end
return
end
end
#--------------------------------------------------------------------------
# â— enemy select
#--------------------------------------------------------------------------
def update_phase3_enemy_select
@enemy_arrow.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
end_enemy_select
if @active_battler.current_action.steal_kind == 1
start_steal_select
end
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.target_index = @enemy_arrow.index
end_enemy_select
if @skill_window != nil
end_skill_select
end
if @item_window != nil
end_item_select
end
if @steal_window != nil
end_steal_select
end
phase3_next_actor
end
end
#--------------------------------------------------------------------------
# â— actor select
#--------------------------------------------------------------------------
def update_phase3_actor_select
@actor_arrow.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
end_actor_select
if @active_battler.current_action.steal_kind == 1
start_steal_select
end
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.target_index = @actor_arrow.index
end_actor_select
if @skill_window != nil
end_skill_select
end
if @item_window != nil
end_item_select
end
if @steal_window != nil
end_steal_select
end
phase3_next_actor
end
end
#--------------------------------------------------------------------------
# â— start steal type
#--------------------------------------------------------------------------
def start_steal_type
@active_battler.current_action.steal_kind = 0
@type_window = Window_Command.new(160, ["Steal Skill", "Use"])
@type_window.y = 224
@type_window.x = @actor_index * 160
@type_window.back_opacity = 160
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# â— end steal type
#--------------------------------------------------------------------------
def end_steal_type
@active_battler.current_action.steal_kind = @type_window.index
@type_window.dispose
@type_window = nil
end
#--------------------------------------------------------------------------
# â— start steal enemy select
#--------------------------------------------------------------------------
def start_steal_enemy_select
@select_window = Window_StealSelect.new
@select_window.x = @actor_index * 160
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# â— end steal enemy select
#--------------------------------------------------------------------------
def end_steal_enemy_select
@enemy_index = @select_window.index
@active_battler.current_action.steal_target = @select_window.index
@active_battler.current_action.target_index = @select_window.index
@select_window.dispose
@select_window = nil
end
#--------------------------------------------------------------------------
# â— start steal select
#--------------------------------------------------------------------------
def start_steal_select
@steal_window = Window_SkillSteal.new($game_troop.enemies[@enemy_index])
@steal_window.help_window = @help_window
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# â— end steal select
#--------------------------------------------------------------------------
def end_steal_select
@steal_window.dispose
@steal_window = nil
@help_window.visible = false
end
#--------------------------------------------------------------------------
# â— update 4th phase 2nd part
#--------------------------------------------------------------------------
def update_phase4_step2
unless @active_battler.current_action.forcing
if @active_battler.restriction == 2 or @active_battler.restriction == 3
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
end
if @active_battler.restriction == 4
$game_temp.forcing_battler = nil
@phase4_step = 1
return
end
end
@target_battlers = []
case @active_battler.current_action.kind
when 0 # Basic
make_basic_action_result
when 1 # Skill
make_skill_action_result
when 2 # Item
make_item_action_result
when 3 # Steal
make_steal_action_result
end
if @phase4_step == 2
@phase4_step = 3
end
end
#--------------------------------------------------------------------------
# â— make the result of a skill use
#--------------------------------------------------------------------------
def make_skill_action_result
@skill = $data_skills[@active_battler.current_action.skill_id]
unless @active_battler.current_action.forcing
unless @active_battler.skill_can_use?(@skill.id)
$game_temp.forcing_battler = nil
@phase4_step = 1
return
end
end
# we substract the sp cost of the skill to the sp (if user is enemy)
if @active_battler.is_a?(Game_Enemy)
@active_battler.sp -= @skill.sp_cost
# we substract one to the skill value (if user is actor)
elsif @active_battler.is_a?(Game_Actor)
unless @skill.consumable == false
@active_battler.lose_skill(@skill.id, 1)
end
end
@status_window.refresh
@help_window.set_text(@skill.name, 1)
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
@common_event_id = @skill.common_event_id
set_target_battlers(@skill.scope)
for target in @target_battlers
target.skill_effect(@active_battler, @skill)
end
end
#--------------------------------------------------------------------------
# â— make results for a steal MN_steal_rate
#--------------------------------------------------------------------------
def make_steal_action_result
# if actor is keeping the magic to be stolen
if @active_battler.current_action.steal_kind == 0
algo = rand(3)
algo *= 10/3
chance = [[algo, 10].min, 1].max
skill_id = @active_battler.current_action.skill_id
index = @active_battler.current_action.target_index
enemy = $game_troop.enemies[index]
if enemy.dead?
@active_battler.damage_pop = true
@active_battler.damage = "steal missed"
else
@active_battler.gain_skill(skill_id, chance)
@active_battler.damage_pop = true
@active_battler.damage = "+ #{chance} #{$data_skills[skill_id].name } !!"
$game_system.se_play($data_system.save_se)
end
#if actor is using the magic to be stolen
elsif @active_battler.current_action.steal_kind == 1
skill_id = @active_battler.current_action.skill_id
index = @active_battler.current_action.steal_target
enemy = $game_troop.enemies[index]
if enemy.dead?
@active_battler.damage_pop = true
@active_battler.damage = "steal missed"
else
@active_battler.gain_skill(skill_id, 1)
make_skill_action_result
end
end
end
end
#============================================================================
# â– RPG::Skill
#============================================================================
class Skill
#------------------------------------------------------------------------
# â— define instance variable
#------------------------------------------------------------------------
attr_accessor :stealable
attr_accessor :consumable
#------------------------------------------------------------------------
# â— define wether a skill can be stolen or not
# change this part with skills's id that you don't want to be stolen
# false : non-stealable
# true : stealable
# id : id of the skill (found in the database)
#
# the part below litteraly means : if the skill's id is 1 or 2 then
# the skill cannot be stolen if else : it can be...
#------------------------------------------------------------------------
def stealable
case @id
when 1
@stealable = true
when 2
@stealable = false
else
@stealable = true
end
end
#------------------------------------------------------------------------
# â— define wether a skill can be stolen or not
# change this part with skills's id that you don't want to be consumed
# false : non-consumable meaning permanent skill
# true : consumable
# id : id of the skill (found in the database)
#
# the part below litteraly means : if the skill's id is 5 or 7 then
# the skill cannot be consumed if else : it can be...
#------------------------------------------------------------------------
def consumable
case @id
when 4
@consumable = false
when 7
@consumable = false
else
@consumable = true
end
end
end
end
#==============================================================================
# â– Game_Party
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# â— define instance variable
#--------------------------------------------------------------------------
attr_accessor :actors
attr_accessor :skills
attr_reader :gold
attr_reader :steps
#--------------------------------------------------------------------------
# â— initialize
#--------------------------------------------------------------------------
def initialize
@skills = []
@actors = []
@gold = 0
@steps = 0
@items = {}
@weapons = {}
@armors = {}
end
end
#==============================================================================
# â– Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# â— define wether a skill can be used or not
#--------------------------------------------------------------------------
def skill_can_use?(skill_id)
if self.is_a?(Game_Actor)
if self.skill_number(skill_id) <= 0
return false
end
end
if self.is_a?(Game_Enemy)
if $data_skills[skill_id].sp_cost > self.sp
return false
end
end
if dead?
return false
end
if $data_skills[skill_id].atk_f == 0 and self.restriction == 1
return false
end
occasion = $data_skills[skill_id].occasion
if $game_temp.in_battle
return (occasion == 0 or occasion == 1)
else
return (occasion == 0 or occasion == 2)
end
end
end
#==============================================================================
# â– Game_BattleAction
#==============================================================================
class Game_BattleAction
#--------------------------------------------------------------------------
# â— define instance variable
#--------------------------------------------------------------------------
attr_accessor :steal_kind
attr_accessor :steal_target
#--------------------------------------------------------------------------
# â— clear
#--------------------------------------------------------------------------
def clear
@speed = 0
@kind = 0
@basic = 3
@skill_id = 0
@item_id = 0
@steal_kind = 0
@target_index = -1
@steal_target = -1
@forcing = false
end
end
#==============================================================================
# â– Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# â— setup
#--------------------------------------------------------------------------
def setup(actor_id)
actor = $data_actors[actor_id]
@actor_id = actor_id
@name = actor.name
@character_name = actor.character_name
@character_hue = actor.character_hue
@battler_name = actor.battler_name
@battler_hue = actor.battler_hue
@class_id = actor.class_id
@weapon_id = actor.weapon_id
@armor1_id = actor.armor1_id
@armor2_id = actor.armor2_id
@armor3_id = actor.armor3_id
@armor4_id = actor.armor4_id
@level = actor.initial_level
@exp_list = Array.new(101)
make_exp_list
@exp = @exp_list[@level]
#here we set that skills will be a Hash and not an Array
#this allow to have the skills and a value for the skills
#for this situation we use the value as the number of the skill we possess
@skills = {}
@hp = maxhp
@sp = maxsp
@states = []
@states_turn = {}
@maxhp_plus = 0
@maxsp_plus = 0
@str_plus = 0
@dex_plus = 0
@agi_plus = 0
@int_plus = 0
for i in 1..@level
for j in $data_classes[@class_id].learnings
if j.level == i
gain_skill(j.skill_id, 10) # add 10 of each skills actor learns
# at level 1...
end
end
end
update_auto_state(nil, $data_armors[@armor1_id])
update_auto_state(nil, $data_armors[@armor2_id])
update_auto_state(nil, $data_armors[@armor3_id])
update_auto_state(nil, $data_armors[@armor4_id])
end
#--------------------------------------------------------------------------
# â— define a method to change the exp value
# I redefine this one because of the skill learning
#--------------------------------------------------------------------------
def exp=(exp)
@exp = [[exp, 9999999].min, 0].max
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
@level += 1
for j in $data_classes[@class_id].learnings
if j.level == @level
gain_skill(j.skill_id, 10)
end
end
end
while @exp < @exp_list[@level]
@level -= 1
end
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end
#--------------------------------------------------------------------------
# â— gain a skill (skill id, number) MN_skill_value
#--------------------------------------------------------------------------
def gain_skill(skill_id, n)
if skill_id > 0
@skills[skill_id] = [[skill_number(skill_id) + n, 0].max, 99].min
#the "unless" part is needed to determine if a skill has ever been stolen
unless $game_party.skills.include?(skill_id)
$game_party.skills.push(skill_id)
end
end
end
#--------------------------------------------------------------------------
# â— lose a skill (skill id, number)
#--------------------------------------------------------------------------
def lose_skill(skill_id, n)
gain_skill(skill_id, -n)
end
#--------------------------------------------------------------------------
# â— check and return the value (number) of a skill
#--------------------------------------------------------------------------
def skill_number(skill_id)
return @skills.include?(skill_id) ? @skills[skill_id] : 0
end
#--------------------------------------------------------------------------
# â— define wether a skill can be used or not
#--------------------------------------------------------------------------
def skill_can_use?(skill_id)
if skill_number(skill_id) <= 0
return false
end
return super
end
end
#==============================================================================
# â– Window_Skill
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# â— initialize
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 128, 640, 352)
@actor = actor
@column_max = 2
refresh
self.index = 0
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 160
end
end
#--------------------------------------------------------------------------
# â— define skill
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# â— refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_skills.size
if @actor.skill_number(i) > 0
@data.push($data_skills)
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# â— draw_item
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.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)
if skill.consumable
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
self.contents.draw_text(x + 232, y, 48, 32, @actor.skill_number(skill.id).to_s, 2)
else
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
end
end
#--------------------------------------------------------------------------
# â— help window text settings
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
end
#==============================================================================
# â– Window_Steal
#==============================================================================
class Window_SkillSteal < Window_Selectable
#--------------------------------------------------------------------------
# â— initialize
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 64, 640, 256)
@actor = actor
@column_max = 2
refresh
self.index = 0
self.back_opacity = 160
end
#--------------------------------------------------------------------------
# â— define skill
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# â— refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for action in @actor.actions
if action.kind == 1
unless $data_skills[action.skill_id].stealable == false
@data.push($data_skills[action.skill_id])
end
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# â— draw item
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 160
if $game_party.skills.include?(skill.id)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
else
self.contents.draw_text(x, y, 204, 32, "???", 0)
end
end
#--------------------------------------------------------------------------
# â— help window text settings
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
end
#==============================================================================
# â– Window_StealSelect
#==============================================================================
class Window_StealSelect < Window_Selectable
#--------------------------------------------------------------------------
# â— initialize
#--------------------------------------------------------------------------
def initialize
@item_max = $game_troop.enemies.size
super(0, 160 + (160 - @item_max * 32 - 32), 160, @item_max * 32 + 32)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
self.index = 0
self.back_opacity = 160
end
#--------------------------------------------------------------------------
# â— enemy
#--------------------------------------------------------------------------
def enemy
return @data[self.index]
end
#--------------------------------------------------------------------------
# â— refresh
#--------------------------------------------------------------------------
def refresh
@data = []
for i in 0...$game_troop.enemies.size
enemy = $game_troop.enemies
if enemy != nil
@data.push(enemy)
end
end
@item_max = @data.size
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# â— draw item
#--------------------------------------------------------------------------
def draw_item(index)
enemy = @data[index]
if enemy.dead?
self.contents.font.color = disabled_color
else
self.contents.font.color = normal_color
end
x = 4
y = index * 32
self.contents.draw_text(4, y, 80, 32, enemy.name)
end
end
#==============================================================================
# â– Interpreter
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# â— skill MN_event_magic
#--------------------------------------------------------------------------
def command_318
actor = $game_actors[@parameters[0]]
if actor != nil
algo = rand(3)
algo *= 10/3
chance = [[algo, 10].min, 10].max
if @parameters[1] == 0
actor.gain_skill(@parameters[2], chance) #chance for number of skills earned
else
actor.lose_skill(@parameters[2], chance) #chance for number of skills loosed
end
end
return true
end
end
#==============================================================================
# â– Scene_Skill
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
# â— initialize
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
# â— main
#--------------------------------------------------------------------------
def main
@actor = $game_party.actors[@actor_index]
@help_window = Window_Help.new
@status_window = Window_SkillStatus.new(@actor)
@skill_window = Window_Skill.new(@actor)
@skill_window.help_window = @help_window
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
@status_window.dispose
@skill_window.dispose
@target_window.dispose
end
#--------------------------------------------------------------------------
# â— update the windows
#--------------------------------------------------------------------------
def update
@help_window.update
@status_window.update
@skill_window.update
@target_window.update
if @skill_window.active
update_skill
return
end
if @target_window.active
update_target
return
end
end
#--------------------------------------------------------------------------
# â— update the skill window
#--------------------------------------------------------------------------
def update_skill
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(1)
return
end
if Input.trigger?(Input::C)
@skill = @skill_window.skill
if @skill == nil or not @actor.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
if @skill.scope >= 3
@skill_window.active = false
@target_window.x = (@skill_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
if @skill.scope == 4 || @skill.scope == 6
@target_window.index = -1
elsif @skill.scope == 7
@target_window.index = @actor_index - 10
else
@target_window.index = 0
end
else
if @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$game_system.se_play(@skill.menu_se)
# we substract one to the skill value
unless @skill.consumable == false
@actor.lose_skill(@skill.id, 1)
end
@status_window.refresh
@skill_window.refresh
@target_window.refresh
$scene = Scene_Map.new
return
end
end
return
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill.new(@actor_index)
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill.new(@actor_index)
return
end
end
#--------------------------------------------------------------------------
# â— update the target window
#--------------------------------------------------------------------------
def update_target
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@skill_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
if Input.trigger?(Input::C)
unless @actor.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
if @target_window.index == -1
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
if @target_window.index <= -2
target = $game_party.actors[@target_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
if @target_window.index >= 0
target = $game_party.actors[@target_window.index]
used = target.skill_effect(@actor, @skill)
end
if used
$game_system.se_play(@skill.menu_se)
# we substract one to the skill value
unless @skill.consumable == false
@actor.lose_skill(@skill.id, 1)
end
@status_window.refresh
@skill_window.refresh
@target_window.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
return
end
if @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$scene = Scene_Map.new
return
end
end
unless used
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
#==============================================================================
# â– Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# â— main
#--------------------------------------------------------------------------
def main
$game_temp.in_battle = true
$game_temp.battle_turn = 0
$game_temp.battle_event_flags.clear
$game_temp.battle_abort = false
$game_temp.battle_main_phase = false
$game_temp.battleback_name = $game_map.battleback_name
$game_temp.forcing_battler = nil
$game_system.battle_interpreter.setup(nil, 0)
@troop_id = $game_temp.battle_troop_id
$game_troop.setup(@troop_id)
s1 = $data_system.words.attack
s2 = $data_system.words.skill
s5 = "Steal Skill"
s4 = $data_system.words.item
s3= $data_system.words.guard
@actor_command_window = Window_Command.new(160, [s1, s2, s3, s4, s5])
@actor_command_window.y = 160
@actor_command_window.height = 160
@actor_command_window.back_opacity = 160
@actor_command_window.active = false
@actor_command_window.visible = false
@party_command_window = Window_PartyCommand.new
@help_window = Window_Help.new
@help_window.back_opacity = 160
@help_window.visible = false
@status_window = Window_BattleStatus.new
@message_window = Window_Message.new
@spriteset = Spriteset_Battle.new
@wait_count = 0
if $data_system.battle_transition == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$data_system.battle_transition)
end
start_phase1
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
$game_map.refresh
Graphics.freeze
@actor_command_window.dispose
@party_command_window.dispose
@help_window.dispose
@status_window.dispose
@message_window.dispose
if @skill_window != nil
@skill_window.dispose
end
if @steal_window != nil
@steal_window.dispose
end
if @item_window != nil
@item_window.dispose
end
if @select_window != nil
@select_window.dispose
end
if @result_window != nil
@result_window.dispose
end
@spriteset.dispose
if $scene.is_a?(Scene_Title)
Graphics.transition
Graphics.freeze
end
if $BTEST and not $scene.is_a?(Scene_Gameover)
$scene = nil
end
end
#--------------------------------------------------------------------------
# â— update the windows
#--------------------------------------------------------------------------
def update_phase3
if @enemy_arrow != nil
update_phase3_enemy_select
elsif @actor_arrow != nil
update_phase3_actor_select
elsif @skill_window != nil
update_phase3_skill_select
elsif @item_window != nil
update_phase3_item_select
elsif @steal_window != nil
update_steal
elsif @select_window != nil
update_steal_select
elsif @type_window != nil
update_type
elsif @actor_command_window.active
update_phase3_basic_command
end
end
#--------------------------------------------------------------------------
# â— make the basic commands results
#--------------------------------------------------------------------------
def update_phase3_basic_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
phase3_prior_actor
return
end
if Input.trigger?(Input::C)
case @actor_command_window.index
when 0 # Attack
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
start_enemy_select
when 1 # Skill
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 1
start_skill_select
when 2 # Defend
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 1
phase3_next_actor
when 3 # Item
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 2
start_item_select
when 4 # Steal
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 3
start_steal_type
end
return
end
end
#--------------------------------------------------------------------------
# â— update the type window (Steal Part1)
#--------------------------------------------------------------------------
def update_type
@type_window.visible = true
@type_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
end_steal_type
@actor_command_window.active = true
@actor_command_window.visible = true
@active_battler.current_action.steal_kind = 0
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
end_steal_type
start_steal_enemy_select
return
end
end
#--------------------------------------------------------------------------
# â— update the steal enemy select window (Steal Part2)
#--------------------------------------------------------------------------
def update_steal_select
@select_window.visible = true
@select_window.update
if Input.trigger?(Input::B)
end_steal_enemy_select
start_steal_type
return
end
if Input.trigger?(Input::C)
if @select_window.enemy.dead?
$game_system.se_play($data_system.cancel_se)
return
end
$game_system.se_play($data_system.decision_se)
end_steal_enemy_select
start_steal_select
return
end
end
#--------------------------------------------------------------------------
# â— update the steal window (Steal Part3)
#--------------------------------------------------------------------------
def update_steal
@steal_window.visible = true
@steal_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
end_steal_select
start_steal_enemy_select
return
end
if Input.trigger?(Input::C)
@skill = @steal_window.skill
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.skill_id = @skill.id
@steal_window.visible = false
if @active_battler.current_action.steal_kind == 1
if $data_skills[@skill.id].scope == 1
start_enemy_select
elsif $data_skills[@skill.id].scope == 3
start_actor_select
else
$game_system.se_play($data_system.buzzer_se)
return
end
else
end_steal_select
phase3_next_actor
end
return
end
end
#--------------------------------------------------------------------------
# â— enemy select
#--------------------------------------------------------------------------
def update_phase3_enemy_select
@enemy_arrow.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
end_enemy_select
if @active_battler.current_action.steal_kind == 1
start_steal_select
end
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.target_index = @enemy_arrow.index
end_enemy_select
if @skill_window != nil
end_skill_select
end
if @item_window != nil
end_item_select
end
if @steal_window != nil
end_steal_select
end
phase3_next_actor
end
end
#--------------------------------------------------------------------------
# â— actor select
#--------------------------------------------------------------------------
def update_phase3_actor_select
@actor_arrow.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
end_actor_select
if @active_battler.current_action.steal_kind == 1
start_steal_select
end
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.target_index = @actor_arrow.index
end_actor_select
if @skill_window != nil
end_skill_select
end
if @item_window != nil
end_item_select
end
if @steal_window != nil
end_steal_select
end
phase3_next_actor
end
end
#--------------------------------------------------------------------------
# â— start steal type
#--------------------------------------------------------------------------
def start_steal_type
@active_battler.current_action.steal_kind = 0
@type_window = Window_Command.new(160, ["Steal Skill", "Use"])
@type_window.y = 224
@type_window.x = @actor_index * 160
@type_window.back_opacity = 160
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# â— end steal type
#--------------------------------------------------------------------------
def end_steal_type
@active_battler.current_action.steal_kind = @type_window.index
@type_window.dispose
@type_window = nil
end
#--------------------------------------------------------------------------
# â— start steal enemy select
#--------------------------------------------------------------------------
def start_steal_enemy_select
@select_window = Window_StealSelect.new
@select_window.x = @actor_index * 160
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# â— end steal enemy select
#--------------------------------------------------------------------------
def end_steal_enemy_select
@enemy_index = @select_window.index
@active_battler.current_action.steal_target = @select_window.index
@active_battler.current_action.target_index = @select_window.index
@select_window.dispose
@select_window = nil
end
#--------------------------------------------------------------------------
# â— start steal select
#--------------------------------------------------------------------------
def start_steal_select
@steal_window = Window_SkillSteal.new($game_troop.enemies[@enemy_index])
@steal_window.help_window = @help_window
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# â— end steal select
#--------------------------------------------------------------------------
def end_steal_select
@steal_window.dispose
@steal_window = nil
@help_window.visible = false
end
#--------------------------------------------------------------------------
# â— update 4th phase 2nd part
#--------------------------------------------------------------------------
def update_phase4_step2
unless @active_battler.current_action.forcing
if @active_battler.restriction == 2 or @active_battler.restriction == 3
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
end
if @active_battler.restriction == 4
$game_temp.forcing_battler = nil
@phase4_step = 1
return
end
end
@target_battlers = []
case @active_battler.current_action.kind
when 0 # Basic
make_basic_action_result
when 1 # Skill
make_skill_action_result
when 2 # Item
make_item_action_result
when 3 # Steal
make_steal_action_result
end
if @phase4_step == 2
@phase4_step = 3
end
end
#--------------------------------------------------------------------------
# â— make the result of a skill use
#--------------------------------------------------------------------------
def make_skill_action_result
@skill = $data_skills[@active_battler.current_action.skill_id]
unless @active_battler.current_action.forcing
unless @active_battler.skill_can_use?(@skill.id)
$game_temp.forcing_battler = nil
@phase4_step = 1
return
end
end
# we substract the sp cost of the skill to the sp (if user is enemy)
if @active_battler.is_a?(Game_Enemy)
@active_battler.sp -= @skill.sp_cost
# we substract one to the skill value (if user is actor)
elsif @active_battler.is_a?(Game_Actor)
unless @skill.consumable == false
@active_battler.lose_skill(@skill.id, 1)
end
end
@status_window.refresh
@help_window.set_text(@skill.name, 1)
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
@common_event_id = @skill.common_event_id
set_target_battlers(@skill.scope)
for target in @target_battlers
target.skill_effect(@active_battler, @skill)
end
end
#--------------------------------------------------------------------------
# â— make results for a steal MN_steal_rate
#--------------------------------------------------------------------------
def make_steal_action_result
# if actor is keeping the magic to be stolen
if @active_battler.current_action.steal_kind == 0
algo = rand(3)
algo *= 10/3
chance = [[algo, 10].min, 1].max
skill_id = @active_battler.current_action.skill_id
index = @active_battler.current_action.target_index
enemy = $game_troop.enemies[index]
if enemy.dead?
@active_battler.damage_pop = true
@active_battler.damage = "steal missed"
else
@active_battler.gain_skill(skill_id, chance)
@active_battler.damage_pop = true
@active_battler.damage = "+ #{chance} #{$data_skills[skill_id].name } !!"
$game_system.se_play($data_system.save_se)
end
#if actor is using the magic to be stolen
elsif @active_battler.current_action.steal_kind == 1
skill_id = @active_battler.current_action.skill_id
index = @active_battler.current_action.steal_target
enemy = $game_troop.enemies[index]
if enemy.dead?
@active_battler.damage_pop = true
@active_battler.damage = "steal missed"
else
@active_battler.gain_skill(skill_id, 1)
make_skill_action_result
end
end
end
end
For some reason the won't play nice together..it goes all smoothly until I get into battle and try to use one of them,only the script closest to the Main script (currently the Magic Number script) works perfectly while the other one either doesn't do it's function acting like there isn't one. And when it's the other way around having the Equip script colsest to Main the Equip works perfectly but when I try to use the Magic Number the battle freezes/game freezes...DerVVulfman suggested it may have to do with the phase3 section but didn't seem to work....
any suggestions would be greatly appreciated! :D :thumb: