#=============================================================================== # Dynamic Face Changing # By Jet10985 (Jet) # Request By: Kyriaki #=============================================================================== # This script will allow you to set up conditions for an actors face to be # changed automatically. # This script has: 1 customization option. #=============================================================================== # Overwritten Methods: # None #------------------------------------------------------------------------------- # Aliased methods: # Game_System: initialize #=============================================================================== =begin To lock an actor's face: To lock an actor's face, which means none of the below conditionals will be checked, so the face will appear as whatever was last set by an event, use this in an Event Script... command lock_actor_face(actor_id) actor_id should be the database id of the actor whose face should be locked. -------------------------------------------------------------------------------- To unlock an actor's face: Follow the same instructions as above, but with this command instead: unlock_actor_face(actor_id) =end module JetDynamicFaces #============================================================================= # How to configure: #============================================================================= # Follow this format: actor_id => ["Face Name", index, :type, condition] #----------------------------------------------------------------------------- # actor_id is the database id of the actor in the database. # More than 1 condition can be used per actor, you should NOT use the same # id in the config more than once. #----------------------------------------------------------------------------- # "Face name" is the name of the face file in the Graphic/Faces folder # You may also use :face instead, which will use their currently set face, # as set by the database or event. #----------------------------------------------------------------------------- # index is the index of the face in the picture above #----------------------------------------------------------------------------- # :type is the type of conditional that it will check for. It can be: # :hp which will check if their hp is below a percentage. # :mp which will check if their mp is below a percentage. # :state which will check if a state is applied to the actor. #----------------------------------------------------------------------------- # condition is what should be checked from the :type # If type is :hp or :mp, this should be the percentage to check. # If type is :state, this should be the id of the state to check for. #----------------------------------------------------------------------------- # Please note, the order of the conditionals will determine priority. # The face will be from whichever conditional is matched last, so low # priority conditions should be first. #----------------------------------------------------------------------------- ACTOR_DYNAMIC_FACES_CONDITIONS = { 1 => [["People1", 2, :hp, 75], ["People1", 1, :hp, 50], ["People1", 0, :hp, 25]], 2 => [[:face, 0, :mp, 25], [:face, 1, :state, 1]] } end #=============================================================================== # DON'T EDIT FURTHER UNLESS YOU KNOW WHAT TO DO. #=============================================================================== class Game_System attr_accessor :locked_actor_faces alias jet1280_initialize initialize unless $@ def initialize(*args, &block) @locked_actor_faces = [] jet1280_initialize(*args, &block) end end class Game_Actor def face_name return @face_name if $game_system.locked_actor_faces.include?(self.id) if JetDynamicFaces::ACTOR_DYNAMIC_FACES_CONDITIONS.keys.include?(self.id) jet_face_name = @face_name for cond in JetDynamicFaces::ACTOR_DYNAMIC_FACES_CONDITIONS[self.id] case cond[2] when :hp if self.hp.to_f / self.maxhp <= cond[3] / 100.0 jet_face_name = cond[0] == :face ? @face_name : cond[0] end when :mp if self.mp.to_f / self.maxmp <= cond[3] / 100.0 jet_face_name = cond[0] == :face ? @face_name : cond[0] end when :state if self.state?(cond[3]) jet_face_name = cond[0] == :face ? @face_name : cond[0] end end end return jet_face_name else return @face_name end end def face_index return @face_index if $game_system.locked_actor_faces.include?(self.id) if JetDynamicFaces::ACTOR_DYNAMIC_FACES_CONDITIONS.keys.include?(self.id) jet_face_index = @face_index for cond in JetDynamicFaces::ACTOR_DYNAMIC_FACES_CONDITIONS[self.id] case cond[2] when :hp if self.hp.to_f / self.maxhp <= cond[3] / 100.0 jet_face_index = cond[1] end when :mp if self.mp.to_f / self.maxmp <= cond[3] / 100.0 jet_face_index = cond[1] end when :state if self.state?(cond[3]) jet_face_index = cond[1] end end end return jet_face_index else return @face_index end end end class Game_Interpreter def lock_actor_face(id) unless $game_system.locked_actor_faces.include?(id) $game_system.locked_actor_faces.push(id) end end def unlock_actor_face(id) if $game_system.locked_actor_faces.include?(id) $game_system.locked_actor_faces.delete(id) end end end