Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: jcsnider on December 06, 2008, 05:15:49 pm

Title: Script to change actor sprite[resolved]
Post by: jcsnider on December 06, 2008, 05:15:49 pm
Ok I searched this time  :^_^':

I am looking for the small script that would change the actors sprite...
Title: Re: Script to change actor sprite
Post by: Fantasist on December 06, 2008, 05:20:53 pm
Can't you do that with the ""Change Actor Graphic" event command in the 3rd(?) tab? o.O
Title: Re: Script to change actor sprite
Post by: jcsnider on December 06, 2008, 05:23:42 pm
yes, but, I am not doing an event I am in the scripts  :wacko:
Title: Re: Script to change actor sprite
Post by: Fantasist on December 06, 2008, 05:36:10 pm
use the "set_graphic" method. Get the actor you want and execute the method. Example:


$game_actors[ACTOR_ID(in database)].set_graphic(charset_name, charset_hue, battler_name, battler_hue)
Title: Re: Script to change actor sprite
Post by: jcsnider on December 06, 2008, 05:48:17 pm
Ok, i will try it.. it looks as if it gets the char graphic from the database...

Is that what it does or does it do like Setplayer graphic = "graphic name"
I have no idea what i ma really talking about, it just looked long to just set player character graphic
Title: Re: Script to change actor sprite
Post by: Fantasist on December 07, 2008, 11:06:16 am
That function gets executed when you use the "Change Graphic" event command. If you observe, you'll be selecting 4 things there: character graphic, it's hue, battler graphic and it's hue. That method only sets 4 variables to their respective values. If you only want to change one of those 4, read the variables you don't want to change and put them in the set_graphic method. For example, if you want to change only the charset graphic, do this:


actor = $game_actors[ACTOR_ID_IN_DATABASE]
charset_name = "Your charset name here"
charset_hue = actor.character_hue
battler_name = actor.battler_name
battler_hue = actor.battler_hue
actor.set_graphic(charset_name, charset_hue, battler_name, battler_hue)


Or, you can make those variables attr_accessors so that you can direrctly change them.
Title: Re: Script to change actor sprite
Post by: jcsnider on December 07, 2008, 11:12:01 am
Ok thanks, I will test it and edit with a works or not



Ok I got it, thanks Fantasist
Title: Re: Script to change actor sprite
Post by: Fantasist on December 07, 2008, 11:44:05 am
Then add the resolved tag ;)