Dynamic Enemy Battler Names (from Variables)

DadGuyDrawing

Veteran
Veteran
Joined
Apr 15, 2020
Messages
58
Reaction score
20
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
58
Reaction score
20
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
92
Reaction score
58
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
58
Reaction score
20
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!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,085
Members
137,584
Latest member
Faustus2501
Top