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,285
Reaction score
7,636
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
78
Reaction score
91
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,059
Reaction score
1,483
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

Yet another gaming question, i'm currently playing Last of Us 2 and want to get another game to play next but can't decide between Ghost of Tsushima, Miles Morales & Jedi Fallen Order. After the latest mandalorian i AM on a star wars kick, but i also LOVED the last spiderman game that prequels Miles Morales. Ghost of Tsushima is the bottom of my list but i heard it was AWESOME. Just want a good story & fun gameplay.
I checked out Genshin Impact gameplay out of curiosity. I can't believe it's available as a mobile game too. Smooth animation, great music, and stellar sound effects (the ambient sounds are pretty detailed).

I'm flabbergasted to see games have becoming more and more advanced. Maybe also because I'm oblivious to current trend for a long time, it almost feel like I'm being sent into distant future. xD
xDRAGOONx wrote on WaywardMartian's profile.
Your artwork is amazing!!!
:ewat:
Stream will be live shortly with a session of the Interactive Text Adventure! Feel free to drop by!
I should finish the cat video I'm editing and finish the indesign stuff. So far only 1 is done and 4 to go

Forum statistics

Threads
105,666
Messages
1,015,391
Members
137,341
Latest member
jasapembuatanwebsite
Top