Couldn't you create all the skill changes etc., as a Common Event, and have that called as a Parallel Process on the first map and it would carry on through the rest of the maps/game?
Yes, that's what I said in the post immediately above yours.
No concept of game specific skill information exists in the default VX Ace scripts. You only have the RPG::Skill data structure which stores static information about skills.
To handle skill change during game play I recommend creating a Game_Skill class to encapsulate how skill data changes during the course of a game, a bit similar to how you have Game_Actor.
class Module
def attr_sec_accessor(sym, default = 0)
attr_writer sym
attr_sec_reader sym, default
end
def attr_sec_reader(sym, default = 0)
sym = sym.id2name
string = "def #{sym} ;" +
" @#{sym} = #{default} if @#{sym}.nil? ;" +
" @#{sym} ;" +
"end ;"
module_eval(string)
end
end
##
# Game_Skill encapsulates the changes that may occur to skills during game play
# It uses the RPG::Skill objects for fetching default values
#
class Game_Skill
ATTRIBUTES = ['stype_id', 'mp_cost', 'tp_cost', 'message1', 'message2',
'required_wtype_id1', 'required_wtype_id2']
for attribute in ATTRIBUTES
# Computes the setter and getter code for the specific attribute
PROG = <<FIN
attr_writer :#{attribute}
def #{attribute}
if @#{attribute}.nil?
return @data.#{attribute}
else
return @#{attribute}
end
end
def #{attribute}_check(default)
return default if @#{attribute}.nil?
return @#{attribute}
end
FIN
# Evaluates the method definitions
eval(PROG)
end
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(data_item)
@data = data_item
end
end
##
# Hack for a simple copy-paste integration.
# Uses the $game_system god object to look at the current state of the game
# specific data. The cost is increased coupling probably more difficult
# debugging scenarios.
#
class RPG::Skill < RPG::UsableItem
for attribute in Game_Skill::ATTRIBUTES
PROG = <<FIN
def #{attribute}
return $game_system.skills[id].#{attribute}_check(@#{attribute}) if $game_system
return @#{attribute}
end
def #{attribute}=(value)
if $game_system
$game_system.skills[id].#{attribute} = value
else
@#{attribute} = value
end
end
FIN
# Evaluates the method definitions
eval(PROG)
end
end
#==============================================================================
# ** Game_Skills
#------------------------------------------------------------------------------
# This class handlesskiils. It's a wrapper for the built-in class "Array."
# Refer to "$game_system.skills" for the instance of this class.
#==============================================================================
class Game_Skills
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
if $data_skills.nil?
@data = []
else
@data = Array.new($data_skills.size)
end
end
#--------------------------------------------------------------------------
# * Get Skill
# skill_id : skill ID
#--------------------------------------------------------------------------
def [](skill_id)
if @data[skill_id] != nil
return @data[skill_id]
else
if $data_skills[skill_id] != nil
@data[skill_id] = Game_Skill.new($data_skills[skill_id])
return @data[skill_id]
end
return nil
end
end
#--------------------------------------------------------------------------
# * Set Armor
# skill_id : skill ID
# skill : a Game_Skill
#--------------------------------------------------------------------------
def []=(skill_id, skill)
@data[skill_id] = skill
end
end
##
# Putting the game skills collection in the game system class allows the changes
# to be stored in save files with low risk of compatibility issues
#
class Game_System
attr_sec_accessor :skills, 'Game_Skills.new'
end
I have included a bit of a hack so you can simply copy-paste code into your editor.
For changing mp and tp cost you can use these lines in script calls:
$data_skills[42].mp_cost = 20
$data_skills[42].tp_cost = 13
$game_system.skills[42].mp_cost = 120
$game_system.skills[42].tp_cost = 31
*hugs*
- Zeriab
Arghh!! I'm in fact using that script, so I had a solution all along and didn't realise it. Oh well, I'll know for another time.
Thanks for the tip.
Closing