Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: zephrael on May 27, 2013, 06:23:30 pm

Title: [RESOLVED] Change default actor graphic via script
Post by: zephrael on May 27, 2013, 06:23:30 pm
Hey,

I'm using a couple of scripts that use the character's default graphic (i.e. from the database) for various functions - a battle system, for example. However if I change the character's graphic via events, the scripts don't pay attention to that change - that is, when the battle scene starts etc, the 'old' character graphic defined in the database is shown rather than whatever I changed it to. Is there any way to change the default graphic via a script call so that my battle system etc will use the graphics I want?

Thanks!
Title: Re: Change default actor graphic via script
Post by: G_G on May 27, 2013, 07:26:54 pm
$data_actors[ID].character_name = "your graphic here"
Title: Re: Change default actor graphic via script
Post by: zephrael on May 27, 2013, 08:27:26 pm
Thanks for the reply! I tried that out, but it gave a NoMethodError:

undefined method 'character_name=' for nil:NilClass

I assumed it was maybe that you didn't mean to write character name, so I tried 'character_sprites', but that gave the same error. Any suggestions?
Title: Re: Change default actor graphic via script
Post by: KK20 on May 27, 2013, 09:01:09 pm
Where are you using that script call? It looks like it's being called before the title scene.
But I think G_G meant to say $game_actors. Making a change to $data_actors wouldn't make any changes in-game since those are the database configurations. But you will have to turn Game_Actor#character_name into an attr_accessor first.

So open up your scripts, find Game_Actor, and then find
attr_reader   :character_name
Turn reader into accessor. Your script call should now be
$game_actors[ID].character_name = "your graphic here"
Title: Re: Change default actor graphic via script
Post by: zephrael on May 27, 2013, 09:15:14 pm
It's running in a parallel process. I tried what you said, but it returned the same error as before! What could be wrong?
Title: Re: Change default actor graphic via script
Post by: KK20 on May 27, 2013, 09:22:39 pm
When does the error occur? Before/After the title screen?
What scripts are you using?
Title: Re: Change default actor graphic via script
Post by: zephrael on May 27, 2013, 09:42:12 pm
It's running after the title screen, in a parallel process on a map. Here's a list of all other scripts I'm using:
Prexus Crafting
ForeverZer0 Item Weight
Hermes CMS
game_guy's Quest Log
Modified Name Input (Don't remember who it's by!)
game_guy's Item Storage
game_guy's Skill Items
Reno-S--Joker's Ring Menu
Enu's Sideview Battle System

Could any of these be disrupting it?
Title: Re: Change default actor graphic via script
Post by: KK20 on May 27, 2013, 09:49:10 pm
Sounds like a possible script conflict then.
Make a new project (you'll delete it afterwards) and do the same things I have instructed you to do. If the error doesn't pop up, then I will require a demo. I don't know why but one of your scripts is most likely not defining $game_actors upon starting a new game.

EDIT: You aren't using a 0 in place of ID, right?
Title: Re: Change default actor graphic via script
Post by: zephrael on May 27, 2013, 09:58:45 pm
Same errors in a blank project, yeah :/

Oh... I am using 0 for the ID, yeah. What should I be doing?
Title: Re: Change default actor graphic via script
Post by: KK20 on May 27, 2013, 10:01:01 pm
The values used should match the actor's position in the database. The first actor, Aluxes, is 1. Basil is 2. etc.
Title: Re: Change default actor graphic via script
Post by: zephrael on May 27, 2013, 10:06:09 pm
Ah, there we go! Ha I'm quite an idiot.

It's fine now, but it hasn't really fixed my initial problem... My battle system still uses the charset set in the database rather than the one I set with that script command. Any idea at all how to fix that?

EDIT: Ulp, I'm a fool. I forgot that for testing purposes I set the script to change to 001-Fighter01 rather than the one I wanted. It's fine! Thanks for all your help!
Title: Re: [RESOLVED] Change default actor graphic via script
Post by: G_G on May 28, 2013, 10:23:37 am
@KK20: I meant $data_actors, because his issue it sounded like that the scripts were using $data_actors[ID].character_name rather than $game_actors[ID].character_name so that's why I chose that one.