MZ How to input name for spells?

Hello everyone

So I created a game design where players can create their own magic and they get to name it.
I was thinking of making the naming system like the name input one through eventing and make the spell name equal to the name the player inputted.

But I don't know how to do that as it only change the actor name and not the magic name.

Is this possible with just using the script command through events, or does it require a plugin?
If it's possible to do that through eventing, please tell me what to do

Thank you
Without using a script, you can achieve this using the "blank actor" technique.

The way this works is by setting an actor in the database, don't give him a name (leave it blank).

Then, wherever you need the user to enter a name for anything (for example a magic spell), use the Set Name command and select the blank actor ID and the maximum number of characters.

Right after that, you want to do :
♦ Control Variables #0001 = $gameActors.actor(ID).name()
Replace ID with the actual ID of the blank actor.
Use the script part of the control variable and enter : $gameActors.actor(ID).name()

The name is now saved in the variable for you to use where needed.
Without using a script, you can achieve this using the "blank actor" technique.

The way this works is by setting an actor in the database, don't give him a name (leave it blank).

Then, wherever you need the user to enter a name for anything (for example a magic spell), use the Set Name command and select the blank actor ID and the maximum number of characters.

Right after that, you want to do :
♦ Control Variables #0001 = $gameActors.actor(ID).name()
Replace ID with the actual ID of the blank actor.
Use the script part of the control variable and enter : $gameActors.actor(ID).name()

The name is now saved in the variable for you to use where needed.

Alright, so I did this, and it mostly works (it shows the spell name when casting it in battle) but it doesn't show the name in the skill menu.

This is the event that triggers the spell naming input. I used Actor ID 10 as the blank Actor
1722937953875.png


Here's what's shown in the Skill Menu in-game:
1722937857917.png



Here's what I did in the Skills > Database:
1722937760187.png


Here's a video to see how it works so far:
skills by default won't with escape character in the help description.
in MV there is a function and I know TSR made it possible to use it everywhere.
as I think, Eliaquim made one for MV and MZ, to use escape characters.

if I'm correct, it would be global escape characters plugin of his (require his core).
so try that one and it should work.
Alright, so I did this, and it mostly works (it shows the spell name when casting it in battle) but it doesn't show the name in the skill menu.

This is the event that triggers the spell naming input. I used Actor ID 10 as the blank Actor
View attachment 313846

Here's what's shown in the Skill Menu in-game:
View attachment 313845


Here's what I did in the Skills > Database:
View attachment 313844

Here's a video to see how it works so far:

You can use a script call to dynamically set your skill name using this line :
JavaScript:
$dataSkills[ID].name = $gameVariables.value(ID);

Spoiler: Method 1 (With Variables)
Replace the ID from dataSkill with the ID you are trying to edit, same for the variable ID you want to use.
So for your example, instead of using the Change Skill command, you can use the script call command and place :
$dataSkills[11].name = $gameVariables.value(1);
$dataSkills[12].name = $gameVariables.value(2);
$dataSkills[13].name = $gameVariables.value(3);

So your event would look like this :
Code:
♦ When 1
  ♦ Name Input Processing
  ♦ Control Variables #0001 = $gameActors.actor(10).name()
  ♦ Script : $dataSkills[11].name = $gameVariables.value(1);
♦ When 2
  ♦ Name Input Processing
  ♦ Control Variables #0002 = $gameActors.actor(10).name()
  ♦ Script : $dataSkills[12].name = $gameVariables.value(2);
♦ When 3
  ♦ Name Input Processing
  ♦ Control Variables #0003 = $gameActors.actor(10).name()
  ♦ Script : $dataSkills[13].name = $gameVariables.value(3);
♦ End

Spoiler: Method 2 (Combined method)
If you chose the path of the script, you can combine the two methods into one and use :
$dataSkills[11].name = $gameActors.actor(10).name()
$dataSkills[12].name = $gameActors.actor(10).name()
$dataSkills[13].name = $gameActors.actor(10).name()
Bypassing the need for variables all togheter.

So your event would look like this :
Code:
♦ When 1
  ♦ Name Input Processing
  ♦ Script : $dataSkills[11].name = $gameActors.actor(10).name()
♦ When 2
  ♦ Name Input Processing
  ♦ Script : $dataSkills[12].name = $gameActors.actor(10).name()
♦ When 3
  ♦ Name Input Processing
  ♦ Script : $dataSkills[13].name = $gameActors.actor(10).name()
♦ End

If you need the names for text confirmation, since you don't want scripting so much, I would go for the version with the variables, that way you can use the variable that stores the name wherever you want.

Spoiler: bonus
Alternatively, you can script a text message using : $gameMessage.add("text here")
So you can do this :
JavaScript:
let v = $dataSkills[11].name;
$gameMessage.add(`Your text message show the skill name ${v}!`);
Again, bypassing the need for variables.


If you are not confident with one of these methods, a plugin would be needed.
@ShadowDragon Hmmm, I thought you were TSR(the shadow dragon). But it appears not?
You can use a script call to dynamically set your skill name using this line :
JavaScript:
$dataSkills[ID].name = $gameVariables.value(ID);
that works, but its only short term. when you change properties of data objects like that, changes arent kept when the game is restarted, and are also kept when you switch files without restarting iirc. if the goal was to rename something that is only seen in a controlled environment then its good, but youd have to do extra to have it work with something as commonly seen in as many places as a skill name.

@gtoff
if the escape code approach doesnt lead anywhere, setting the name during runtime could work a little better if you attach a common event to loading the game that sets the name from that variable
Hmmm, I thought you were TSR(the shadow dragon). But it appears not?
TSR is a friend on the forum, mine is SDJB ( ShadowDragonJB ) ^^
I'm not sure where TSR stand for, but he is The Northern Frog or The Frog from the North ^^
that's what he said or said in plugins he made, he is much more knowledgeable in JS.
I haven't fully tested this but try this as a plugin:
JavaScript:
Window_Base.prototype.drawItemName = function(item, x, y, width) {
    if (item) {
        const iconY = y + (this.lineHeight() - ImageManager.iconHeight) / 2;
        const textMargin = ImageManager.iconWidth + 4;
        const itemWidth = Math.max(0, width - textMargin);
        this.resetTextColor();
        this.drawIcon(item.iconIndex, x, iconY);
        let name;
        if (item.meta.name) {
            name = $gameActors.actor(Number(item.meta.name)).name();
        }
        this.drawText(name || item.name, x + textMargin, y, itemWidth);
    }
};
Edit: changed a few things around since some of the code wasn't needed.

Then, in your skills note box, type in <name: 11> to specify that you want the name of actor 11. Make sure the skill is available to use. Go ahead and type in a default name for the skill as well.

When you change actor 11's name (or whomever you designate in the note tag), it should reference that data for all your windows.

I am not sure if there are other references that are left out but do be prepared for that. Possibly the Battlelog window or some things in the BattleManager.

If the changes dont appear in some of those areas, you can make the reference to it with the notetag and it should work as well or directly use the actor's name that you used to set the new name.

Hope this helps!
that works, but its only short term. when you change properties of data objects like that, changes arent kept when the game is restarted, and are also kept when you switch files without restarting iirc. if the goal was to rename something that is only seen in a controlled environment then its good, but youd have to do extra to have it work with something as commonly seen in as many places as a skill name.

@gtoff
if the escape code approach doesnt lead anywhere, setting the name during runtime could work a little better if you attach a common event to loading the game that sets the name from that variable
Although dataSkills is not persistent on game load, variables are.
Easy work around would be to have a common event run at game start and check if the variables have default value or not, if not : apply name change.

Though at this point, a plugin would be a cleaner approach I guess.
I'll try and make one that combines everything I mentionned with persistent data if OP wants 🙂
Wow, thank you for all the replies! (Sorry for replying so long as I was outside)

skills by default won't with escape character in the help description.
in MV there is a function and I know TSR made it possible to use it everywhere.
as I think, Eliaquim made one for MV and MZ, to use escape characters.
I tried that plugin but unfortunately it doesn't work on Skills List (yet) ;_;

that works, but its only short term. when you change properties of data objects like that, changes arent kept when the game is restarted, and are also kept when you switch files without restarting iirc. if the goal was to rename something that is only seen in a controlled environment then its good, but youd have to do extra to have it work with something as commonly seen in as many places as a skill name.

@gtoff
if the escape code approach doesnt lead anywhere, setting the name during runtime could work a little better if you attach a common event to loading the game that sets the name from that variable
Yeah I tried this one too, at first it works fine but when I exited the game and load it again, it returns back to displaying '\V[1]'
Using paralel common event works to revert the names back

I haven't fully tested this but try this as a plugin:
JavaScript:
Window_Base.prototype.drawItemName = function(item, x, y, width) {
if (item) {
const iconY = y + (this.lineHeight() - ImageManager.iconHeight) / 2;
const textMargin = ImageManager.iconWidth + 4;
const itemWidth = Math.max(0, width - textMargin);
this.resetTextColor();
this.drawIcon(item.iconIndex, x, iconY);
let name;
if (item.meta.name) {
name = $gameActors.actor(Number(item.meta.name)).name();
}
this.drawText(name || item.name, x + textMargin, y, itemWidth);
}
};
Edit: changed a few things around since some of the code wasn't needed.

Then, in your skills note box, type in <name: 11> to specify that you want the name of actor 11. Make sure the skill is available to use. Go ahead and type in a default name for the skill as well.

When you change actor 11's name (or whomever you designate in the note tag), it should reference that data for all your windows. I am not sure if there are other references that are left out but do be prepared for that. Hope this helps!
This plugin works perfectly! Haven't found any issues so far, hope it continue to work 😤
I'll use the plugin then, how should I credit you? Do you have any terms of use? Feel free to tell me 👍

So in summary, there are two solutions:
1. Using Script commands, eventing, and reverting the names with paralel common event (full steps by @Artille )
2. Use the code @bass2yang sent as a plugin and use the note box in the Skills list in Database (may need a lot of blank Actors depending on needs)

Thank you so much for the help everyone!
I made a plugin, but didn't work, but I fix that, but for now it only
applies to item, weapons, armor, and I can add skill.

as it seems to work at this moment to save the data in the savefile.
problem for items is that if you change data item 1 (weapon or armors)
it applies to all.

for skills is only 1, so you could use it to change dataSkills[x].name() == "name"
and change icons too, so it will be covered by that bit.

I'm happy to send you the plugin, but it handles thing from my base,
you can see if it works, once I fix it entirely, it become public again.
Wow, thank you for all the replies! (Sorry for replying so long as I was outside)


I tried that plugin but unfortunately it doesn't work on Skills List (yet) ;_;


Yeah I tried this one too, at first it works fine but when I exited the game and load it again, it returns back to displaying '\V[1]'
Using paralel common event works to revert the names back


This plugin works perfectly! Haven't found any issues so far, hope it continue to work 😤
I'll use the plugin then, how should I credit you? Do you have any terms of use? Feel free to tell me 👍

So in summary, there are two solutions:
1. Using Script commands, eventing, and reverting the names with paralel common event (full steps by @Artille )
2. Use the code @bass2yang sent as a plugin and use the note box in the Skills list in Database (may need a lot of blank Actors depending on needs)

Thank you so much for the help everyone!
No credit needed.

To continue using the default name input processing command to add names, you could use a blank actor to temporarily hold a name, push that information to a $gameVariables or to a $gameSystem property (which will be saved when you save the game) that holds an array of names and reference from it there to coincide with the skill IDs.

I'd have to think through this one a bit but that would save you from having to create multiple actors just to reference it to the skill name.

Currently, it would be easier to separate them by actor and skill so you have a better visual database without needing that much more code.
I made a plugin, but didn't work, but I fix that, but for now it only
applies to item, weapons, armor, and I can add skill.

as it seems to work at this moment to save the data in the savefile.
problem for items is that if you change data item 1 (weapon or armors)
it applies to all.

for skills is only 1, so you could use it to change dataSkills[x].name() == "name"
and change icons too, so it will be covered by that bit.

I'm happy to send you the plugin, but it handles thing from my base,
you can see if it works, once I fix it entirely, it become public again.
Sure, I think the ability to rename items would be cool as well, if there's a plugin that can rename weapons, items, and skills included, it would be awesome 😀
if there's a plugin that can rename weapons, items, and skills included, it would be awesome
weapons and items are the easy ones. Yanfly's item core changes how items work when the independent items option is enabled, and that lets you fully change the items however you want from their independent $data objects (the plugin makes changes to those persistent too). its just that there isnt an alternative for skills.

without that plugin it gets tricky though. all items with the same ID by default share the same data object, so a change to one changes them all and youd still need to either use an event or a plugin like the one provided by bass2yang to either set the name after a load or to make windows refer to the item by another name
I see now you use MZ, so it might not exactly work, but I cannot test it on MZ.
but it works in MV, but items that share the same itemID like Robro will be
across the sameID, change too.

but there is no easy fix as obtaining a clone of the item id = 1 which can be
done, but target the item with shared ID would be harder.

it's only ideal if the item can be obtained only once, not anymore further.
but there isn't a really a good way to rename an item that share the same name,
other than prefix/suffixes for MV by DreamX I believe or DoubleX one of the 2.

but not sure if any for MZ exist for it.
I see now you use MZ
i completely missed that.
as an alternative, DungeonMind has a plugin for the functionality. whether it works 1:1 like yanfly's, i dont know, but the idea should be the same

Original thread: https://forums.rpgmakerweb.com/threads/how-to-input-name-for-spells.170897/