DadGuyDrawing

Veteran
Veteran
Joined
Apr 15, 2020
Messages
91
Reaction score
36
First Language
English
Primarily Uses
RMMV
Hi RPG Maker community.

Does anyone know if you can make an enemy name "dynamic"? In other words, I would like to name an enemy from a variable, so I would have variable 51 be "JimBob" and then I would name enemy battler "\v[51]". This actually works when it says the enemy attacks "JimBob attacks!" in the battle description text, but the battler itself says "\v[51]".

Any suggestions would be most welcome! Thanks.
 

DadGuyDrawing

Veteran
Veteran
Joined
Apr 15, 2020
Messages
91
Reaction score
36
First Language
English
Primarily Uses
RMMV
I'm guessing that somehow the game interpreter doesn't evaluate the text for in-game codes, but I figure there has to be someway of forcing it.

Or maybe renaming it somehow when the battle starts? Is anyone aware of a way to do that? Open to using a plugin, or javascript if necessary.
 

Beregon

Veteran
Veteran
Joined
Aug 25, 2020
Messages
177
Reaction score
115
First Language
Czech
Primarily Uses
RMMZ
If you want to rename a specific enemy (meaning one from the Enemy database tab), then you could do something like this:

Code:
$dataEnemies[20].name = 'Evil';


This would rename the enemy with Id 20 to Evil. If you add this script call right before the battle starts, the enemy will have his new name right away and it will show in the "Enemy Emerged" text without a problem.

Adding the script call to the troop event at turn 0 instead of before the battle is triggered will only change the name after the "Enemy Emerged" text, so the old name will display at first unless you change something.

You can, of course, use this script call in the troop event itself to keep changing the name of the enemy, if you need it.

Keep in mind, this changes the enemy's name, not a specific troop member's name, so if you have more than one copy of this specific enemy in the troop, they will all share the new name.

If you want to change the enemy's name specifically to the value of a variable, than use something like this, just change the 20 to the enemy's Id and the 1 to the Variable's Id.

Code:
$dataEnemies[20].name = $gameVariables.value(1);


As for changing a specific troop member's name, those are stored in a const array (so, they aren't able to be redeclared), so I guess that would most likely require some code changes via a plugin. Shouldn't be hard though.
 

DadGuyDrawing

Veteran
Veteran
Joined
Apr 15, 2020
Messages
91
Reaction score
36
First Language
English
Primarily Uses
RMMV
What a great community! Thank you @TSR and @Beregon you both have solved my problem (and added some new possibilities to my game) in record time!
 

Latest Threads

Latest Posts

Latest Profile Posts

uOy9Wjc.png

Something something.
Dev be like: "I'll make the character goes amnesia so I could explain the world and the lore better and immersive to the players"
Whoever decided that the 5th area of Xenoblade 3 had to be THAT big and be explored in the manner it does needs to be shot. My OCD cannot leave a tiny shard of the map hidden and those controls can go right on and f*** themselves. -.-

/rant off
Raggon wrote on NoPatience's profile.
:kaohi:

Forum statistics

Threads
124,435
Messages
1,163,622
Members
163,247
Latest member
renice
Top