Hello guys, I would like to add two features to system Scene_Skill and system Scene_Item !
In Scene_Skill I want to separate Black and White Magic... like in picture(I've created it with photoshop and I've forgotten help_window XD )
(http://i58.tinypic.com/qoj0k3.jpg)
(http://i59.tinypic.com/6i4is1.jpg)
For example if a skill had "White" attribute I can see it in White list, otherwise if a skill had "Black" attribute I can see it in Black.
In Scene_Item, I want to split items in "Items" and "Key Items"...like in picture(I've created it with photoshop and I've forgotten help_window XD )
(http://i62.tinypic.com/24dhvud.jpg)
(http://i60.tinypic.com/t0n39w.jpg)
For example if an item had "NoKey" attribute I can see it in Items list, otherwise if an item had "Key" attribute I can see it in "Key Item". In both categories I want to hide Equipment items.
I hope it's an easy thing to realize. :D
The skill separation system has been written a few times by now. Tons has one. G_G wrote one. I can basically use one of their systems and tweak the windows a bit to show specific categories.
Because you're missing the help window in your images, I was thinking of making the top-most window the help window. The other window will contain the different categories. Throw in a cursor to select one of the options and done.
Enter Menu > Select Skills > Select Actor
Go to Scene_Skill > Cursor over first category, Help Window gives description of category, Draws items in the window
User can input left or right to select category, Items update accordingly
User presses C > Moves the cursor to the skill window like the default system, Help window shows skill description
User presses B > Returns cursor back to category selection
---------------------------------
Offensive Dark Magic
---------------------------------
---------------------------------
{ B. Mag } W. Mag
---------------------------------
---------------------------------
[] Fire
[] Ice
[] Lightning
---------------------------------
The item windows would follow the same design.
Yes :D Is what I'm searching for! Obviously the images were indicative to show how the system would be!
So do you want it under Tons or G_G's script?
I can easily write a key items add-on.
Sorry but what is Tons or G_G's? I'm Italian and sometimes I don't understand
Tons of Add-ons: http://forum.chaos-project.com/index.php/topic,105.0.html
G_G's/gameus's script: http://forum.chaos-project.com/index.php/topic,13055.0.html
You can use the method that you want or that is simpler, I have no preference in this regard. For me it's important, however, that the scripts will not add other features in addition to those described
Good news! I've created my personal system of item categorization by editing the script: Bob's Item menu... Now I can select Items or Rare Items from Main Menu :D
Now I only need help for skill categorization ... :) :) :)
Alright, I'm using G_G's script. Should be easy to tweak around.
Thanks: D I've taken a look at the script G_G, but I was confused and I gave up. XD
Alright, here's a modified version of his script.
#===============================================================================
# Skill Categories
# Version 1.3
# Author gameus
#-------------------------------------------------------------------------------
# Intro:
# Adds Skill Categories to the Default Battle System. For every Skill Category
# your actor gets a new command, assuming they know skills from that category.
# Actors also get their default "Skill" command.
#
# Features:
# -Adds new battle commands for each category
# -Separates all skills from every other category/normal category
# -All skills still display in the normal Skill Scene
# -Have as many categories as you want
#
# Version History:
# 1.3 - Added compatibility with Chaos Rage Limit System by Blizzard
# 1.2 - Fixed small bug with Easy Overdrive System by Blizzard
# 1.1 - Added compatibility with Easy Overdrive System by Blizzard
# 1.0 - Initial Release
#
# Instructions:
# Jump down to the configuration, here's where you will define your Skill
# Categories.
# SKILL_SETS = {
# "Rank 1" => 17,
# "Rank 2" => 18,
# "Rank 3" => 19,
# }
# To add a new category, add a new line under the last category and follow
# the template:
# "Category Name" => Element_Id,
# Name it whatever, and make sure to give it an unused element id.
#
# To add skills to these categories, you have to add these elements to the
# skills. Say you wanted Skills 1, 2, 3 to be under the category with the
# element id of 17, these three skills need to have element id 17 in order
# to be considered in that category.
#
# Compatibility:
# -Not tested with anything other than the default battle system.
# -Will not work with Skill Separation add-on from Tons of Add-ons by Blizzard
# But this script would be useless if you were to use it.
# -Will work with Battle Memory Commands by gameus
# -Will not work properly with Battle Icons by Juan, however, other scripts
# that add similar functionality should work depending on the naming
# conventions that are required.
# -Not tested with SDK (Probably won't work)
# -Works perfectly with Easy Overdrive System by Blizzard. Place this script
# below his.
# -If you run into any other scripts that don't work with it, just post it in
# the topic and I'll try to look at it.
# -Works with Unique Skill Commands by Blizzard.
# -Works with Chaos Rage Limit System by Blizzard, make sure you place this
# script below it.
#
# Credits:
# gameus ~ For creating it
# MarkHest ~ For requesting it and testing it
#===============================================================================
module Gameus
SKILL_SETS = {
"White Magic" => 17,
"Black Magic" => 18,
"Rank 3" => 19,
}
def self.skill_help(category)
case category
when "White Magic" then 'Defensive magic that heals and protects allies'
when "Black Magic" then 'Offensive magic that damages enemies'
when "Rank 3" then 'High level magic'
else
'Abilities unique to that of the actor'
end
end
end
$gg_skill_categories = 1.3
#-------------------------------------------------------------------------------
# Scene_Battle
#-------------------------------------------------------------------------------
class Scene_Battle
alias gg_phase3_setup_command_lat phase3_setup_command_window
def phase3_setup_command_window
gg_phase3_setup_command_lat
@actor_command_window.new_items(@active_battler.generate_commands)
end
alias gg_cats_update_phase3_basic_command update_phase3_basic_command
def update_phase3_basic_command
if $crls != nil && $crls >= 6.2
battler = (BlizzCFG::RTAB_ACTIVE ? @active_actor : @active_battler)
restore_commands(battler)
return if update_sls_input(battler)
return if update_srs_input(battler)
return if update_cds_input(battler)
end
if $easy_overdrive != nil && $easy_overdrive >= 2.21
battler = (BlizzCFG::RTAB_ACTIVE ? @active_actor : @active_battler)
restore_commands(battler)
return if update_overdrive_input(battler)
end
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
$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..@actor_command_window.commands.size - 3
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 1
start_skill_select
when @actor_command_window.commands.size - 2
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 1
phase3_next_actor
when @actor_command_window.commands.size - 1
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 2
start_item_select
end
return
end
end
alias gg_cats_start_skill_select start_skill_select
def start_skill_select
gg_cats_start_skill_select
index = @actor_command_window.index
@skill_window.index = 0
@skill_window.refresh(@actor_command_window.commands[index]) if index > 1
end
end
#-------------------------------------------------------------------------------
# Game_Actor
#-------------------------------------------------------------------------------
class Game_Actor < Game_Battler
def generate_commands
s1, s2 = $data_system.words.attack, $data_system.words.skill
s3, s4 = $data_system.words.guard, $data_system.words.item
si = []
Gameus::SKILL_SETS.each_key {|key|
skills = @skills.find_all {|id|
$data_skills[id].element_set.include?(Gameus::SKILL_SETS[key])}
si.push(key) if skills != []}
return [s1, s2] + si + [s3, s4]
end
end
#-------------------------------------------------------------------------------
# Window_Command
#-------------------------------------------------------------------------------
class Window_Command < Window_Selectable
attr_accessor :commands
def new_items(commands)
self.contents.dispose if self.contents != nil
self.contents = nil
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, @item_max * 32)
refresh
end
if $crls != nil && $crls >= 6.2
alias gg_refresh_skill_cats_lat refresh
def refresh
for i in 0...@item_max
draw_item(i, normal_color)
end
gg_refresh_skill_cats_lat
end
end
end
#-------------------------------------------------------------------------------
# Window_Skill
#-------------------------------------------------------------------------------
class Window_Skill < Window_Selectable
alias gg_cats_refresh_skill_window_lat refresh
def refresh(category = "")
=begin
if !$scene.is_a?(Scene_Battle)
gg_cats_refresh_skill_window_lat
return
end
=end
if self.contents != nil
self.contents.dispose
self.contents = nil
end
rank = category == "" ? nil : Gameus::SKILL_SETS[category]
@data = []
@actor.skills.each {|id|
skill = $data_skills[id]
if skill != nil
if rank == nil
flag = true
Gameus::SKILL_SETS.each_value {|element|
flag = false if skill.element_set.include?(element)}
@data.push(skill) if flag
else
@data.push(skill) if skill.element_set.include?(rank)
end
end}
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
end
#==============================================================================
# Window Horizontal Command
# Created By SephirothSpawn (11.03.05)
# Last Updated: 11.03.05
#==============================================================================
class Window_HorizCommand < Window_Selectable
attr_reader :commands
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(commands, width = 640, height = 64)
super(0, 0, width, height)
add_width = [commands.size-4, 0].max * 152
self.contents = Bitmap.new(width + add_width - 32, height - 32)
@commands = commands
@item_max = @commands.size
@column_max = @commands.size
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
width = self.width - 32
off = (self.contents.width) / @item_max
x = 4 + index * off
self.contents.draw_text(x, 0, off - 32, 32, @commands[index])
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
def update_cursor_rect
# If cursor position is less than 0
if @index < 0
self.cursor_rect.empty
return
end
# Get current row
row = @index / @column_max
# If current row is before top row
if row < self.top_row
# Scroll so that current row becomes top row
self.top_row = row
end
# If current row is more to back than back row
if row > self.top_row + (self.page_row_max - 1)
# Scroll so that current row becomes back row
self.top_row = row - (self.page_row_max - 1)
end
# Calculate cursor width
cursor_width = self.contents.width / @column_max - 32
# Calculate cursor coordinates
left_column = self.ox / 152
if @index < left_column
self.ox -= 152
elsif @index > left_column + 3
self.ox += 152
end
puts self.ox
x = @index % @column_max * (cursor_width + 32) - self.ox
y = @index / @column_max * 32 - self.oy
# Update cursor rectangle
self.cursor_rect.set(x, y, cursor_width, 32)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
last_index = @index
super
if self.active and @item_max > 0 and @index >= 0
# If the right directional button was pressed
if Input.trigger?(Input::RIGHT) && @index == @item_max - 1 && last_index == @item_max - 1
# Move cursor right
$game_system.se_play($data_system.cursor_se)
@index = 0
self.ox = 0
elsif Input.trigger?(Input::LEFT) && @index == 0 && last_index == 0
# Move cursor left
$game_system.se_play($data_system.cursor_se)
@index = @item_max - 1
if @index > 4
self.ox = 152 * (@index - 3)
end
end
end
end
def update_help
@help_window.set_text(Gameus.skill_help(@commands[self.index]))
end
end
#==============================================================================
# ** Scene_Skill
#------------------------------------------------------------------------------
# This class performs skill screen processing.
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Get actor
@actor = $game_party.actors[@actor_index]
# Make help window, status window, and skill window
@help_window = Window_Help.new
@category_id = 0
@last_index = 0
@status_window = Window_HorizCommand.new(self.make_commands)
@status_window.y = 64
@status_window.help_window = @help_window
@skill_window = Window_Skill.new(@actor)
# Associate help window
@skill_window.help_window = @help_window
@skill_window.active = false
@skill_window.index = -1
@skill_window.refresh(@status_window.commands[0])
# Make target window (set to invisible / inactive)
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
@status_window.update_help
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@help_window.dispose
@status_window.dispose
@skill_window.dispose
@target_window.dispose
end
#--------------------------------------------------------------------------
# * Create Skill Categories command list
#--------------------------------------------------------------------------
def make_commands
# Initialize variables
commands = ['Skill']
ranks = Gameus::SKILL_SETS.values
# Check every skill the actor has
@actor.skills.each {|id|
# Skip if not a skill
skill = $data_skills[id]
next if skill.nil?
# Compare skill's element set with defined skill categories
sc = skill.element_set & ranks
# If skill belongs to one of the skill categories
if sc.size == 1
# Add the skill category if it hasn't been added yet
commands.push(Gameus::SKILL_SETS.index(sc[0])) if !commands.include?(Gameus::SKILL_SETS.index(sc[0]))
end
}
return commands
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@help_window.update
@status_window.update
@skill_window.update
@target_window.update
# Choosing a skill category
if @status_window.active
update_selection
return
end
# If skill window is active: call update_skill
if @skill_window.active
update_skill
return
end
# If skill target is active: call update_target
if @target_window.active
update_target
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (if status window is active)
#--------------------------------------------------------------------------
def update_selection
if @status_window.index != @last_index
@last_index = @status_window.index
@skill_window.refresh(@status_window.commands[@last_index])
end
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(1)
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@skill_window.active = true
@status_window.active = false
end
end
#--------------------------------------------------------------------------
# * Frame Update (if skill window is active)
#--------------------------------------------------------------------------
def update_skill
# If B button was pressed
if Input.trigger?(Input::B)
@skill_window.index = 0
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
@skill_window.active = false
@skill_window.index = -1
@status_window.active = true
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get currently selected data on the skill window
@skill = @skill_window.skill
# If unable to use
if @skill == nil or not @actor.skill_can_use?(@skill.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# If effect scope is ally
if @skill.scope >= 3
# Activate target window
@skill_window.active = false
@target_window.x = (@skill_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
# Set cursor position to effect scope (single / all)
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
# If effect scope is other than ally
else
# If common event ID is valid
if @skill.common_event_id > 0
# Common event call reservation
$game_temp.common_event_id = @skill.common_event_id
# Play use skill SE
$game_system.se_play(@skill.menu_se)
# Use up SP
@actor.sp -= @skill.sp_cost
# Remake each window content
@skill_window.refresh
@target_window.refresh
# Switch to map screen
$scene = Scene_Map.new
return
end
end
return
end
# If R button was pressed
if Input.trigger?(Input::R)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To next actor
@actor_index += 1
@actor_index %= $game_party.actors.size
# Switch to different skill screen
$scene = Scene_Skill.new(@actor_index)
return
end
# If L button was pressed
if Input.trigger?(Input::L)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To previous actor
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# Switch to different skill screen
$scene = Scene_Skill.new(@actor_index)
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when target window is active)
#--------------------------------------------------------------------------
def update_target
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Erase target window
@skill_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If unable to use because SP ran out
unless @actor.skill_can_use?(@skill.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# If target is all
if @target_window.index == -1
# Apply skill use effects to entire party
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
# If target is user
if @target_window.index <= -2
# Apply skill use effects to target actor
target = $game_party.actors[@target_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
# If single target
if @target_window.index >= 0
# Apply skill use effects to target actor
target = $game_party.actors[@target_window.index]
used = target.skill_effect(@actor, @skill)
end
# If skill was used
if used
# Play skill use SE
$game_system.se_play(@skill.menu_se)
# Use up SP
@actor.sp -= @skill.sp_cost
# Remake each window content
@skill_window.refresh
@target_window.refresh
# If entire party is dead
if $game_party.all_dead?
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If command event ID is valid
if @skill.common_event_id > 0
# Command event call reservation
$game_temp.common_event_id = @skill.common_event_id
# Switch to map screen
$scene = Scene_Map.new
return
end
end
# If skill wasn't used
unless used
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
Thanks :D I'll try it when I'll be at home :D
EDIT
I tried the script, but I don't know if I'm wrong in something or the script doesn't work.
I've copied it into an empty project, but for every hero I've only the category "Skill". And I can't even select no magic in it ... Any advice? :D
Here my test project: https://www.mediafire.com/?b2r4z0yqybpspxd
Because you didn't even configure it.
What you have to do is create new Elements under Database > System. I added White Magic and Black Magic elements.
(http://puu.sh/fUDLT/9cd530e0e4.png)
Then assign these elements to your skills. In this example, I checked the White Magic element box.
(http://puu.sh/fUDTJ/3d7571dcf8.png)
Go to the script and add the new element states. White Magic was element ID 17 and Black Magic was ID 18. Your configuration should look like:
SKILL_SETS = {
"White Magic" => 17,
"Black Magic" => 18
}
Below that I put the help text configuration.
Ah sorry XD But I've a problem, when I select, for example, White Magic, the cursor became deactivated and I can't select any skill from the list...
(http://i57.tinypic.com/15mleth.jpg)
Oh, I forgot a line of code.
#===============================================================================
# Skill Categories
# Version 1.3
# Author gameus
#-------------------------------------------------------------------------------
# Intro:
# Adds Skill Categories to the Default Battle System. For every Skill Category
# your actor gets a new command, assuming they know skills from that category.
# Actors also get their default "Skill" command.
#
# Features:
# -Adds new battle commands for each category
# -Separates all skills from every other category/normal category
# -All skills still display in the normal Skill Scene
# -Have as many categories as you want
#
# Version History:
# 1.3 - Added compatibility with Chaos Rage Limit System by Blizzard
# 1.2 - Fixed small bug with Easy Overdrive System by Blizzard
# 1.1 - Added compatibility with Easy Overdrive System by Blizzard
# 1.0 - Initial Release
#
# Instructions:
# Jump down to the configuration, here's where you will define your Skill
# Categories.
# SKILL_SETS = {
# "Rank 1" => 17,
# "Rank 2" => 18,
# "Rank 3" => 19,
# }
# To add a new category, add a new line under the last category and follow
# the template:
# "Category Name" => Element_Id,
# Name it whatever, and make sure to give it an unused element id.
#
# To add skills to these categories, you have to add these elements to the
# skills. Say you wanted Skills 1, 2, 3 to be under the category with the
# element id of 17, these three skills need to have element id 17 in order
# to be considered in that category.
#
# Compatibility:
# -Not tested with anything other than the default battle system.
# -Will not work with Skill Separation add-on from Tons of Add-ons by Blizzard
# But this script would be useless if you were to use it.
# -Will work with Battle Memory Commands by gameus
# -Will not work properly with Battle Icons by Juan, however, other scripts
# that add similar functionality should work depending on the naming
# conventions that are required.
# -Not tested with SDK (Probably won't work)
# -Works perfectly with Easy Overdrive System by Blizzard. Place this script
# below his.
# -If you run into any other scripts that don't work with it, just post it in
# the topic and I'll try to look at it.
# -Works with Unique Skill Commands by Blizzard.
# -Works with Chaos Rage Limit System by Blizzard, make sure you place this
# script below it.
#
# Credits:
# gameus ~ For creating it
# MarkHest ~ For requesting it and testing it
#===============================================================================
module Gameus
SKILL_SETS = {
"White Magic" => 17,
"Black Magic" => 18,
"Rank 3" => 19,
}
def self.skill_help(category)
case category
when "White Magic" then 'Defensive magic that heals and protects allies'
when "Black Magic" then 'Offensive magic that damages enemies'
when "Rank 3" then 'High level magic'
else
'Abilities unique to that of the actor'
end
end
end
$gg_skill_categories = 1.3
#-------------------------------------------------------------------------------
# Scene_Battle
#-------------------------------------------------------------------------------
class Scene_Battle
alias gg_phase3_setup_command_lat phase3_setup_command_window
def phase3_setup_command_window
gg_phase3_setup_command_lat
@actor_command_window.new_items(@active_battler.generate_commands)
end
alias gg_cats_update_phase3_basic_command update_phase3_basic_command
def update_phase3_basic_command
if $crls != nil && $crls >= 6.2
battler = (BlizzCFG::RTAB_ACTIVE ? @active_actor : @active_battler)
restore_commands(battler)
return if update_sls_input(battler)
return if update_srs_input(battler)
return if update_cds_input(battler)
end
if $easy_overdrive != nil && $easy_overdrive >= 2.21
battler = (BlizzCFG::RTAB_ACTIVE ? @active_actor : @active_battler)
restore_commands(battler)
return if update_overdrive_input(battler)
end
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
$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..@actor_command_window.commands.size - 3
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 1
start_skill_select
when @actor_command_window.commands.size - 2
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 1
phase3_next_actor
when @actor_command_window.commands.size - 1
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 2
start_item_select
end
return
end
end
alias gg_cats_start_skill_select start_skill_select
def start_skill_select
gg_cats_start_skill_select
index = @actor_command_window.index
@skill_window.index = 0
@skill_window.refresh(@actor_command_window.commands[index]) if index > 1
end
end
#-------------------------------------------------------------------------------
# Game_Actor
#-------------------------------------------------------------------------------
class Game_Actor < Game_Battler
def generate_commands
s1, s2 = $data_system.words.attack, $data_system.words.skill
s3, s4 = $data_system.words.guard, $data_system.words.item
si = []
Gameus::SKILL_SETS.each_key {|key|
skills = @skills.find_all {|id|
$data_skills[id].element_set.include?(Gameus::SKILL_SETS[key])}
si.push(key) if skills != []}
return [s1, s2] + si + [s3, s4]
end
end
#-------------------------------------------------------------------------------
# Window_Command
#-------------------------------------------------------------------------------
class Window_Command < Window_Selectable
attr_accessor :commands
def new_items(commands)
self.contents.dispose if self.contents != nil
self.contents = nil
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, @item_max * 32)
refresh
end
if $crls != nil && $crls >= 6.2
alias gg_refresh_skill_cats_lat refresh
def refresh
for i in 0...@item_max
draw_item(i, normal_color)
end
gg_refresh_skill_cats_lat
end
end
end
#-------------------------------------------------------------------------------
# Window_Skill
#-------------------------------------------------------------------------------
class Window_Skill < Window_Selectable
alias gg_cats_refresh_skill_window_lat refresh
def refresh(category = "")
=begin
if !$scene.is_a?(Scene_Battle)
gg_cats_refresh_skill_window_lat
return
end
=end
if self.contents != nil
self.contents.dispose
self.contents = nil
end
rank = category == "" ? nil : Gameus::SKILL_SETS[category]
@data = []
@actor.skills.each {|id|
skill = $data_skills[id]
if skill != nil
if rank == nil
flag = true
Gameus::SKILL_SETS.each_value {|element|
flag = false if skill.element_set.include?(element)}
@data.push(skill) if flag
else
@data.push(skill) if skill.element_set.include?(rank)
end
end}
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
end
#==============================================================================
# Window Horizontal Command
# Created By SephirothSpawn (11.03.05)
# Last Updated: 11.03.05
#==============================================================================
class Window_HorizCommand < Window_Selectable
attr_reader :commands
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(commands, width = 640, height = 64)
super(0, 0, width, height)
add_width = [commands.size-4, 0].max * 152
self.contents = Bitmap.new(width + add_width - 32, height - 32)
@commands = commands
@item_max = @commands.size
@column_max = @commands.size
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
width = self.width - 32
off = (self.contents.width) / @item_max
x = 4 + index * off
self.contents.draw_text(x, 0, off - 32, 32, @commands[index])
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
def update_cursor_rect
# If cursor position is less than 0
if @index < 0
self.cursor_rect.empty
return
end
# Get current row
row = @index / @column_max
# If current row is before top row
if row < self.top_row
# Scroll so that current row becomes top row
self.top_row = row
end
# If current row is more to back than back row
if row > self.top_row + (self.page_row_max - 1)
# Scroll so that current row becomes back row
self.top_row = row - (self.page_row_max - 1)
end
# Calculate cursor width
cursor_width = self.contents.width / @column_max - 32
# Calculate cursor coordinates
left_column = self.ox / 152
if @index < left_column
self.ox -= 152
elsif @index > left_column + 3
self.ox += 152
end
x = @index % @column_max * (cursor_width + 32) - self.ox
y = @index / @column_max * 32 - self.oy
# Update cursor rectangle
self.cursor_rect.set(x, y, cursor_width, 32)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
last_index = @index
super
if self.active and @item_max > 0 and @index >= 0
# If the right directional button was pressed
if Input.trigger?(Input::RIGHT) && @index == @item_max - 1 && last_index == @item_max - 1
# Move cursor right
$game_system.se_play($data_system.cursor_se)
@index = 0
self.ox = 0
elsif Input.trigger?(Input::LEFT) && @index == 0 && last_index == 0
# Move cursor left
$game_system.se_play($data_system.cursor_se)
@index = @item_max - 1
if @index > 4
self.ox = 152 * (@index - 3)
end
end
end
end
def update_help
@help_window.set_text(Gameus.skill_help(@commands[self.index]))
end
end
#==============================================================================
# ** Scene_Skill
#------------------------------------------------------------------------------
# This class performs skill screen processing.
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Get actor
@actor = $game_party.actors[@actor_index]
# Make help window, status window, and skill window
@help_window = Window_Help.new
@category_id = 0
@last_index = 0
@status_window = Window_HorizCommand.new(self.make_commands)
@status_window.y = 64
@status_window.help_window = @help_window
@skill_window = Window_Skill.new(@actor)
# Associate help window
@skill_window.help_window = @help_window
@skill_window.active = false
@skill_window.index = -1
@skill_window.refresh(@status_window.commands[0])
# Make target window (set to invisible / inactive)
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
@status_window.update_help
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@help_window.dispose
@status_window.dispose
@skill_window.dispose
@target_window.dispose
end
#--------------------------------------------------------------------------
# * Create Skill Categories command list
#--------------------------------------------------------------------------
def make_commands
# Initialize variables
commands = ['Skill']
ranks = Gameus::SKILL_SETS.values
# Check every skill the actor has
@actor.skills.each {|id|
# Skip if not a skill
skill = $data_skills[id]
next if skill.nil?
# Compare skill's element set with defined skill categories
sc = skill.element_set & ranks
# If skill belongs to one of the skill categories
if sc.size == 1
# Add the skill category if it hasn't been added yet
commands.push(Gameus::SKILL_SETS.index(sc[0])) if !commands.include?(Gameus::SKILL_SETS.index(sc[0]))
end
}
return commands
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@help_window.update
@status_window.update
@skill_window.update
@target_window.update
# Choosing a skill category
if @status_window.active
update_selection
return
end
# If skill window is active: call update_skill
if @skill_window.active
update_skill
return
end
# If skill target is active: call update_target
if @target_window.active
update_target
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (if status window is active)
#--------------------------------------------------------------------------
def update_selection
if @status_window.index != @last_index
@last_index = @status_window.index
@skill_window.refresh(@status_window.commands[@last_index])
end
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(1)
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@skill_window.active = true
@status_window.active = false
@skill_window.index = 0
end
end
#--------------------------------------------------------------------------
# * Frame Update (if skill window is active)
#--------------------------------------------------------------------------
def update_skill
# If B button was pressed
if Input.trigger?(Input::B)
@skill_window.index = 0
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
@skill_window.active = false
@skill_window.index = -1
@status_window.active = true
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get currently selected data on the skill window
@skill = @skill_window.skill
# If unable to use
if @skill == nil or not @actor.skill_can_use?(@skill.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# If effect scope is ally
if @skill.scope >= 3
# Activate target window
@skill_window.active = false
@target_window.x = (@skill_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
# Set cursor position to effect scope (single / all)
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
# If effect scope is other than ally
else
# If common event ID is valid
if @skill.common_event_id > 0
# Common event call reservation
$game_temp.common_event_id = @skill.common_event_id
# Play use skill SE
$game_system.se_play(@skill.menu_se)
# Use up SP
@actor.sp -= @skill.sp_cost
# Remake each window content
@status_window.refresh
@skill_window.refresh
@target_window.refresh
# Switch to map screen
$scene = Scene_Map.new
return
end
end
return
end
# If R button was pressed
if Input.trigger?(Input::R)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To next actor
@actor_index += 1
@actor_index %= $game_party.actors.size
# Switch to different skill screen
$scene = Scene_Skill.new(@actor_index)
return
end
# If L button was pressed
if Input.trigger?(Input::L)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To previous actor
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# Switch to different skill screen
$scene = Scene_Skill.new(@actor_index)
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when target window is active)
#--------------------------------------------------------------------------
def update_target
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Erase target window
@skill_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If unable to use because SP ran out
unless @actor.skill_can_use?(@skill.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# If target is all
if @target_window.index == -1
# Apply skill use effects to entire party
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
# If target is user
if @target_window.index <= -2
# Apply skill use effects to target actor
target = $game_party.actors[@target_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
# If single target
if @target_window.index >= 0
# Apply skill use effects to target actor
target = $game_party.actors[@target_window.index]
used = target.skill_effect(@actor, @skill)
end
# If skill was used
if used
# Play skill use SE
$game_system.se_play(@skill.menu_se)
# Use up SP
@actor.sp -= @skill.sp_cost
# Remake each window content
@status_window.refresh
@skill_window.refresh
@target_window.refresh
# If entire party is dead
if $game_party.all_dead?
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If command event ID is valid
if @skill.common_event_id > 0
# Command event call reservation
$game_temp.common_event_id = @skill.common_event_id
# Switch to map screen
$scene = Scene_Map.new
return
end
end
# If skill wasn't used
unless used
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
Thanks :D Now it works good!!! :D
@KK20 I've a problem with your script :'( :'( :'(... As you know I'm using CCOA BS and Battle Memory Command script... and I've an error (line 93 of your script) when I start a battle
Script 'Scene Skill' line 93: NoMethodError occured.
undefined method 'new items' for nil:NilClass.
line 93 is: @actor_command_window.new_items(@active_battler.generate_commands)
So I've deleted this part of code in your script:
#-------------------------------------------------------------------------------
# Scene_Battle
#-------------------------------------------------------------------------------
class Scene_Battle
alias gg_phase3_setup_command_lat phase3_setup_command_window
def phase3_setup_command_window
gg_phase3_setup_command_lat
@actor_command_window.new_items(@active_battler.generate_commands)
end
alias gg_cats_update_phase3_basic_command update_phase3_basic_command
def update_phase3_basic_command
if $crls != nil && $crls >= 6.2
battler = (BlizzCFG::RTAB_ACTIVE ? @active_actor : @active_battler)
restore_commands(battler)
return if update_sls_input(battler)
return if update_srs_input(battler)
return if update_cds_input(battler)
end
if $easy_overdrive != nil && $easy_overdrive >= 2.21
battler = (BlizzCFG::RTAB_ACTIVE ? @active_actor : @active_battler)
restore_commands(battler)
return if update_overdrive_input(battler)
end
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
$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..@actor_command_window.commands.size - 3
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 1
start_skill_select
when @actor_command_window.commands.size - 2
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 1
phase3_next_actor
when @actor_command_window.commands.size - 1
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 2
start_item_select
end
return
end
end
alias gg_cats_start_skill_select start_skill_select
def start_skill_select
gg_cats_start_skill_select
index = @actor_command_window.index
@skill_window.index = 0
@skill_window.refresh(@actor_command_window.commands[index]) if index > 1
end
end
Now battle start perfectly but when I try to use Skill Command in battle I've the following error in Battle Memory Command script:
Script 'Battle Memory Command' line 85: NoMethodError occured.
undefined method 'index' for nil:NilClass.
Line 85 is: @actor_command_window.index != 1
and this is the full Battle Memory Command script:
#===============================================================================
# Battle Memory Commands
# Version: 1.3
# Author: gameus
#===============================================================================
# Intro:
# What this script does is memorize actions during battle. So if actor 1 attacks
# and actor 2 defends. The cursor will be on attack for actor 1, and the cursor
# will still be on defend for actor 2.
#
# Features:
# Memorizes Battle Commands
# Memorizes Last Skill Used
# Memorizes Last Item Used (If item is still owned)
#
# Instructions:
# Place in a new script above main. Below any battle systems used.
#
# Compatibility:
# Not tested with SDK
# Not tested with any custom battle systems
# If using with Skill Categories (1.0 or above) then place this script below
#
# Credits:
# gameus ~ for making it
# Kain Nobel ~ for making an SDK version which inspired me to do this
#===============================================================================
#-------------------------------------------------------------------------------
# Scene_Battle
#-------------------------------------------------------------------------------
class Scene_Battle
alias gg_reset_memory_main main
def main
$game_party.actors.each {|a| a.reset_memory }
gg_reset_memory_main
end
alias set_command_memory phase3_setup_command_window
def phase3_setup_command_window
set_command_memory
@actor_command_windows[@actor_index].index = @active_battler.command_memory #<=====
end
alias get_command_memory update_phase3_basic_command
def update_phase3_basic_command
if Input.trigger?(Input::C)
@active_battler.command_memory = @actor_command_windows[@actor_index].index #<=====
end
get_command_memory
end
alias set_skill_memory update_phase3_skill_select
def update_phase3_skill_select
if Input.trigger?(Input::C)
if $gg_skill_categories != nil && $gg_skill_categories >= 1.0 &&
@actor_command_window.index != 1
index = @actor_command_window.index
cat = @actor_command_window.commands[index]
@active_battler.category_memory[cat] = @skill_window.index
if index == 1
@active_battler.skill_memory = @skill_window.index
end
else
@active_battler.skill_memory = @skill_window.index
end
end
set_skill_memory
end
alias set_item_memory update_phase3_item_select
def update_phase3_item_select
if Input.trigger?(Input::C)
@active_battler.item_memory = @item_window.index
end
set_item_memory
end
alias get_skill_memory start_skill_select
def start_skill_select(*args) #<=====
get_skill_memory(*args) #<=====
if $gg_skill_categories != nil && $gg_skill_categories >= 1.0 &&
@actor_command_window.index != 1
index = @actor_command_window.index
cat = @actor_command_window.commands[index]
@skill_window.index = @active_battler.category_memory[cat]
if index == 1
@skill_window.index = @active_battler.skill_memory
end
return
end
@skill_window.index = @active_battler.skill_memory
end
alias get_item_memory start_item_select
def start_item_select(*args) #<=====
get_item_memory(*args) #<=====
@item_window.index = @active_battler.item_memory
end
end
#-------------------------------------------------------------------------------
# Game_Actor
#-------------------------------------------------------------------------------
class Game_Actor < Game_Battler
attr_accessor :command_memory
attr_accessor :skill_memory
attr_accessor :item_memory
attr_accessor :category_memory
alias gg_set_memory_vars initialize
def initialize(actor_id)
reset_memory
gg_set_memory_vars(actor_id)
end
def reset_memory
@command_memory = 0
@skill_memory = 0
@item_memory = 0
@category_memory = {}
if $gg_skill_categories != nil && $gg_skill_categories >= 1.0
Gameus::SKILL_SETS.each_key {|key| @category_memory[key] = 0 }
end
end
end
is possible to fix it? =(
Try replacing @actor_command_window in the Memory Commands script to @actor_command_windows[@actor_index]
I've replaced all the @actor_command_window with @actor_command_windows[@actor_index] but now the problem is in cat = @actor_command_window.commands[index] :(
Clearly you didn't replace all of them.
CTRL + H
First box: @actor_command_window.
Second box: @actor_command_windows[@actor_index].
Replace All
You're right
lol no need to be brutally honest :P
So is everything working now?
:D :D :D Yes :D It seems to work good now ^_^