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,737
Reaction score
7,852
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
199
Reaction score
210
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,219
Reaction score
1,629
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 Posts

Latest Profile Posts

Made a surprising amount of progress in these past two days. Really helps when parallax mapping breaks limitation and allowing me to be creative and make maps that match my vision.
Let's promote our amazing artists in RPG Maker community! I posted right now about my game Phil Alone on Twitter and I decided to thanks Lime Zu, the amazing artist that did all the pixel assets for my game!
I just realised that the reason behind me not being able to make a game may be the lack of my original resources. I just dont like the look of MV faces and sprites, lol. Guess I will have make my own art.
I'm posting a commission art soon! :kaoswt2:
So here's a fun/tragic fact about me: I have an awful memory. But to be correct, I have memory "leaks". My memory is actually amazing, my issue is I can't keep memories for long, in fact, I once forgot my name. :kaoswt2:

Forum statistics

Threads
107,452
Messages
1,029,803
Members
139,583
Latest member
KenanPal
Top