Group: Member
Posts: 19
Type: Artist
RM Skill: Skilled
I am using DrakoShade's Self-Variable Script and whenever I start, it gives an error like this:
It mentioned there that it's incompatible with anything else that alters the conditions_met? method of Game_Event. Is there any way someone could fix this? Thank you guys so much :'>
Here's his code:
CODE
#============================================================================== # ** Game_SelfVariables #------------------------------------------------------------------------------ # This class handles self variables. It's a wrapper for the built-in class # "Hash." Refer to "$game_self_variables" for the instance of this class. #==============================================================================
class Game_SelfVariables #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize @data = {} end #-------------------------------------------------------------------------- # * Get Self Variable # key : key #-------------------------------------------------------------------------- def [](key) return @data[key] == nil ? 0 : @data[key] end #-------------------------------------------------------------------------- # * Set Self Variable # key : key # value : the variable's value #-------------------------------------------------------------------------- def []=(key, value) @data[key] = [[value, -99999999].max, 99999999].min end end
#============================================================================== # ** Self Variable Interpreter #------------------------------------------------------------------------------ # This class handles the translation of $game_self_variables into an array # so that any individual event can treat its own self_variables as such. It's # pretends to be an Array, so far as the interaction requires. #==============================================================================
class SelfVarInterpreter attr_accessor :key #--------------------------------------------------------------------------- # * Object Initialization # key = [$game_map.map_id, @event_id] #--------------------------------------------------------------------------- def initialize @key = [0, 0] end #--------------------------------------------------------------------------- # * Get Self Variable # variable_id : variable's ID #--------------------------------------------------------------------------- def [](variable_id) key = [@key[0], @key[1], variable_id] return $game_self_variables[key] end #--------------------------------------------------------------------------- # * Set Self Variable # variable_id : variable's ID # value : the variable's value #--------------------------------------------------------------------------- def []=(variable_id, value) key = [@key[0], @key[1], variable_id] $game_self_variables[key] = value $game_map.need_refresh = true end end
#-------------------------------------------------------------------------- # * Determine if Event Page Conditions are Met #-------------------------------------------------------------------------- def conditions_met?(page) c = page.condition if c.switch1_valid # Swtich 1 return false if $game_switches[c.switch1_id] == false end if c.switch2_valid # Swtich 2 return false if $game_switches[c.switch2_id] == false end if c.variable_valid # Variable #---------------------------------------------------------------------- # Changes begin here. #---------------------------------------------------------------------- for i in 0...page.list.size if page.list[i].code == 108 if page.list[i].parameters[0].include?("use self variable") use_self_variable = true end end end if use_self_variable == true key = [@map_id, @id, c.variable_id] return false if $game_self_variables[key] < c.variable_value else return false if $game_variables[c.variable_id] < c.variable_value end #---------------------------------------------------------------------- # Changes end here. #---------------------------------------------------------------------- end if c.self_switch_valid # Self switch key = [@map_id, @event.id, c.self_switch_ch] return false if $game_self_switches[key] != true end if c.item_valid # Item item = $data_items[c.item_id] return false if $game_party.item_number(item) == 0 end if c.actor_valid # Actor actor = $game_actors[c.actor_id] return false unless $game_party.members.include?(actor) end return true # Conditions met end end
#============================================================================== # ** Scene_Title #------------------------------------------------------------------------------ # Appropriate aliasing made here to create the $game_self_variables hash. #============================================================================== class Scene_Title alias ds_self_variables_create_game_objects create_game_objects def create_game_objects $game_self_variables = Game_SelfVariables.new ds_self_variables_create_game_objects end end
#============================================================================== # ** Scene_File #------------------------------------------------------------------------------ # Self variables added to save_data and load_data. #============================================================================== class Scene_File alias ds_self_variables_write_save_data write_save_data def write_save_data(file) ds_self_variables_write_save_data(file) Marshal.dump($game_self_variables, file) end
alias ds_self_variables_read_save_data read_save_data def read_save_data(file) ds_self_variables_read_save_data(file) $game_self_variables = Marshal.load(file) end end
EDIT: Thanks to Kread-Ex for solving! :>
This post has been edited by Erangot: Feb 3 2012, 02:44 AM