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.)
Enemy with actor name
RPG Maker MV SupportPut the following code in a plugin:
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.
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.
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.
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.
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.
I recopied it and found that it works now. Thanks!
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.
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.
Original thread: https://forums.rpgmakerweb.com/threads/enemy-with-actor-name.123163/