Enemy with actor name

Status
Not open for further replies.

AcousticJamm

AAAAAAAAAAAAAAAAAAAAAAAAA
Veteran
Joined
Jun 1, 2019
Messages
205
Reaction score
30
First Language
English
Primarily Uses
RMMZ
Is it possible to set it so an enemy's name is set to a player actor's name? (I'm planning on making a character you can name a party member that you later fight in battle.)
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
533
Reaction score
235
First Language
English
Primarily Uses
RMMV
Put the following code in a plugin:
JavaScript:
(function() {
    const old_name = Game_Enemy.prototype.originalName;
    Game_Enemy.prototype.originalName = function() {
        var name = old_name.call(this);
        name = Window_Base.prototype.convertEscapeCharacters(name);
        name = name.replace(/\x1b([{}<>.|!$\^]|[A-Z]+)/gi, '');
        return name;
    };
})()
Then you can use some text codes (\V, \N, \P, \G) in the enemy name (only codes that substitute text will work; colour codes or control codes like \$ will not). For your use-case, write \N[4] to set the enemy's name to match that of actor 4.

I haven't tested that code, but I'm using a similar technique for setting a skill name to match an actor's name (for a summon skill), so if it doesn't work it'll just be a minor error that can be easily fixed. Let me know.
 

AcousticJamm

AAAAAAAAAAAAAAAAAAAAAAAAA
Veteran
Joined
Jun 1, 2019
Messages
205
Reaction score
30
First Language
English
Primarily Uses
RMMZ
Put the following code in a plugin:
JavaScript:
(function() {
    const old_name = Game_Enemy.prototype.originalName;
    Game_Enemy.prototype.originalName = function() {
        var name = old_name.call(this);
        name = Window_Base.prototype.convertEscapeCharacters(name);
        name = name.replace(/\x1b([{}<>.|!$\^]|[A-Z]+)/gi, '');
        return name;
    };
})()
Then you can use some text codes (\V, \N, \P, \G) in the enemy name (only codes that substitute text will work; colour codes or control codes like \$ will not). For your use-case, write \N[4] to set the enemy's name to match that of actor 4.

I haven't tested that code, but I'm using a similar technique for setting a skill name to match an actor's name (for a summon skill), so if it doesn't work it'll just be a minor error that can be easily fixed. Let me know.
1592796533499.png
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
did you copy/paste, or did you type it in? oldName is not in the script above.

If you copy/pasted, please generate the error again, then open the Developer Tools (F8), go to the Console tab, and grab a screenshot of that and post.
 

AcousticJamm

AAAAAAAAAAAAAAAAAAAAAAAAA
Veteran
Joined
Jun 1, 2019
Messages
205
Reaction score
30
First Language
English
Primarily Uses
RMMZ
did you copy/paste, or did you type it in? oldName is not in the script above.

I copied it from the email notification I got.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
If you copy/pasted, please generate the error again, then open the Developer Tools (F8), go to the Console tab, and grab a screenshot of that and post.
 

AcousticJamm

AAAAAAAAAAAAAAAAAAAAAAAAA
Veteran
Joined
Jun 1, 2019
Messages
205
Reaction score
30
First Language
English
Primarily Uses
RMMZ
I recopied it and found that it works now. Thanks!
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
533
Reaction score
235
First Language
English
Primarily Uses
RMMV
Yeah, sorry - I spotted that error moments after posting and edited the fix in, but I guess the email notification doesn't pick up the edit.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,867
Reaction score
5,240
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,047
Messages
1,018,539
Members
137,834
Latest member
EverNoir
Top