# here we extend the Game_Actor class - responsible for handling party members - to add # a useful helper. it is not necessary to understand it for the purposes of this script, # but you may find it useful, if you are handy with scripting. class Game_Actor < Game_Battler # gets the equipment which matches type etype_id, if any. # if the character has two accessories equipped, only the first is returned. def get_equip(etype_id) equips.find{|equip| !equip.nil? and equip.etype_id == etype_id } end end # OKAY! here's the interesting bits you will want to customize! class Game_BattlerBase # this method (well, several lines down, due to the length of these comments :P) determines # whether or not an equipment slot is FIXED (can't be changed). # usually this is controlled by adding the "fixed slot" property to a character or class, # but we are modifying it here to ALSO check if the party is in a private location # when checking certain equipment types. # the thing you will probably want to change here is the little bit that says # "etype_id == 2 or etype_id == 3". "2" refers to the Head slot, and "3" refers to the # Body slot. if you wish to change which equipments are locked when not in private, # you should change these numbers. you can also add more, for example: # "etype_id == 1 or etype_id == 2 or etype_id == 3 or etype_id == 4" would check # shield (1), head (2), body (3), and accessory (4). by the way: weapons are slot 0. def equip_type_fixed?(etype_id) features_set(FEATURE_EQUIP_FIX).include?(etype_id) or (!$world.has_privacy and (etype_id == 2 or etype_id == 3)) end end class Game_Party < Game_Unit # returns true if any member of the party is indecent! # this method needs to check the same list of equipment slots as above! if you changed the # list of equipment slots that's locked when not in private, you also need to change # the list of equipment slots here. you might notice that the code looks a little # different, but hopefully you can identify the important numbers ("2" and "3"), and see how # they are strung together with "or". in this case, to check an equipment, we write # something like "actor.get_equip(2).nil?" where "2" can be replaced with any equipment # slot number (0 through 4). def indecent? members.any?{|actor| actor.get_equip(2).nil? or actor.get_equip(3).nil? } end end # this is a completely custom class used to store custom properties about the world. # for my game, I am storing many things, but for the purposes of this script, we are only # storing whether or not the party is in a private location. feel free to extend this class # to contain other variables, though; they will be saved and loaded with your game class Game_World attr_reader :has_privacy def initialize @has_privacy = true # if the party will start the game in a public location, change to false! end # whenever the party moves to a private location, you should create a script block # which contains "$game_world.in_private" def in_private @has_privacy = true end # whenever the party moves to a public location, you should create a script block # which contains "$game_world.in_public" def in_public @has_privacy = false end end # this is an extension of the build-in DataManager. we're registering our Game_World # object here, so that it's saved and loaded when you save and load a game. # you should not have to change anything here. module DataManager class << self alias :world_create_game_objects :create_game_objects alias :world_make_save_contents :make_save_contents alias :world_extract_save_contents :extract_save_contents end #-------------------------------------------------------------------------- # * Create Game Objects #-------------------------------------------------------------------------- def self.create_game_objects self.world_create_game_objects $game_world = Game_World.new end #-------------------------------------------------------------------------- # * Create Save Contents #-------------------------------------------------------------------------- def self.make_save_contents contents = self.world_make_save_contents contents[:game_world] = $game_world contents end #-------------------------------------------------------------------------- # * Extract Save Contents #-------------------------------------------------------------------------- def self.extract_save_contents(contents) self.world_extract_save_contents(contents) $game_world = contents[:game_world] end end