Stock an Actor Name into a variable

BladeRED

Villager
Member
Joined
Sep 5, 2020
Messages
21
Reaction score
7
First Language
French
Primarily Uses
RMMV
Hello there !

I am developing a game where the hero can change his appearance and class. For that I use an event that switches between each actor to change the hero.

But I don't want to change the hero's name, which obviously changes between each actor switch. I tried to store the hero's name in a script command ( $game_actors[1].name ) but it doesn't work, does anyone know another way to do it ?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,255
Reaction score
7,632
First Language
German
Primarily Uses
RMMV
it should work with a script command, but why are you even switching around actors?
If you want the player to customize the actor, it would be better to stay with a single actor and change that one to whatever you want it changed - no need for multiple actors there as everything in the actor can be changed with the appropiete event command.
 

BladeRED

Villager
Member
Joined
Sep 5, 2020
Messages
21
Reaction score
7
First Language
French
Primarily Uses
RMMV
I need to change actors because i have a plugin that modify battlers in combat , and i can't use it with only one actor, i need several actors for several battlers.
 

Celestrium

Adventurer
Veteran
Joined
Mar 3, 2020
Messages
77
Reaction score
90
First Language
English
Primarily Uses
RMMZ
I believe you just have an event that when the actor changes names it changes the name of all the actors?

Do your players name the characters? If so, that's a bit more difficult and I would need to brainstorm a bit...

There might also be a plugin...I think Himeworks instance actors or something might work...
 
Last edited:

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,056
Reaction score
1,482
First Language
EN
Primarily Uses
RMMZ
Not sure whether this is the best approach, but for MV (or MZ) it would be Control Variables > Script:
JavaScript:
$gameActors.actor(1).name()
Swap 1 for the actor ID. Alternatively, by position in the party:
JavaScript:
$gameParty.members()[0].name()
Swap 0 for the member index (0 = leader, 1 = first follower, etc).

You can then set another actor's name to that stored value using a Script command:
JavaScript:
$gameActors.actor(1).setName($gameVariables.value(2));
Swap 1 for the actor ID, and 2 for the variable ID.
 

BladeRED

Villager
Member
Joined
Sep 5, 2020
Messages
21
Reaction score
7
First Language
French
Primarily Uses
RMMV
That's what i tried but it doesn't work, because, for being more precise, i have an event that replace the leader in the party (the hero) by another one in the actor's database.

And yes, the player can choose the name of the hero, that's why it's a little tricky ^^.

I've tried to use the script $gameactors(id).name by putting it on a variable, then use another variable as a condition for changing the name of the hero.

The idea is, for example : The hero is A, then he evolve into B. A_Name = $gameactors(1).name. If hero is B then B_Name = £gameActors(1).name

But i will try another approach.
 

BladeRED

Villager
Member
Joined
Sep 5, 2020
Messages
21
Reaction score
7
First Language
French
Primarily Uses
RMMV
Double post sorry !

I've got it ! I use this :

$gameActors.actor(2).setName($gameActors.actor(1).name()); in my call of my common event and it works perfectly :) .

Thank you very much for the help !
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Realizing my earlier maps are an abomination against all things, I'm doing a bit of a remake. Tell me if you can see the difference. :LZSwink:



And the horrific before pics...

Last part of OcRam Obfuscator sneek peaks!
YES! officially released my games soundtrack on Itunes, Spotify, and Amazon..... kinda cool!

Another old age version of Reid. Trying out different style.

Forum statistics

Threads
105,597
Messages
1,014,897
Members
137,266
Latest member
Bradzackyle
Top