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,836
Reaction score
7,894
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

Worldsmith
Veteran
Joined
Mar 3, 2020
Messages
210
Reaction score
214
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,227
Reaction score
1,635
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 !
 

Latest Threads

Latest Profile Posts

Looking back at some sketches, and game design documents on my PC dated summer of 2015. I started development with the release of MZ, but in 2015, I felt a strong desire to make a game out of the blue. I remember feeling sad for no apparent reason, and all these ideas rushed into my head. Now that I think about it, since that day, everything has become easier to do on my PC . . . it’s very creepy.
Everything's going to be alright! We're all in this together. <3
Aaaaannd published my game's tech demo. :D

Feel free to download and play it. And give feedback!
Hey everyone, we know that the edit bar is missing. We're working on it. You can talk about it in the announcement here: https://forums.rpgmakerweb.com/index.php?threads/forum-errors-missing-edit-bar-etc.132715/
So, explain why we can no longer use BBC code or smilies in our posts? This sparks much sadness...

Forum statistics

Threads
107,794
Messages
1,032,263
Members
139,941
Latest member
Finley
Top