Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Modified skills to not appear at bottom // Misc.

Hi~!

I have a script that allows skills to be upgraded/modified. However, each time this is done the modified skill appears at the bottom of the Skill list (in battle, in menu, etc.). How can I make it so this doesn't happen and the Skills stay in the original order as assigned by the Skill Database tab?

This is the modify-skill script:

#==============================================================================
# ** Skill Modification System
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1.0
# 2008-12-09
#------------------------------------------------------------------------------
# * Version History :
#
# Version 1 ---------------------------------------------------- (2008-12-09)
#------------------------------------------------------------------------------
# * Requirements :
#
# Virtual Database 2.2 or greater
#------------------------------------------------------------------------------
# * Description :
#
# This system was designed to allow you to upgrade your actor's skills stats.
# The upgrade only effects a single actor.
#------------------------------------------------------------------------------
# * Instructions :
#
# Place the script below the SDK (if included) and above Main.
#------------------------------------------------------------------------------
# * Syntax :
#
# Modify a skill stat:
# - $game_actors[actor_id].modify_skill_stats(skill_id, skill_stats)
#
# skill_stats = [[stat_name, operator, n], ...]
#
# Example: Actor 5's skill 3 sp_cost is decreased by 5.
# $game_actors[5].modify_skill_stats(3, [['sp_cost', '-=', 5]])
#
# Modify a skill array stat
# - $game_actors[actor_id].modify_skill_array(skill_id, skill_stats)
#
# skill_stats = [[stat_name, n], ...]
#
# If n is negative, n is subtracted from skill stat array.
# If n is positive, n is added to skill stat array.
#------------------------------------------------------------------------------
# * Terms & Conditions :
#
# Copyright (C) 2007-2009 SephirothSpawn (Timothy Hoffman)
# Non-Commercial Use: Free
# Commercial License: Contact via. SephirothSpawn@hotmail.com
#
# This system is not to be redistrubted without the author's consent. This
# system may be modified by the user but not redistrubted without the
# author's consent.
#==============================================================================

#------------------------------------------------------------------------------
# * Begin SDK Log
#------------------------------------------------------------------------------
if Module.constants.include?('SDK')
SDK.log('Skill Modification System', 'SephirothSpawn', 1.0, '2008-12-09')
SDK.check_requirements(2.0)
end

#==============================================================================
# ** RPG::Skill
#==============================================================================

class RPG::Skill
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_writer :eek:riginal_id
#--------------------------------------------------------------------------
# * Original ID
#--------------------------------------------------------------------------
def original_id
return @original_id.nil? ? @id : @original_id
end
end

#==============================================================================
# ** Game_Actor
#==============================================================================

class Game_Actor
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias_method :seph_skillmod_gmactr_setup, :setup
alias_method :seph_skillmod_gmactr_skills, :skills
#--------------------------------------------------------------------------
# * Setup
#--------------------------------------------------------------------------
def setup(actor_id)
# Setup skill modification ids
@skill_modifications = {}
# Original setup
seph_skillmod_gmactr_setup(actor_id)
end
#--------------------------------------------------------------------------
# * Skills
#--------------------------------------------------------------------------
def skills
# Get skills list
skills = seph_skillmod_gmactr_skills.dup
# Pass through skill modifications
@skill_modifications.each do |o_id, m_id|
# If skills have modified skill
if skills.include?(o_id)
# Replace skill with modified skill id
skills[skills.index(o_id)] = m_id
end
end
# Return sorted skills list
# return skills.sort {|a, b| a.original_id <=> b.original_id} #woar fix
return skills.sort {|a, b| $data_skills[a].original_id <=> $data_skills.original_id}
end
#--------------------------------------------------------------------------
# * Modify Skill Stats
#
# skill_stats = [[stat_name, operator, n], ...]
#--------------------------------------------------------------------------
def modify_skill_stats(skill_id, skill_stats)
# Get modified skill
skill = modified_skill(skill_id)
# Modify skill stat
skill_stats.each do |son|
s, o, n = *son
eval "skill.#{s} #{o} n"
end
# Modify skill
modify_skill(skill)
end
#--------------------------------------------------------------------------
# * Modify Skill Array
#
# skill_stats = [[stat_name, n], ...]
#--------------------------------------------------------------------------
def modify_skill_array(skill_id, skill_stats)
# Get modified skill
skill = modified_skill(skill_id)
# Pass through skill stats
skill_stats.each do |skill_stat|
# Get name and object
skill_stat, n = *skill_stat
# Get skill stat array
array = eval "skill.#{skill_stat}"
# Modify array
n > 0 ? array << n : array.delete(n)
# Sort array
array.sort!
# Set skill stat array
eval "skill.#{skill_stat} = array"
end
# Modify skill
modify_skill(skill)
end
#--------------------------------------------------------------------------
# * Modified Skill
#--------------------------------------------------------------------------
private
def modified_skill(skill_id)
# If skill already modified
if @skill_modifications.has_key?(skill_id)
# Retrieve previously modified skill
skill = $game_virtualdb.data_skill(@skill_modifications[skill_id])
elsif @skill_modifications.has_value?(skill_id)
# Retrieve previously modified skill
skill = $game_virtualdb.data_skill(skill_id)
# If skill not modified
else
# Create new skill based off original
skill = $data_skills[skill_id].dup
# Modify skill id
skill.id = $data_skills.size + 1
# Save skill id to modification
@skill_modifications[skill_id] = skill.id
end
# Return skill
return skill
end
#--------------------------------------------------------------------------
# * Modify Skill
#--------------------------------------------------------------------------
private
def modify_skill(skill)
# Get modified data skills
skills = $game_virtualdb.data_skills
# Modify skill to skills list
skills[skill.id] = skill
# Save skill data
$game_virtualdb.data_skills = skills
end
end


And this is for the Skill Tree where you can actually activate the upgrades (though I'm not sure if you need this):

#==============================================================================
# ** Skill Tree System
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1.0
# 2008-12-09
#------------------------------------------------------------------------------
# * Version History :
#
# Version 1 ---------------------------------------------------- (2008-12-09)
#------------------------------------------------------------------------------
# * Requirements :
#
# MACL 2.3, RGSS.Character (2.4 BETA), Virtual Database 2.2 or greater
# -or-
# MACL 2.4
#
# Also requires Skill Modification 1.0
#------------------------------------------------------------------------------
# * Description :
#
# This system was designed to allow characters to upgrade their stats, learn
# new skills, and upgrade there skills on a "sphere grid/skill tree."
# To unlocked each item on the sphere grid, a number of points must be
# obtained.
#
# Setting up the sphere's can be done with a comment line. The script takes
# care of everything else.
#------------------------------------------------------------------------------
# * Instructions :
#
# Place the script below the SDK (if included) and above Main.
#
# For setup of sphere grid, start on the line "module Sphere_Grid_System."
# Read each area between the "#------------------" breakers for instructions
# for the setup on the next part. Modifications end on the line
# "GD_Font.bold = "
#------------------------------------------------------------------------------
# * Syntax :
#
# Give actor a grid point
# - $game_actors[actor_id].add_sphere_grid_point(point_id, n)
#
# Take actor grid point
# - $game_actors[actor_id].lose_sphere_grid_point(point_id, n)
#
# actor_id : id of actor in database under actors tab
# point_id : id of point in Sphere_Grid_System::Grid_Points::Actor_Names
# n : number of points gaining/losing
#
# Give party a grid point
# - $game_party.add_sphere_grid_point(point_id, n)
#
# Take party grid point
# - $game_party.lose_sphere_grid_point(point_id, n)
#
# point_id : id of point in Sphere_Grid_System::Grid_Points::Party_Names
# n : number of points gaining/losing
#
# Go to sphere grid
# - $game_party.move_to_sphere_grid(actor_index)
#
# actor_index : position of party of actor - 1 (0, 1, 2 or 3)
#
# Leave sphere grid
# - $game_party.leave_sphere_grid
#------------------------------------------------------------------------------
# * Terms & Conditions :
#
# Copyright (C) 2007-2009 SephirothSpawn (Timothy Hoffman)
#------------------------------------------------------------------------------
# * Work Log :
#
# Date - Time Spent - Description of work
#
# 08/25/2008 - 1.5 hours - Reviewed request; starting planning out system;
# started skill tree settings module; started
# Game_Actor#stat_bonus methods
# 08/26/2008 - 1.0 hours - Started skill modification system
# 09/27/2008 - 1.5 hours - Completed skill modification system; started
# grid point system
# 09/28/2008 - 3.0 hours - Remodeled/completed vocab module; created
# Sphere_Grid class; Added event comment reading
# and setting Sphere_Grid data; completed grid name
# display window; completed grid points window;
# worked on demo map
# 09/29/2008 - 2.5 hours - Updated vocab module; updated Sphere_Grid class;
# updated event comment reading and setting;
# updated demo map; added unlock feature;
# added confirmation window
# 09/31/2008 - 1.0 hours - Modified skill stat system to use any modifier
# vs. adding only; updated sphere grid system with
# skill stat modifier
# 09/02/2008 - 1.0 hours - Updated skill stat modification engine; continued
# work on grid details window
# 09/04/2008 - 0.5 hours - Added window size and font control; added window
# button control
# 09/09/2008 - 0.5 hours - Started work on sphere grid movement types
# 09/14/2008 - 0.5 hours - Continued work on sphere grid movement types
# 10/04/2008 - 1.5 hours - Completed automatic grid movement
#==============================================================================

#------------------------------------------------------------------------------
# * Begin SDK Log
#------------------------------------------------------------------------------
if Module.constants.include?('SDK')
SDK.log('Sphere Grid System', 'SephirothSpawn', 1.0, '2008-12-09')
SDK.check_requirements(2.0)
end

#==============================================================================
# ** Sphere_Grid_System
#==============================================================================

module Sphere_Grid_System
#--------------------------------------------------------------------------
# * Basic Settings
#
# Grid_Range - Range must be within grid before details and name show up
#
# Points Used - Points used in system (Must be Array)
# - 0: Actor, 1: Party
#
# Sphere Movement Type - movement used on sphere grid
# - 0: Basic Map Movement
# - 1: Direct Grid Movement
#--------------------------------------------------------------------------
Grid_Range = 1
Points_Used = [0, 1]
Movement_Type = 0
end

#==============================================================================
# ** Sphere_Grid_System::Vocab
#==============================================================================

module Sphere_Grid_System::Vocab
#--------------------------------------------------------------------------
# * Basic Vocabulary
#
# Grid Points - These words are basic names for the party and actor
# points you use to unlock grids.
#
# - Actor_Grid_Point_Names = 'Name'
# - Party_Grid_Point_Names = 'Name'
#
# Upgrade Descriptions - Descriptions that will appear in grid details
# window. %s is equal to the stat name (see Stat_Names) and it's
# modification, skill name, or skill name + upgrade description +
# modification, skill element set (see Skill_U_ES) or skill
# plus and minus state set (see Skill_U_PSS & Skill_U_MSS).
#
# - Stat_Gain_Description - %s = Stat Name-n
# - Skill_Learn_Description - %s = Skill Name
# - Skill_Forget_Description - %s = Skill Name
# - Skill_Upgrade_Description - %s = Skill Name
# - Skill_A_Element_Description - %s = Element Names
# - Skill_R_Element_Description - %s = Element Names
# - Skill_A_PSS_Description - %s = State Names
# - Skill_R_PSS_Description - %s = State Names
# - Skill_A_MSS_Description - %s = State Names
# - Skill_R_MSS_Description - %s = State Names
#--------------------------------------------------------------------------
Actor_Grid_Point_Names = "Character's Points"
Party_Grid_Point_Names = 'Shared Points'
Stat_Gain_Description = 'Stat Gains'
Skill_Learn_Description = 'Learn Skill: %s'
Skill_Forget_Description = 'Forget Skill: %s'
Skill_Upgrade_Description = 'Skill Upgrades: %s'
Skill_A_Element_Description = 'Add Element: %s'
Skill_R_Element_Description = 'Remove Element: %s'
Skill_A_PSS_Description = 'Add Plus State: %s'
Skill_R_PSS_Description = 'Remove Plus State: %s'
Skill_A_MSS_Description = 'Add Minus State: %s'
Skill_M_MSS_Description = 'Remove Minus State: %s'
#--------------------------------------------------------------------------
# * Comment Vocabulary
#
# Sphere Grid - Test if event is sphere grid
# - Comment: Sphere_Grid_Comment
#
# Grid name and icon - Name and icon appears in window when near grid.
#
# - Comment: Grid_Name_Comment (name)
# - Comment: Grid_Icon_Comment (filename)
#
# Grid link - Next event ID
# - Commend: Grid_Event_Link (event_id)
#
# Grid Point Comments - Comments that set grid points required to unlock
# grid.
# - Comment: Grid_A_Point_Comment (point_id) [n]
# point_id = id of point (see Grid_Points)
# n = number of points
# - Comment: Grid_P_Point_Comment (point_id) [n]
# point_id = id of point (see Grid_Points)
# n = number of points
#
# Grid Upgrade Comments - Comments that set grid stat upgrades, skills,
# or skill upgrades. <s> below means your comment string setting.
#
# - Comment: Grid_Stat_Comment (stat_name) [n]
# stat_name = key from Stat_Names constant
# n = value stat changes
# - Comment: Grid_Skill_L_Comment(skill_id)
# skill_id = skill being learned (-skill_id to forget skill)
# - Comment: Grid_Skill_U_Comment (skill_id) [skill_u] {operator} <n>
# skill_i> = id of skill being upgraded
# skill_u = key from Skill_U_Stats constant
# operator = +=, -=, /=, *=, =
# n = value of skill stat change
# - Comment: Grid_Skill_A_Comment (skill_id) [skill_u] {element_id}
# skill_id = id of skill being upgraded
# skill_u = key from Skill_A_Stats constant
# element_id = element/state being added (-id to remove element)
#--------------------------------------------------------------------------
Sphere_Grid_Comment = 'Sphere Grid'
Grid_Name_Comment = 'Grid Name'
Grid_Icon_Comment = 'Grid Icon'
Grid_Event_Link = 'Grid Link'
Grid_A_Point_Comment = 'A Grid Point'
Grid_P_Point_Comment = 'P Grid Point'
Grid_Stat_Comment = 'Stat'
Grid_Skill_L_Comment = 'Skill L'
Grid_Skill_U_Comment = 'Skill U'
Grid_Skill_A_Comment = 'Skill A'
#--------------------------------------------------------------------------
# * Avaliable Stats
#
# Stats are methods found in Game_Actor and can be any method that
# returns a numeric value. For instance, you have a stat called wisdom.
# Lets say you make a sphere like:
#
# Comment: Stat (wisdom) {n}
#
# When you gain that grid, the value returned by your wisdom method is
# increased by n.
#
# 'method_name' => 'Description'
#--------------------------------------------------------------------------
Stat_Names = {
'direct_maxhp_bonus' => 'Direct HP Bonus',
'percent_maxhp_bonus' => 'Percent HP Bonus',
'direct_maxsp_bonus' => 'Direct SP Bonus',
'percent_maxsp_bonus' => 'Percent SP Bonus',
'direct_str_bonus' => 'Direct STR Bonus',
'percent_str_bonus' => 'Percent STR Bonus',
'direct_dex_bonus' => 'Direct DEX Bonus',
'percent_dex_bonus' => 'Percent DEX Bonus',
'direct_agi_bonus' => 'Direct AGI Bonus',
'percent_agi_bonus' => 'Percent AGI Bonus',
'direct_int_bonus' => 'Direct INT Bonus',
'percent_int_bonus' => 'Percent INT Bonus',
'direct_atk_bonus' => 'Direct ATK Bonus',
'percent_atk_bonus' => 'Percent ATK Bonus',
'direct_pdef_bonus' => 'Direct PDEF Bonus',
'percent_pdef_bonus' => 'Percent PDEF Bonus',
'direct_mdef_bonus' => 'Direct MDEF Bonus',
'percent_mdef_bonus' => 'Percent MDEF Bonus',
'direct_eva_bonus' => 'Direct EVA Bonus',
'percent_eva_bonus' => 'Percent EVA Bonus',
'direct_hit_bonus' => 'Direct HIT Bonus',
'percent_hit_bonus' => 'Percent HIT Bonus'
}
#--------------------------------------------------------------------------
# * Skill Upgrades: Skill Stat Modification
#
# Skill Upgrades are methods found in RPG::Skill and can be any method
# that returns a numeric value. This works like Stat_Names. The
# exceptions to this are scope, occasion, element_set, plus_state_set &
# minus_state_set.
#
# 'method_name' => 'Description'
#--------------------------------------------------------------------------
Skill_U_Stats = {
'sp_cost' => 'MP Cost',
'power' => 'Damage',
'str_f' => 'STR Rating',
'dex_f' => 'DEX Rating',
'agi_f' => 'AGI Rating',
'int_f' => 'INT Rating',
'atk_f' => 'ATK Rating',
'pdef_f' => 'PDEF Rating',
'mdef_f' => 'MDEF Rating',
'eva_f' => 'EVA Rating',
'variance' => 'Variance',
'hit' => 'Accuracy',
'scope' => 'Scope',
'occassion' => 'Occassion',
}
#--------------------------------------------------------------------------
# * Skill Upgrades: Skill Array Set
#
# Skill Upgrades are methods found in RPG::Skill and can be any method
# that returns an array. This method adds numeric values to array.
#
# 'method_name' => 'Description'
#--------------------------------------------------------------------------
Skill_A_Stats = {
'element_set' => 'Element Set',
'plus_state' => 'Plus States',
'minus_state_set' => 'Minus State'
}
#--------------------------------------------------------------------------
# * Skill Upgrades: Scope & Occasion Modification
#
# Modification to skill effect range and occasion.
#--------------------------------------------------------------------------
Skill_U_Scope = {
0 => 'None',
1 => 'One Enemy',
2 => 'All Enemies',
3 => 'One Ally',
4 => 'All Allies',
5 => 'One KO\'d Ally',
6 => 'All KO\'d Allies',
7 => 'User'
}
Skill_U_Occasion = {
0 => 'Always',
1 => 'Only in battle',
2 => 'Only from the menu',
3 => 'Never'
}
#--------------------------------------------------------------------------
# * Confirmation Text
#--------------------------------------------------------------------------
Confirmation_Help = 'Are you sure?'
Confirmation_Yes = 'Yes'
Confirmation_No = 'No'
end

#==============================================================================
# ** Sphere_Grid_System::Grid_Points
#==============================================================================

module Sphere_Grid_System::Grid_Points
#--------------------------------------------------------------------------
# * Actor Grid Points
#
# These points are seperate for each actor
#--------------------------------------------------------------------------
Actor_Names = {
0 => 'Skill Unlock Points',#'Skill Points',
1 => 'Skill Upgrade Points'#,#'Speed Points',
#2 => 'Attack Power Points',
#3 => 'Defensive Power Points',
#4 => 'Accuraccy Points',
#5 => 'Cost Points',
#6 => 'Health Points',
#7 => 'Mind Points'
}
Actor_Icons = {
0 => '050-Skill07',
1 => '020-Accessory05'#,
#2 => '001-Weapon01',
#3 => '014-Body02',
#4 => '005-Weapon05',
#5 => '050-Skill07',
#6 => '009-Shield01',
#7 => '016-Accessory01'
}
Actor_Colors = {
0 => Color.new(rand(255), rand(255), rand(255)),
1 => Color.new(rand(255), rand(255), rand(255))#,
#2 => Color.new(rand(255), rand(255), rand(255)),
#3 => Color.new(rand(255), rand(255), rand(255)),
#4 => Color.new(rand(255), rand(255), rand(255)),
#5 => Color.new(rand(255), rand(255), rand(255)),
#6 => Color.new(rand(255), rand(255), rand(255)),
#7 => Color.new(rand(255), rand(255), rand(255))
}
#--------------------------------------------------------------------------
# * Party Grid Points
#
# These points are shared between all members of the party
#--------------------------------------------------------------------------
Party_Names = {
0 => 'Rose Petal Points'#,
#1 => 'Lock 1',
#2 => 'Lock 2',
#3 => 'Lock 3'
}
Party_Icons = {
0 => '036-Item05'#,
#1 => '029-Key01',
#2 => '030-Key02',
#3 => '031-Key03'
}
Party_Colors = {
0 => Color.new(rand(255), rand(255), rand(255))#,
#1 => Color.new(rand(255), rand(255), rand(255)),
#2 => Color.new(rand(255), rand(255), rand(255)),
#3 => Color.new(rand(255), rand(255), rand(255))
}
end

#==============================================================================
# ** Sphere_Grid_System::Actors
#==============================================================================

module Sphere_Grid_System::Actors
#--------------------------------------------------------------------------
# * Map Grids
#
# If Movement_Type == 0
# - Map_Start[actor_id] = [map_id, x, y]
#
# If Movement_Type == 1
# - Map_Start[actor_id] = [map_id, event_id]
#--------------------------------------------------------------------------
Map_Start = {}
Map_Start[1] = [84,69,79]
Map_Start[2] = [83,71,79]
Map_Start[3] = [82,71,79]
Map_Start[4] = {}
#Map_Start.default = [2, 15, 34]
end

#==============================================================================
# ** Sphere_Grid_System::Input
#==============================================================================

module Sphere_Grid_System::Input
#--------------------------------------------------------------------------
# * Grid Points Scoll Buttons
#
# 'Description' = ['Button Description', module::Constant]
#--------------------------------------------------------------------------
GP_Scroll_I_Buttons = {}
GP_Scroll_I_Buttons['Scroll Up'] = ['L', Input::L]
GP_Scroll_I_Buttons['Scroll Down'] = ['R', Input::R]
GP_Scroll_K_Buttons = {}
#--------------------------------------------------------------------------
# * Grid Points Scoll Type
#--------------------------------------------------------------------------
def self.gp_scroll_type(dir = 'Scroll Up')
return GP_Scroll_I_Buttons.has_key?(dir) ? 0 : 1
end
#--------------------------------------------------------------------------
# * Grid Points Scoll Description
#--------------------------------------------------------------------------
def self.gp_scroll_desc(dir = 'Scroll Up')
return GP_Scroll_I_Buttons.has_key?(dir) ? GP_Scroll_I_Buttons[dir][0] :
GP_Scroll_K_Buttons[dir][0]
end
#--------------------------------------------------------------------------
# * Grid Points Scoll Buttons
#--------------------------------------------------------------------------
def self.gp_scroll_button(dir = 'Scroll Up')
return GP_Scroll_I_Buttons.has_key?(dir) ? GP_Scroll_I_Buttons[dir][1] :
GP_Scroll_K_Buttons[dir][1]
end
end

#==============================================================================
# ** Sphere_Grid_System::Graphics
#==============================================================================

module Sphere_Grid_System::Graphics
#--------------------------------------------------------------------------
# * Confirmation Help Window Icon
#--------------------------------------------------------------------------
Confirmation_Icon = '033-Item02'
#--------------------------------------------------------------------------
# * Sphere Grid Actor Sprite
#
# 0 : Default actor sprite
# '': Empty sprite
# 'filename':
#--------------------------------------------------------------------------
SG_Actor_Sprite = 0
SG_Actor_Sprite_OX = 0
SG_Actor_Sprite_OY = 8
#--------------------------------------------------------------------------
# * Grid Points Window
#--------------------------------------------------------------------------
GP_Width = 288
GP_Height = 152
GP_Line_Spacing = 24
GP_Font = Font.new
GP_Font.size = 18
GP_Font.bold = true
#--------------------------------------------------------------------------
# * Grid Details Window
#--------------------------------------------------------------------------
GD_Width = 256
GD_Line_Spacing = 18
GD_Font = Font.new
GD_Font.size = 16
GD_Font.bold = true
end

#==============================================================================
# ** Sphere_Grid_System::Sphere_Grid
#==============================================================================

class Sphere_Grid_System::Sphere_Grid
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :event_id
attr_accessor :name # 'name'
attr_accessor :icon # 'filename'
attr_accessor :a_points # {point_id => n, ...}
attr_accessor :p_points # {point_id => n, ...}
attr_accessor :stats # {'actor_stat' => n, ...}
attr_accessor :skills # [skill_id, ...]
attr_accessor :skill_u_stats # {skill_id => [['stat_name', oper, n], ...]]
attr_accessor :skill_a_stats # {skill_id => [['stat_name', oper, n], ...]]
attr_accessor :event_links # [event_id, ...]
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@name = 'Grid'
@icon = '036-Item05'
@a_points = {}
@p_points = {}
@stats = {}
@skills = []
@skill_u_stats = {}
@skill_a_stats = {}
@event_links = []

#woar cost template:
#DAMAGE:
$dm1=1
$dm2=3
$dm3=6
$dm4=12
$dm5=20
#HEAL:
$dh1=1
$dh2=3
$dh3=6
$dh4=12
$dh5=18
#SP COST/SPEED/ACCURACY
$do1=1
$do2=2
$do3=4
$do4=6
$do5=10



end
#--------------------------------------------------------------------------
# * Add a_point
#--------------------------------------------------------------------------
def add_a_point(id, n)
@a_points[id] = 0 unless @a_points.has_key?(id)
@a_points[id] += n
end
#--------------------------------------------------------------------------
# * Add p_point
#--------------------------------------------------------------------------
def add_p_point(id, n)
@p_points[id] = 0 unless @p_points.has_key?(id)
@p_points[id] += n
end
#--------------------------------------------------------------------------
# * Add Stat
#--------------------------------------------------------------------------
def add_stat(name, n)
@stats end
#--------------------------------------------------------------------------
# * Add Skill Upgrade Stat
#--------------------------------------------------------------------------
def add_skill_u_stat(skill_id, name, operator, n)
# Create mod key
key = [name, operator, n]
# Create array
@skill_u_stats[skill_id] = [] unless @skill_u_stats.has_key?(skill_id)
# Add mod key to array
@skill_u_stats[skill_id] << key
end
#--------------------------------------------------------------------------
# * Add Skill Array Stat
#--------------------------------------------------------------------------
def add_skill_a_stat(skill_id, name, n)
# Create mod key
key = [name, n]
# Create array
@skill_a_stats[skill_id] = [] unless @skill_a_stats.has_key?(skill_id)
# Add mod key to array
@skill_a_stats[skill_id] << key
end
#--------------------------------------------------------------------------
# * Can unlock?
#--------------------------------------------------------------------------
def can_unlock?(actor)
# Return false if already unlocked
return false if actor.unlocked_grids.include?(@event_id)
# Check each actor point
@a_points.each {|id, n| return false if actor.grid_points[id] < n}
# Check each party points
@p_points.each {|id, n| return false if $game_party.grid_points[id] < n}
# Return true result
return true
end
#--------------------------------------------------------------------------
# * Unlock grid
#--------------------------------------------------------------------------
def unlock_grid(actor)
# Unlock grid
actor.unlocked_grids << @event_id
# Lose actor points
@a_points.each {|id, n| actor.lose_sphere_grid_point(id, n)}
# Lose party points
@p_points.each {|id, n| $game_party.lose_sphere_grid_point(id, n)}
# Gain stats
@stats.each {|stat_name, n| actor.add_sphere_stat_bonus(stat_name, n)}
# Skills
@skills.each do |skill_id|
if skill_id > 0
actor.learn_skill(skill_id)
else
actor.forget_skill(skill_id.abs)
end
end
# Skill stat mofications
skill_u_stats.each do |skill_id, upgrades|
actor.modify_skill_stats(skill_id, upgrades)
end
# Skill attay mofications
skill_a_stats.each do |skill_id, upgrades|
actor.modify_skill_array(skill_id, upgrades)
end
# Change sphere grid event to nil
$game_player.sphere_grid_event = nil
end
end

#==============================================================================
# ** Sphere_Grid_System::Window_GridName
#==============================================================================

class Sphere_Grid_System::Window_GridName < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 160
update
end
#--------------------------------------------------------------------------
# * Set Text
#--------------------------------------------------------------------------
def set_text(icon, name)
# If different icon or name
if icon != @icon || name != @name
# Save icon & name
@icon, @name = icon, name
# Clear Contents
self.contents.clear
# Get Font Size
ox = self.contents.text_size(name).width + 28
# Get x
x = self.contents.width / 2 - ox / 2
# Draw Icon
bitmap = RPG::Cache.icon(icon)
self.contents.blt(x, 4, bitmap, bitmap.rect)
# Draw Name
self.contents.draw_text(x + 28, 0, ox, 32, name)
end
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@sge = nil
update
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# If player sphere grid event changes
if @sge != $game_player.sphere_grid_event
# Save change
@sge = $game_player.sphere_grid_event
# Return If nil grid event
return if @sge == nil
# Get grid data
gd = $game_map.events[@sge].sphere_grid
# Set text & icon
set_text(gd.icon, gd.name)
end
# Alter visibility
self.visible = @sge != nil
end
end

#==============================================================================
# ** Sphere_Grid_System::Window_GridPoints
#==============================================================================

class Sphere_Grid_System::Window_GridPoints < Window_Base
#--------------------------------------------------------------------------
# * Read Line Spacing & Font
#--------------------------------------------------------------------------
LS = Sphere_Grid_System::Graphics::GP_Line_Spacing
FT = Sphere_Grid_System::Graphics::GP_Font
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor_id)
g = Sphere_Grid_System::Graphics
super(0, 328, g::GP_Width, g::GP_Height)
self.back_opacity = 160
@actor = $game_actors[actor_id]
create_contents
refresh
end
#--------------------------------------------------------------------------
# * Create Contents
#--------------------------------------------------------------------------
def create_contents
# Gets Font Size
# Start Height Counter
height = 32
# If use actor points
if Sphere_Grid_System::Points_Used.include?(0)
# Add each actor points
height += LS * Sphere_Grid_System::Grid_Points::Actor_Names.size + LS
end
# If use party points
if Sphere_Grid_System::Points_Used.include?(1)
# Add each party points
height += LS * Sphere_Grid_System::Grid_Points::Party_Names.size + LS
end
# If height > 32
if height > 32
self.contents = Bitmap.new(width - 32, height)
self.contents.font = FT
else
p 'You need to make some points'
end
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Clear contents
self.contents.clear
# Start y counter
y = 0
# Get input button descriptions
input = Sphere_Grid_System::Input
u = input.gp_scroll_desc('Scroll Up')
d = input.gp_scroll_desc('Scroll Down')
# Draw top (directions)
self.contents.font.color = normal_color
# self.contents.draw_text(0, y, contents.width, LS,
# "#{u}: Scroll Up, #{d}: Scoll Down", 1)
# Gets icon offset
io = (LS - 24) / 2
# Get grid points module
gp = Sphere_Grid_System::Grid_Points
# If use actor points
if Sphere_Grid_System::Points_Used.include?(0)
hbp = 12 #woar
# Draw actor points heading
apn = Sphere_Grid_System::Vocab::Actor_Grid_Point_Names
self.contents.draw_text(0, ((y += LS)-24), contents.width, LS, apn, 1)
# Pass through point types
for id in gp::Actor_Names.keys.sort
# Draw icon
bitmap = RPG::Cache.icon(gp::Actor_Icons[id])
self.contents.blt(4, (((y += LS) + io)-24), bitmap, bitmap.rect)
# Set font color
self.contents.font.color = gp::Actor_Colors[id]
# Draw point name
name = gp::Actor_Names[id]
self.contents.draw_text(32, ((y)-24), contents.width - 72, LS, name)
# Draw Number owned
n = @actor.grid_points[id].to_s
self.contents.draw_text(contents.width - 32, ((y)-24), 8, LS, ':', 2)
self.contents.draw_text(contents.width - 24, ((y)-24), 24, LS, n, 2)
end
end
# If use party points
if Sphere_Grid_System::Points_Used.include?(1)
# Draw party points heading
ppn = Sphere_Grid_System::Vocab::Party_Grid_Point_Names
self.contents.font.color = normal_color
self.contents.draw_text(0, ((y += LS)-24), contents.width, LS, ppn, 1)
# Pass through point types
for id in gp::Party_Names.keys.sort
# Draw icon
bitmap = RPG::Cache.icon(gp::Party_Icons[id])
self.contents.blt(4, (((y += LS) + io)-24), bitmap, bitmap.rect)
# Set font color
self.contents.font.color = gp::Party_Colors[id]
# Draw point name
name = gp::Party_Names[id]
self.contents.draw_text(32, ((y)-24), contents.width - 72, LS, name)
# Draw Number owned
n = $game_party.grid_points[id].to_s
self.contents.draw_text(contents.width - 32, ((y)-24), 8, LS, ':', 2)
self.contents.draw_text(contents.width - 24, ((y)-24), 24, LS, n, 2)
end
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# Get scroll tyoe
stu = Sphere_Grid_System::Input::gp_scroll_type('Scroll Up')
std = Sphere_Grid_System::Input::gp_scroll_type('Scroll Down')
# Key key
sub = Sphere_Grid_System::Input::gp_scroll_button('Scroll Up')
sdb = Sphere_Grid_System::Input::gp_scroll_button('Scroll Down')
# Handle Scrolling
if (stu == 0 && Input.press?(sub)) || (stu == 1 && Keyboard.press?(sub))
self.oy -= 4 if self.oy > 0
elsif (std == 0 && Input.press?(sdb)) || (std == 1 && Keyboard.press?(sdb))
self.oy += 4 if self.oy < self.contents.height - (self.height - 32)
end
end
end

#==============================================================================
# ** Sphere_Grid_System::Window_GridDetails
#==============================================================================

class Sphere_Grid_System::Window_GridDetails < Window_Base
#--------------------------------------------------------------------------
# * Read Line Spacing & Font
#--------------------------------------------------------------------------
LS = Sphere_Grid_System::Graphics::GD_Line_Spacing
FT = Sphere_Grid_System::Graphics::GD_Font
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor_id)
g = Sphere_Grid_System::Graphics
super(640 - g::GD_Width, 0, g::GD_Width, 64)
self.back_opacity = 160
self.visible = false
@actor = $game_actors[actor_id]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(sphere_grid)
# Stop if same sphere grid
#return if @sphere_grid == sphere_grid#woar
# Save sphere grid change
@sphere_grid = sphere_grid
# Get window height
height = 32
height += LS if sphere_grid.a_points.size > 0
height += LS * sphere_grid.a_points.size
height += LS if sphere_grid.p_points.size > 0
height += LS * sphere_grid.p_points.size
height += LS if sphere_grid.stats.size > 0
height += LS * sphere_grid.stats.size
height += LS * sphere_grid.skills.size
sphere_grid.skill_u_stats.each do |skill_id, upgrades|
height += LS
upgrades.each {|i| height += LS}
end
sphere_grid.skill_a_stats.each do |skill_id, upgrades|
height += LS
upgrades.each {|i| height += LS}
end
# Create window
self.height = height
self.y = 480 - height
# Create window contents
if self.contents != nil
self.contents.dispose
end
self.contents = Bitmap.new(width - 32, height -(32-18)) #- 32)
self.contents.font = FT
unless sphere_grid.can_unlock?(@actor)
self.contents.font.color = Color.disabled
end
# Start y counter
y = -LS
# Gets vocab module
vocab = Sphere_Grid_System::Vocab
# Gets grid point module
gp = Sphere_Grid_System::Grid_Points
# Draw actor point cost
if sphere_grid.a_points.size > 0
apn = vocab::Actor_Grid_Point_Names + ' Required'
self.contents.draw_text(0, (y += LS), contents.width, LS, apn)
for id in sphere_grid.a_points.keys.sort
self.contents.draw_text(8, (y += LS), contents.width, LS,
gp::Actor_Names[id])
points = ': ' + @actor.grid_points[id].to_s + ' / '
points += sphere_grid.a_points[id].to_s
self.contents.draw_text(8, y, contents.width - 12, LS, points, 2)
end
end
# Draw party point cost
if sphere_grid.p_points.size > 0
ppn = vocab::Party_Grid_Point_Names + ' Required'
self.contents.draw_text(0, (y += LS), contents.width, LS, ppn, 1)
for id in sphere_grid.p_points.keys.sort
self.contents.draw_text(8, (y += LS), contents.width, LS,
gp::Party_Names[id])
points = ': ' + $game_party.grid_points[id].to_s + ' / '
points += sphere_grid.p_points[id].to_s
#p
self.contents.draw_text(8, y, contents.width - 12, LS, points, 2)
end
end
# Draw stat gains
if sphere_grid.stats.size > 0
sgd = vocab::Stat_Gain_Description
self.contents.draw_text(0, (y += LS), contents.width, LS, sgd)
for stat_name in sphere_grid.stats.keys.sort
name = vocab::Stat_Names[stat_name]
self.contents.draw_text(8, (y += LS), contents.width, LS, name)
points = sphere_grid.stats[stat_name]
points = points > 0 ? ": +#{points}" : ": -#{points.abs}"
self.contents.draw_text(8, y, contents.width - 12, LS, points, 2)
end
end
# Draws skills to learn
sphere_grid.skills.each do |skill_id|
# Gets skill name
name = $data_skills[skill_id.abs].name
# Get string base
if skill_id > 0
string = sprintf(vocab::Skill_Learn_Description, name)
else
string = sprintf(vocab::Skill_Forget_Description, name)
end
# Draw Learn skill
self.contents.draw_text(0, (y += LS), contents.width, LS, string)

#woar draw skill description:::
if skill_id == 119
string = "Random elemental defense."
elsif skill_id == 120
string = "Random damage type defense."
elsif skill_id == 121
string = "Increases ally magic defense."
elsif skill_id == 122
string = "Increases ally physical defense."
elsif skill_id == 123
string = "Gradually recover Health Points."
elsif skill_id == 124
string = "Increases ally max Health Points."
elsif skill_id == 125
string = "Increases ally max Magic Points."
#elsif skill_id == 126
# string = "Lowers enemy magic defense."
elsif skill_id == 127
string = "Attack ignoring enemy defense."
elsif skill_id == 128
string = "Lowers enemy physical defense."
elsif skill_id == 129
string = "Lowers enemy magic defense."
elsif skill_id == 130
string = "Lowers enemy max Health Points."
elsif skill_id == 131
string = "Lowers enemy max Magic Points."
elsif skill_id == 132
string = "Removes enemy enhancing states."
elsif skill_id == 133
string = "Stops enemy Skill/magic use."
# elsif skill_id == 135
# string = "Lowers enemy magic defense."
elsif skill_id == 83
string = "Water damage to all enemies."
elsif skill_id == 84
string = "Physical damage to all enemies."
elsif skill_id == 85
string = "Wind damage to all enemies."
elsif skill_id == 86
string = "Blinds all enemies."
elsif skill_id == 87
string = "Freezes and deals water damage."
elsif skill_id == 88
string = "Stuns enemy with fire damage."
elsif skill_id == 92
string = "Mighty wind damage to everyone."
elsif skill_id == 93
string = "Physical damage to enemy."
elsif skill_id == 94
string = "Poisons enemy with earth damage."
elsif skill_id == 95
string = "Slows an enemy."
elsif skill_id == 96
string = "Water damage to an enemy."
elsif skill_id == 97
string = "Paralyzes an enemy."
elsif skill_id == 98
string = "Puts all enemies to sleep."
elsif skill_id == 99
string = "Mighty earth damage to everyone."
elsif skill_id == 101
string = "Slows an enemy."
elsif skill_id == 102
string = "Slowly lower enemy Health Points."
elsif skill_id == 103
string = "Increases ally speed."
elsif skill_id == 104
string = "Increases ally evasion."
elsif skill_id == 105
string = "Immediately stuns enemy."
elsif skill_id == 106
string = "Stops an enemy."
elsif skill_id == 107
string = "Stops everyone."
elsif skill_id == 108
string = "Restores ally Health Points."
elsif skill_id == 109
string = "Cures poisonous states."
elsif skill_id == 110
string = "Cures restraining states."
elsif skill_id == 111
string = "Cures immobilizing states."
elsif skill_id == 112
string = "Restores ally Magic Points."
elsif skill_id == 113
string = "Cures power decreasing states."
elsif skill_id == 114
string = "Restores allies Health Points."
elsif skill_id == 115
string = "Revives ally from K.O."
else
string = ""
end
#p skill_id
self.contents.draw_text(0, (y += LS), contents.width, LS, string)
self.height += 18
self.y -= 18
#woar


end
# Draws skill upgrades
sphere_grid.skill_u_stats.each do |skill_id, upgrades|
# Gets skill name
name = $data_skills[skill_id].name
string = sprintf(vocab::Skill_Upgrade_Description, name)
# Draw skill name
self.contents.draw_text(0, (y += LS), contents.width, LS, string)
# Pass through upgrades
upgrades.each do |statopn|
# Get stat name
string = vocab::Skill_U_Stats[statopn[0]]
# If scope modification
if statopn[0] == 'scope'
string += " : #{vocab::Skill_U_Scope[statopn[2]]}"
# If occassion modification
elsif statopn[0] == 'occassion'
string += " : #{vocab::Skill_U_Occasion[statopn[2]]}"
else
# Add operator and value
string += " #{statopn[1]} #{statopn[2]}"
end
# Draw upgrade
self.contents.draw_text(8, (y += LS), contents.width - 8, LS, string, 2)
end
end
# Draws skill array upgrades
sphere_grid.skill_a_stats.each do |skill_id, upgrades|
# Gets skill name
name = $data_skills[skill_id].name
string = sprintf(vocab::Skill_Upgrade_Description, name)
# Draw skill name
self.contents.draw_text(0, (y += LS), contents.width, LS, string)
# Pass through upgrades
upgrades.each do |statn|
# If element set
if statn[0] == 'element_set'
# Get element name
name = $data_system.elements[statn[1].abs]
# Add or remove
if statn[1] > 0
string = sprintf(vocab::Skill_A_Element_Description, name)
else
string = sprintf(vocab::Skill_R_Element_Description, name)
end
# If plus state set
elsif statn[0] == 'plus_state'
# Get state name
name = $data_states[statn[1].abs].name
# Add or remove
if statn[1] > 0
string = sprintf(vocab::Skill_A_PSS_Description, name)
else
string = sprintf(vocab::Skill_R_PSS_Description, name)
end
# If minus state state
elsif statn[0] == 'minus_state_set'
# Get state name
name = $data_states[statn[1].abs].name
# Add or remove
if statn[1] > 0
string = sprintf(vocab::Skill_A_MSS_Description, name)
else
string = sprintf(vocab::Skill_M_MSS_Description, name)
end
end
self.contents.draw_text(8, (y += LS), contents.width - 8, LS, string, 2)
end
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# If player sphere grid event changes
if @sge != $game_player.sphere_grid_event
# Save change
@sge = $game_player.sphere_grid_event
# Return If nil grid event
return if @sge == nil
# Get grid data
sg = $game_map.events[@sge].sphere_grid
# Refresh sphere grid details
refresh(sg)
end
# Alter visibility
self.visible = @sge != nil
end
end

#==============================================================================
# ** Game_Actor
#==============================================================================

class Game_Actor
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :grid_points
attr_accessor :sphere_grid_position
attr_accessor :unlocked_grids
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias_method :seph_spheregridsys_gmactr_setup, :setup
#--------------------------------------------------------------------------
# * Setup
#--------------------------------------------------------------------------
def setup(actor_id)
# Setup sphere grid stat bonuses
@sphere_grid_stat_bonuses = {}
Sphere_Grid_System::Vocab::Stat_Names.keys.each do |mn|
@sphere_grid_stat_bonuses[mn] = 0
end
# Original setup
seph_spheregridsys_gmactr_setup(actor_id)
# Setup grid points
@grid_points = {}
Sphere_Grid_System::Grid_Points::Actor_Names.keys.each do |id|
@grid_points[id] = 0
end
# Setup sphere grid position
@sphere_grid_position = *Sphere_Grid_System::Actors::Map_Start[actor_id]
# Create unlocked grids array
@unlocked_grids = []
end
#--------------------------------------------------------------------------
# * Add Sphere Grid Stat Bonus
#--------------------------------------------------------------------------
def add_sphere_stat_bonus(stat_name, n)
@sphere_grid_stat_bonuses[stat_name] += n
end
#--------------------------------------------------------------------------
# * Add Sphere Grid Point
#--------------------------------------------------------------------------
def add_sphere_grid_point(id, n)
@grid_points[id] += n
end
#--------------------------------------------------------------------------
# * Lose Sphere Grid Point
#--------------------------------------------------------------------------
def lose_sphere_grid_point(id, n)
@grid_points[id] -= n
end
#--------------------------------------------------------------------------
# * Auto Generate Sphere Grid Stat Bonuses
#--------------------------------------------------------------------------
Sphere_Grid_System::Vocab::Stat_Names.keys.each do |mn|
s = "alias_method :seph_spheregridsys_gmactr_#{mn}, :#{mn};"
s += "def #{mn};"
s += " n = seph_spheregridsys_gmactr_#{mn};"
s += " n += @sphere_grid_stat_bonuses['#{mn}'];"
s += " return n;"
s += "end"
eval s
end
end

#==============================================================================
# ** Game_Party
#==============================================================================

class Game_Party
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :grid_points
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias_method :seph_spheregridsys_gmparty_init, :initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Original initialization
seph_spheregridsys_gmparty_init
# Setup grid points
@grid_points = {}
Sphere_Grid_System::Grid_Points::Actor_Names.keys.each do |id|
@grid_points[id] = 0
end
end
#--------------------------------------------------------------------------
# * Add Sphere Grid Point
#--------------------------------------------------------------------------
def add_sphere_grid_point(id, n)
@grid_points[id] += n
end
#--------------------------------------------------------------------------
# * Lose Sphere Grid Point
#--------------------------------------------------------------------------
def lose_sphere_grid_point(id, n)
@grid_points[id] -= n
end
#--------------------------------------------------------------------------
# * Move to Sphere Grid
#--------------------------------------------------------------------------
def move_to_sphere_grid(actor_index)
# Save actor index
@sg_actor_index = actor_index
# Save Position
@sg_map_pos = [$game_map.map_id, $game_player.x, $game_player.y]
# Swap actor to lead actor
@actors[0], @actors[actor_index] = @actors[actor_index], @actors[0]
# Turn Sphere Grid System on
$game_player.sphere_grid_on = true
# Disable player if automovement types
if Sphere_Grid_System::Movement_Type == 1
$game_player.disable_player_movement = true
$game_player.direction_fix = true
end
# Switch character name
if (cn = Sphere_Grid_System::Graphics::SG_Actor_Sprite) != 0
# Save character name
@sg_character_name = $game_player.character_name
# Change character name
$game_player.character_name = cn
end
# Alter OX & OY offset
if (ox = Sphere_Grid_System::Graphics::SG_Actor_Sprite_OX) == 0 &&
(oy = Sphere_Grid_System::Graphics::SG_Actor_Sprite_OY)
# Save offsets
@sg_character_ox = $game_player.ox
@sg_character_oy = $game_player.oy
# Change offsets
$game_player.ox = ox
$game_player.oy = oy
end
# WoaR; turn caterpillar off
$caterpillar_status = $game_switches[168]
$running_status = $game_switches[157]
$speed_status = $game_switches[158]
$menuaccess_status = $game_system.menu_disabled
$game_system.menu_disabled = true
$game_switches[168] = true
$game_switches[157] = true
$game_switches[158] = true
#woar cost template:
#DAMAGE/HEAL:
#$dm1=1
# $dm2=3
# $dm3=6
# $dm4=12
# $dm5=20
#SP COST/SPEED/ACCURACY
# $do1=1
# $do2=2
# $do3=4
# $do4=6
# $do5=10

# Switch Map
if $scene.is_a?(Scene_Map)
$game_temp.player_transferring = true
position = @actors[0].sphere_grid_position
$game_map.setup(position[0])
$game_temp.player_new_map_id = position[0]
if Sphere_Grid_System::Movement_Type == 0
$game_temp.player_new_x = position[1]
$game_temp.player_new_y = position[2]
else
$game_temp.player_new_x = $game_map.events[position[1]].x
$game_temp.player_new_y = $game_map.events[position[1]].y
end
else
position = @actors[0].sphere_grid_position
$game_map.setup(position[0])
if Sphere_Grid_System::Movement_Type == 0
$game_player.moveto(position[1], position[2])
else
x = $game_map.events[position[1]].x
y = $game_map.events[position[1]].y
$game_player.moveto(x, y)
end
end
# Prepare for transition
Graphics.freeze
# Set transition processing flag
$game_temp.transition_processing = true


#woar BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD
#@overlay_sprite1 = Sprite.new
#@overlay_sprite1.bitmap = RPG::Cache.picture("SkillTreeOverlay1.png")
#@overlay_sprite1.z = 1
#woar



# Change to scene map if not already
$scene = Scene_Map.new unless $scene.is_a?(Scene_Map)
end
#--------------------------------------------------------------------------
# * Leave Sphere Grid
#--------------------------------------------------------------------------
def leave_sphere_grid
# Save player grid position
position = [$game_map.map_id, $game_player.x, $game_player.y]
if Sphere_Grid_System::Movement_Type == 0
@actors[0].sphere_grid_position = position
end
# Disable player if automovement types
if Sphere_Grid_System::Movement_Type == 1
$game_player.disable_player_movement = false
$game_player.direction_fix = false
end
# Restore character name
if (cn = Sphere_Grid_System::Graphics::SG_Actor_Sprite) != 0
$game_player.character_name = @sg_character_name
end
# Restore OX & OY offset
if (ox = Sphere_Grid_System::Graphics::SG_Actor_Sprite_OX) == 0 &&
(oy = Sphere_Grid_System::Graphics::SG_Actor_Sprite_OY)
$game_player.ox = @sg_character_ox
$game_player.oy = @sg_character_oy
end
# WoaR; turn caterpillar off
$game_system.menu_disabled = $menuaccess_status
$game_switches[168] = $caterpillar_status
$game_switches[157] = $running_status
$game_switches[158] = $speed_status
# Switch Map
if $scene.is_a?(Scene_Map)
$game_temp.player_transferring = true
$game_temp.player_new_map_id = @sg_map_pos[0]
$game_temp.player_new_x = @sg_map_pos[1]
$game_temp.player_new_y = @sg_map_pos[2]
else
$game_map.setup(@sg_map_pos[0])
$game_player.moveto(@sg_map_pos[1], @sg_map_pos[2])
end
# Turn Sphere Grid System off
$game_player.sphere_grid_on = false
# Prepare for transition
Graphics.freeze

#woar BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD
#@overlay_sprite1.bitmap.dispose
#@overlay_sprite1.dispose# if @overlay_sprite1 != nil
#woar


# Set transition processing flag
$game_temp.transition_processing = true
# Swap actor to lead actor
@actors[0], @actors[@sg_actor_index] = @actors[@sg_actor_index], @actors[0]
# Change to scene map if not already
$scene = Scene_Map.new unless $scene.is_a?(Scene_Map) #woar disabled
$scene = Scene_Menu2.new(5)#woar
end
end

#==============================================================================
# ** Game_Event
#==============================================================================

class Game_Event < Game_Character
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :sphere_grid
attr_reader :sphere_grid_unlocked
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias_method :seph_spheregridsys_gmevt_start, :start
alias_method :seph_spheregridsys_gmevt_otgr?, :eek:ver_trigger?
alias_method :seph_spheregridsys_gmevt_refresh, :refresh
#--------------------------------------------------------------------------
# * Unlock Grid
#--------------------------------------------------------------------------
def unlock_grid
# Turn through & transparent on
@through = true
@opacity=75#@opacity = 100#woar

# Set unlocked
@sphere_grid_unlocked = true
end
#--------------------------------------------------------------------------
# * Over Trigger
#--------------------------------------------------------------------------
def over_trigger?
# If in sphere grid and direct movement
if $game_player.sphere_grid_on && Sphere_Grid_System::Movement_Type == 1
return true
end
# Return original result
return seph_spheregridsys_gmevt_otgr?
end
#--------------------------------------------------------------------------
# * Start Event
#--------------------------------------------------------------------------
def start
#p
# Original start
seph_spheregridsys_gmevt_start
# If sphere grid
return if @sphere_grid == nil
# If cannot unlock
unless @sphere_grid.can_unlock?($game_party.actors[0])
# Play buzzer SE
$game_system.se_play($data_system.cancel_se)
return
end
# If previous grid not bought
if $game_player.disable_sphere_grid_buy && $game_party.act
# Play buzzer SE
$game_system.se_play($data_system.cancel_se)
return
end
# Start confirmation
$scene.sphere_grid_confirmation
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Original refresh
seph_spheregridsys_gmevt_refresh
# Clear sphere grid data
@sphere_grid = nil
# Stop if erased or nil list
return if @erased or @list == nil
# Pass through event list
@list.each do |ec|
# Skip if not comment
next if ec.code != 108 || ec.code == 408
# Get Parameter
ecp = ec.parameters[0].dup
# Get vocab module
vocab = Sphere_Grid_System::Vocab
# If comment is sphere grid comment
if ecp.downcase.include?(vocab::Sphere_Grid_Comment.downcase)
@sphere_grid = Sphere_Grid_System::Sphere_Grid.new
@sphere_grid.event_id = @id
next
end
# Skip if not a sphere grid
next if @sphere_grid == nil



# Variable Substitution
#p $dm1
#p ecp
#ecp.gsub!(/\((.+?)\)/) {"(#{eval $1})" rescue "(#{$1})"}
#ecp.gsub!(/\[(.+?)\]/) {"(#{eval $1})" rescue "(#{$1})"}
#ecp.gsub!(/\{(.+?)\}/) {"(#{eval $1})" rescue "(#{$1})"}
#ecp.gsub!(/\<(.+?)\>/) {"(#{eval $1})" rescue "(#{$1})"}
#p ecp
ecp.gsub!(/(\$\w+)/) {eval "#{$1}"}




# Grid event link
if ecp.downcase.include?(vocab::Grid_Event_Link.downcase)
ecp.gsub!(/\((.+?)\)/) {@sphere_grid.event_links << $1.to_i}
next
end
# Grid Name
if ecp.downcase.include?(vocab::Grid_Name_Comment.downcase)
ecp.gsub!(/\((.+?)\)/) {@sphere_grid.name = $1}
next
end
# Grid Icon
if ecp.downcase.include?(vocab::Grid_Icon_Comment.downcase)
ecp.gsub!(/\((.+?)\)/) {@sphere_grid.icon = $1}
next
end
# A Point
if ecp.downcase.include?(vocab::Grid_A_Point_Comment.downcase)
id, n = nil, nil
ecp.gsub!(/\((.+?)\)/) {id = $1.to_i}
ecp.gsub!(/\[(.+?)\]/) {n = $1.to_i}
@sphere_grid.add_a_point(id, n)
next
end
# P Point
if ecp.downcase.include?(vocab::Grid_P_Point_Comment.downcase)
id, n = nil, nil
ecp.gsub!(/\((.+?)\)/) {id = $1.to_i}
ecp.gsub!(/\[(.+?)\]/) {n = $1.to_i}
@sphere_grid.add_p_point(id, n)
next
end
# Stat
if ecp.downcase.include?(vocab::Grid_Stat_Comment.downcase)
stat, n = nil, nil
ecp.gsub!(/\((.+?)\)/) {stat = $1}
ecp.gsub!(/\[(.+?)\]/) {n = $1.to_i}
@sphere_grid.add_stat(stat, n)
next
end
# Skill
if ecp.downcase.include?(vocab::Grid_Skill_L_Comment.downcase)
ecp.gsub!(/\((.+?)\)/) {@sphere_grid.skills << $1.to_i}
next
end
# Skill Upgrade
if ecp.downcase.include?(vocab::Grid_Skill_U_Comment.downcase)
skill_id, stat, op, n = nil, nil, nil, nil
ecp.gsub!(/\((.+?)\)/) {skill_id = $1.to_i}
ecp.gsub!(/\[(.+?)\]/) {stat = $1}
ecp.gsub!(/\{(.+?)\}/) {op = $1}
ecp.gsub!(/\<(.+?)\>/) {n = $1.to_i}
@sphere_grid.add_skill_u_stat(skill_id, stat, op, n)
next
end
# Skill array stat
if ecp.downcase.include?(vocab::Grid_Skill_A_Comment.downcase)
skill_id, stat, n = nil, nil, nil
ecp.gsub!(/\((.+?)\)/) {skill_id = $1.to_i}
ecp.gsub!(/\[(.+?)\]/) {stat = $1}
ecp.gsub!(/\<(.+?)\>/) {n = $1.to_i}
@sphere_grid.add_skill_a_stat(skill_id, stat, n)
next
end
end
# If a sphere grid
if @sphere_grid != nil
# Get active actor
actor = $game_party.actors[0]
# Unlock event if already unlocked
unlock_grid if actor.unlocked_grids.include?(@id)
end
end
end

#==============================================================================
# ** Game_Player
#==============================================================================

class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :sphere_grid_on
attr_reader :sphere_grid_event
attr_reader :disable_sphere_grid_buy
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias_method :seph_spheregridsys_gmplyr_update, :update
alias_method :seph_spheregridsys_gmplyr_scnx, :screen_x
alias_method :seph_spheregridsys_gmplyr_scny, :screen_y
#--------------------------------------------------------------------------
# * Sphere Grid Event=
#--------------------------------------------------------------------------
def sphere_grid_event=(sphere_grid_event)
@sphere_grid_event = sphere_grid_event
@sg_pos = [nil, nil, nil]
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Original refresh
seph_spheregridsys_gmplyr_update
# If sphere grid off
if @sphere_grid_on == false || @sphere_grid_on == nil
# Clear sphere grid event
@sphere_grid_event = nil
return
end
# Update sphere grid event
update_sphere_grid_event
# If Auto-movement
if Sphere_Grid_System::Movement_Type == 1
# Update sphere grid movement
update_sphere_grid_movement
end
end
#--------------------------------------------------------------------------
# * Frame Update: Sphere Grid Event
#--------------------------------------------------------------------------
def update_sphere_grid_event
# Gets position
pos = [@x, @y, @direction]
# If position changes
if @sg_pos != pos
# Save position change
@sg_pos = pos
# Gets event standing and event in front
sp_events = [$game_map.event_at(@x, @y), event_front].compact
# Pass through "special" events
sp_events.each do |event|
# If sphere grid exist
if event.sphere_grid != nil
# Save event id
@sphere_grid_event = event.id
return
end
end
# Create ranged events list
ranges = {}
# Pass through events
$game_map.events.each do |id, evt|
# Skip if not sphere grid
next if evt.sphere_grid == nil
# Get range
r = VR.range(self, evt, false)
# Skip if range to far
next if r > Sphere_Grid_System::Grid_Range
# Save range
ranges[id] = r
end
# If no events found
if ranges.size == 0
# Clear sphere grid event
@sphere_grid_event = nil
return
end
# Set min ranged event
@sphere_grid_event = ranges.index(ranges.values.min)
end
end
#--------------------------------------------------------------------------
# * Frame Update: Sphere Grid Movement
#--------------------------------------------------------------------------
def update_sphere_grid_movement
# Return if nil sphere grid event
return if @sphere_grid_event == nil
# Gets event
event = $game_map.events[@sphere_grid_event]
# If direction is pressed
if Input.trigger?(Input::DOWN)
d = 2
elsif Input.trigger?(Input::LEFT)
d = 4
elsif Input.trigger?(Input::RIGHT)
d = 6
elsif Input.trigger?(Input::UP)
d = 8
end
# If direction pressed
if d != nil
# Set disable buy
@disable_sphere_grid_buy = !event.sphere_grid_unlocked
# Gets events list
events = event.sphere_grid.event_links
# Collect events
events = events.collect{ |e| $game_map.events[e] }
# Return if no events
if events.size == 0
p 'No event links defined for event: ' + event.id.to_s
return
end
# Get locations
locations = []
events.each { |e| locations << [e.x, e.y] }
# If Down
if d == 2
distances = {}
for i in 0...locations.size
if locations[1] > @y
distances = locations[1] - @y
end
end
# Return if no locations
return if distances.size == 0
# Gets event location
loc = locations[distances.index(distances.values.min)]
# If Left
elsif d == 4
distances = {}
for i in 0...locations.size
if locations[0] < @x
distances = @x - locations[0]
end
end
# Return if no locations
return if distances.size == 0
# Gets event location
loc = locations[distances.index(distances.values.min)]
# If Right
elsif d == 6
distances = {}
for i in 0...locations.size
if locations[0] > @x
distances = locations[0] - @x
end
end
# Return if no locations
return if distances.size == 0
# Gets event location
loc = locations[distances.index(distances.values.min)]
# If up
else
distances = {}
for i in 0...locations.size
if locations[1] < @y
distances = @y - locations[1]
end
end
# Return if no locations
return if distances.size == 0
# Gets event location
loc = locations[distances.index(distances.values.min)]
end
# Moveto link destination
moveto(loc[0], loc[1])
end
end
#--------------------------------------------------------------------------
# * Get Screen X-Coordinates
#--------------------------------------------------------------------------
def screen_x
# Get old position
n = seph_spheregridsys_gmplyr_scnx
# If on sphere grid
if sphere_grid_on
# Get sphere grid graphics
graphics = Sphere_Grid_System::Graphics
# If not using default sprite
if graphics::SG_Actor_Sprite != 0 && graphics::SG_Actor_Sprite != ''
# Add x offset
n += graphics::SG_Actor_Sprite_OX
end
end
# Return position
return n
end
#--------------------------------------------------------------------------
# * Get Screen Y-Coordinates
#--------------------------------------------------------------------------
def screen_y
# Get old position
n = seph_spheregridsys_gmplyr_scny
# If on sphere grid
if sphere_grid_on
# Get sphere grid graphics
graphics = Sphere_Grid_System::Graphics
# If not using default sprite
if graphics::SG_Actor_Sprite != 0 && graphics::SG_Actor_Sprite != ''
# Add y offset
n += graphics::SG_Actor_Sprite_OY
end
end
# Return position
return n
end
end

#==============================================================================
# ** Scene_Map
#==============================================================================

class Scene_Map
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias_method :seph_spheregridsys_scnmap_update, :update
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# If confirmation exist
if @sphere_grid_confirm_window != nil
update_sphere_grid_confirm
return
end
# Original update
seph_spheregridsys_scnmap_update
# If sphere grid on
if $game_player.sphere_grid_on
# Create windows if they don't exist
if @sphere_grid_name_window == nil
sgs = Sphere_Grid_System
a = $game_party.actors[0].id
@sphere_grid_name_window = sgs::Window_GridName.new
@sphere_grid_points_window = sgs::Window_GridPoints.new(a)
@sphere_grid_details_window = sgs::Window_GridDetails.new(a)
end


#@sphere_grid = Sphere_Grid_System::Sphere_Grid.new
#@sphere_grid_details_window.refresh(@sphere_grid) if @sphere_grid_details_window != nil #and $refreshspheregriddetails == true #woarrefresh


# If sphere grid off
else
# Dispose windows if they exist
if @sphere_grid_name_window != nil
@sphere_grid_name_window.dispose
@sphere_grid_points_window.dispose
@sphere_grid_details_window.dispose
@sphere_grid_name_window = nil
@sphere_grid_points_window = nil
@sphere_grid_details_window = nil
end
end
end
#--------------------------------------------------------------------------
# * Frame Update: Sphere Grid Confirmation
#--------------------------------------------------------------------------
def update_sphere_grid_confirm
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Remove sphere grid confirm window
@sphere_grid_confirm_window.dispose
@sphere_grid_confirm_window = nil
# Refresh sphere grid name window
@sphere_grid_name_window.refresh
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Branch by command
case @sphere_grid_confirm_window.command
when 'Yes'
# Get event
event = $game_map.events[$game_player.sphere_grid_event]
# Get sphere grid data
sg = event.sphere_grid
# Unlock sphere grid
sg.unlock_grid($game_party.actors[0])
# Unlock event
event.unlock_grid
# Save actor grid position
pos = [$game_map.map_id, event.id]
$game_party.actors[0].sphere_grid_position = pos
# Remove sphere grid confirm window
@sphere_grid_confirm_window.dispose
@sphere_grid_confirm_window = nil
# Refresh sphere grid name window
@sphere_grid_name_window.refresh
# Refresh sphere grid points
@sphere_grid_points_window.refresh
when 'No'
# Remove sphere grid confirm window
@sphere_grid_confirm_window.dispose
@sphere_grid_confirm_window = nil
# Refresh sphere grid name window
@sphere_grid_name_window.refresh
end
end
end
#--------------------------------------------------------------------------
# * Sphere Grid Confirmation
#--------------------------------------------------------------------------
def sphere_grid_confirmation
# Get vocab words
v = Sphere_Grid_System::Vocab
h = v::Confirmation_Help
y = v::Confirmation_Yes
n = v::Confirmation_No
# Set icon
icon = Sphere_Grid_System::Graphics::Confirmation_Icon
@sphere_grid_name_window.set_text(icon, h)
# Create confirmation
@sphere_grid_confirm_window = Window_Command.new(160, [y, n])
@sphere_grid_confirm_window.x = 240
@sphere_grid_confirm_window.y = 160
@sphere_grid_confirm_window.opacity = 160
end
end
">
">


And I have a second question, which is more of a read question. I don't know a thing about scripting (well, not enough anyway) to get the answer to this question. How do I need to set up the comments in the event to ake it so that the skill STATE is changed? E.g. that it adds poison to the enemy. For decreasing sp_cost, for example, you do:

: Sphere Grid
: Grid Name (SP Cost Down)
: Grid Icon (icon)
: Grid Link (event_id)
: A Grid Point (1) [1]
: Skill U (skill_id) [sp_cost] {-=} <1>

But what would I do to add the poison state? I know it's possible with the script, I just don't know how to put the comments. I tried the one below

: Skill A (87) [plus_state] <71>

But it gives this:

---------------------------
Whisper of a Rose
---------------------------
Script 'MCLAB 2.1' line 5422: TypeError occurred.

cannot convert nil into String
---------------------------
OK
---------------------------

For this line:

yeyinde_fontaddons_draw_text(*args)

@_@

Thanks! ^_^
">
">
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top