Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: Zexion on June 18, 2011, 11:40:06 am

Title: Idle Pose Script EDIT [resolved]
Post by: Zexion on June 18, 2011, 11:40:06 am
I have this script that makes idle poses work exactly the way they do in blizz abs, (the script was made here on chaos-project by winkio).
If you don't know how it works then allow me to explain. If you have a charset file named charset.png than it requires a file called charset_idl.png.
The problem is that it REQUIRES the extra set.

I want an edit to the script that would make it only use the pose if the file is found, and not if the file isn't!

Here's the script:
#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
#  With idle sprites.  name the idle sprites the same as their normal ones
#  except with '_idl' on the end (before the extension)
#==============================================================================

class Game_Player < Game_Character
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_reader   :character_name_org       # original character file name
 attr_reader   :current_sprite           # current sprite suffix
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 alias initialize_idlesprites_before initialize
 def initialize
   initialize_idlesprites_before
   # set original character name
   @character_name_org = @character_name
   # set current sprite
   @current_sprite = ""
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 alias update_idlesprites_before update
 def update
   update_idlesprites_before
   if @character_name != ""
     if moving?
       if @current_sprite != ''
         @step_anime = false
         @character_name = @character_name_org
         @current_sprite = ''
       end
     elsif Input.dir4 == 0
       if @current_sprite != '_idl'
         @character_name_org = @character_name
         @step_anime = true
         @character_name += '_idl'
         @current_sprite = '_idl'
       end
     end
   end
 end
end
Title: Re: Idle Pose Script EDIT
Post by: G_G on June 18, 2011, 02:07:45 pm
#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
#  With idle sprites.  name the idle sprites the same as their normal ones
#  except with '_idl' on the end (before the extension)
#==============================================================================

class Game_Player < Game_Character
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_reader   :character_name_org       # original character file name
 attr_reader   :current_sprite           # current sprite suffix
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 alias initialize_idlesprites_before initialize
 def initialize
   initialize_idlesprites_before
   # set original character name
   @character_name_org = @character_name
   # set current sprite
   @current_sprite = ""
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 alias update_idlesprites_before update
 def update
   update_idlesprites_before
   if @character_name != ""
     if moving?
       if @current_sprite != ''
         @step_anime = false
         @character_name = @character_name_org
         @current_sprite = ''
       end
     elsif Input.dir4 == 0
       if @current_sprite != '_idl'
         begin
           @character_name_org = @character_name
           @step_anime = true
           @character_name += '_idl'
           bmp = RPG::Cache.character(@character_name, 0)
           @current_sprite = '_idl'
         rescue
           @character_name = @character_name_org
            @step_anime = false
           return
         end
       end
     end
   end
 end
end


Done. :) Lemme know if it works. Its kind of a rough fix but it should do the job.
Title: Re: Idle Pose Script EDIT
Post by: Zexion on June 19, 2011, 12:00:10 am
First off, Thank you for trying :) , second okay I tried it and it still gives me an error if I don't have the file :(
Title: Re: Idle Pose Script EDIT
Post by: G_G on June 19, 2011, 12:01:57 am
Updated script, try now.
Title: Re: Idle Pose Script EDIT
Post by: Zexion on June 19, 2011, 12:23:16 am
Okay it works now but it does something I didn't think of! It animates the non idle pose too, I can probably fix that unless you wanna take another shot :p
thanks for this edit btw :P
Title: Re: Idle Pose Script EDIT
Post by: G_G on June 19, 2011, 12:54:44 am
Fixed again. xD
Title: Re: Idle Pose Script EDIT
Post by: Zexion on June 19, 2011, 01:18:24 am
Omg thanks lol it was starting to annoy me that i never got it! :P