DGM

Veteran
Veteran
Joined
Jul 22, 2013
Messages
71
Reaction score
12
Primarily Uses
Is there an easy way to change an individual enemy's name mid-battle without replacing the battler? There's no script call for it and I haven't found a plugin. The new name will not chosen by the player so no input is needed.
 

waynee95

Inactive
Veteran
Joined
Jul 2, 2016
Messages
710
Reaction score
644
First Language
German
Primarily Uses
RMMV
You could do $dataEnemies[ID].name = 'Test'

Problem is when there are more enemies of that same type the name will be changed for all of them.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
3,144
Reaction score
2,273
First Language
Spanish
Primarily Uses
RMVXA
you can use a troop event, and force-edit the active troop.
you'll have to re-define the object enemy, so that the name can be changed (as it is by default, it's read-only)
but yes, you can do it on the fly.
 
Last edited:

DGM

Veteran
Veteran
Joined
Jul 22, 2013
Messages
71
Reaction score
12
Primarily Uses
Does anyone know where the code is for drawing an enemy's name in battle? I've searched the .js files for "drawText" but I'm coming up empty.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
3,144
Reaction score
2,273
First Language
Spanish
Primarily Uses
RMVXA
window_battleenemy -> drawitem() -> drawtext()
with each item being [member].name, out of gameTroop.members[]
with name being originalname + letter, with letter defined by gameTroop.makeUniqueNames.
give or take a "_", those are the function names.

originalName is read-only.
redefine that, and it should work.
 

Shaz

Keeper of the Nuts
Global Mod
Joined
Mar 2, 2012
Messages
46,045
Reaction score
16,852
First Language
English
Primarily Uses
RMMV
Have you thought of using the Transform Enemy command?
 

DGM

Veteran
Veteran
Joined
Jul 22, 2013
Messages
71
Reaction score
12
Primarily Uses
@gstv87

There it is! Okay, I should hopefully be able to figure it out from here. Thanks.



@Shaz

Transform isn't practical for my purposes. The idea is to draw modifiers for each enemy from a pool of options, rogue-lite style. To do that with transform I'd need many versions of every single enemy type in the game.
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
757
Reaction score
630
First Language
French
Primarily Uses
Just edit the name method of the particular enemy with a script call.

Code:
$gameTroop.members()[index].name = function() {return "your new name"}

This will have no lasting effect since it modifies an enemy instance and not the data itself from where enemies are created at battle start.
 

DGM

Veteran
Veteran
Joined
Jul 22, 2013
Messages
71
Reaction score
12
Primarily Uses
Problem solved. I overwrote the Game_Enemy.prototype.name function to append the text I wanted. Thanks for the help, guys.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
3,144
Reaction score
2,273
First Language
Spanish
Primarily Uses
RMVXA
Problem solved. I overwrote the Game_Enemy.prototype.name function to append the text I wanted. Thanks for the help, guys.

and that, ladies and gentlemen, is what programmers do.
 

Latest Threads

Latest Profile Posts



The project is going well, it's just I rarely share clips and stuff 'round here
I'm now free to do the game make! (sees diablo 4) Hmmmmmmm...... I'm not free!

3d Yandere RPG maker game by labylin

Forum statistics

Threads
131,773
Messages
1,223,230
Members
173,542
Latest member
talarki
Top