Best way to change actor nicknames dynamically?

Hello,

Basic overview of what we're trying to do here: We want to implement a sort of basic job system in our game, where becoming a certain job gives the party member in question various little adjustments on top of their main class. We're not using entirely new classes here because that's far too drastic; we just want things like "If you're a Farmhand then you have 5% more strength and can equip Axes," "If you're a Florist you're slightly stronger against water, weaker against fire, and immune to the poison status," etc. applied on top of the default character classes.

We've accomplished this through making passive states in the VisuStella Skills and States Core, then creating a new armor type (we call them "Merits") filled with little trinkets whose sole purpose is to apply those states. (For example, equip the "Farmhand's Gloves" in the Merit slot and they give you the "Farmhand" state so long as you have them on, which in turn gives all the aforementioned effects.) This is basically working fine and we're like 95% done implementing this system.

The one last thing we want to do, which is proving surprisingly elusive after getting basically everything else ironed out, is to give a visual written indicator in the main menu. What we want to do is take the otherwise completely unused Nicknames field for each actor and use that to store the current job. That way, we could tinker around with VS Main Menu Core's JS settings to display each actor's Nickname instead of Class (already done,) and the Nickname could be whatever job they're currently holding based on the equipped Merit/induced passive state. That way, the player could get a nice visual reference of everyone's current jobs in the main menu.

Spoiler: It should look something like this....
jobs.png

That's a mock-up. Currently, the status icons (the red cape for Red, the Captain America shield for Augustus, etc.) are tied to the passive states the way the actual effects are, and each party member has that status because they have the appropriate Merit currently equipped and thus are currently that job. In other words, those are working perfectly. The actual nicknames are what I want this to look like, eventually, but for now I just manually hard-set everyone's nicknames to the exact values seen here in the database settings just to get the screenshot. It's a visual aid for what I want to do, but right now we have no idea how to do that and that's where we're currently stuck.

In theory, since the jobs themselves are being handled through equipment which then triggers a passive state, there should be plenty of room to insert either a plugin-supported notetag or just a simple JS command (for the "run the following script" type notetags) or perhaps a call to a common event or... something, somewhere in the chain, either in the Merits or in the states themselves. In practice, we haven't found what to put where that seems to work or change or really do anything at all, let alone with the correct target (i.e. "change the nickname of whoever is equipping this/whoever has this state" rather than just a hard-coded "change actor 1's nickname" even if actor 4 was the one who triggered it.) What would be the best way to handle this, do you think?

Thank you so much for your help!!

(Also, completely unrelated to anything, but yes, I see all that blank space on the right side of each party member's bar and that bothers me too. Any ideas for some kind of useful info we could put there would be much appreciated. 😅)
One thing you can do is use the VE ControlText Script
to add an icon to their name. The icon will be in every instance of their name, however.
If you supply the code you're using for the menu to display the nickname, someone should be able to tell you how to modify it.
you're probably overthinking it, and maybe doing it backwards.
what you want can be driven by the class system, and IT would provide the titles, the stats and the buffs.

this can be modeled with by-the-book systems design, before even looking at any code!
you just have to know how to put it into words and describe it.
what you want can be driven by the class system, and IT would provide the titles, the stats and the buffs.
From reading the OP, the title is not driven by the class. It's from an item they're equipping to show a specialization.

So I don't think your suggestion would work unless they add additional plugins and redo the system to accommodate a subclass then draw from that.
@ATT_Turan can still work, if the class itself will go look for that item.
my point being, the window shows the text based on the class that is passed to it.
either way, you gonna need a script to at least redirect the label, so might as well make the class properly.

instead of *having the class* and then *adding the label on top*, properly *make the class to read the item and return the label*, which you then send to the window to display.
@gstv87 I...am not sure that we're all talking about the same thing.

Regardless, if the OP provides code, assistance can be rendered in some fashion.
The code for the main menu to display the nickname? Let's see...

That comes from VisuStella Main Menu Core, which has a plugin parameter at the bottom wherein one can tinker with the raw JS to play around with everything about what gets drawn where. This is from the block of code for each actor's name and other misc. stats, which, by default, looks like this:

Code:
// Draw Status Stuff
const sx = rect.x + 180;
const sy = rect.y + rect.height / 2 - this.lineHeight() * 1.5;
const lineHeight = this.lineHeight();
const sx2 = sx + 180;
this.drawActorName(actor, sx, sy);
this.drawActorLevel(actor, sx, sy + lineHeight * 1);
this.drawActorIcons(actor, sx, sy + lineHeight * 2);
this.drawActorClass(actor, sx2, sy);

Getting it to display the actors' nicknames instead was a simple matter of changing the "this.drawActorClass(actor, sx2, sy);" line to "this.drawActorNickname(actor, sx2, sy);" instead. That's why we were looking for a way to change the actors' nicknames; this just returns that value, so something that changed the nickname to "Traveler" or "Sentry" or whatever further upstream would ensure this always works. I... suppose it would be possible to forego that, declare an entirely new const value of some sort, do a bunch of "if the actor.HasXMeritEquipped, actor.job = Y" stuff, and have it draw that instead? That feels a bit complex, but, I mean, I'd already resigned myself to the possibility of whatever theoretical code you'd put in the equipment or state to change the nickname in the first place being just as involved anyway.

Regarding @gstv87 's suggestion to just use classes: Yes, we could do that, and it'd make the issue of displaying the names a lot easier (we could just go back to this.drawActorClass like it already was from the beginning.) The reason we're using a separate system isn't because we're particularly married to the idea of using the equipment or states (all of those were devised as workarounds to get this far more than anything else, to be honest,) but rather that Classes in RPG Maker feel too powerful, with too much tied to them, and changing them would be too much.

If you look at our party, you have the archetypal roles--Red is the DPS swordswoman, faster but more frail, Augstus is the big tank, Holly is a healer, Kit is a mage--and we intended for those to be fairly stable. You're not supposed to be able to just put a wizard hat on Augustus and expect him to instantly have more MP and better M. Attack than Kit. These are small to medium tweaks that go on top of the party's basic build--for example, Kit as a Sentry is still Kit, just with an extra +10% defense, -10% ability, +25% aggro, and they can equip heavy armor and shields. I could be wrong (it's very possible I'm wrong! I'd love to hear if I'm wrong, in fact 😅) but it felt like trying to handle that in the Class system was just too much overkill. There's no way to tie basic stat growth curves, how much HP and Atk and Def and etc. everyone has at what levels, to the actors themselves; what makes Kit Kit in the first place is the whatever nameless "Kit" class we made and assigned to them. Therefore, Sentry!Kit would look very different from Sentry!Augustus, and making like... what, four versions of each class, per job? feels a bit silly.

Again, that's the only thing that held us back, though. It's not that we especially need to have this tied to the ability to equip Merits; that whole thing was devised just because we weren't sure how else to apply job states in a way that the player could change at any time from the menu as easily as equipping something. Honestly, if anything, Merits feel a little sloppy to me just because you have to have, I don't know, four or five of them? per job, just so there's enough for everyone without having an empty spot in the list if they're all equipped. It works but it feels kind of tacky.

Our first attempt at this idea was using the Traits feature from VS Elements and Status Core, and I'd still prefer to do something with that if possible (if only because it has a built-in pretty-looking display screen in the status menu and because literally what else are we doing with that entire feature at this point?) We were stopped by a lack of ability for the player to freely change Traits in some kind of equip-equivalent menu scene. We couldn't even find a way to have "if this is equipped, apply that Trait" notetags we could put anywhere in equipment or state note fields. Er... unless there is a way to do that, that we missed?

But... yeah, "the state applies the buffs and debuffs, equipping the Merit applies the state" is nothing more than the neatest-available solution we could think of for this whole overall system, after having to give up on the VS Traits method.


... Oh, and one other thing in the above VS Main Menu drawing code we adjusted, though I'm almost positive it's completely unrelated to this issue, but just, like, for 100% full disclosure:

For reasons I completely do not understand even after attempting to reverse-engineer it, the division by two part in the line "const sy = rect.y + rect.height / 2 - this.lineHeight() * 1.5;" that defines the y values to draw everything somehow makes the names and such appear very slightly taller, which looks hideous because we're using a bitmap font that does not take kindly to being stretched. To get the text to look neater, we had to remove the / 2 from that math and make up for the difference by playing with the number it's multiplied by at the end.

Spoiler: Before and After screenshots
text1.png

const sy = rect.y + rect.height / 2 - this.lineHeight() * 1.5;
Note the stretching on everyone's names and jobs (technically nicknames, is what's being displayed here.)
Also note the red cloak icons for everyone--everyone comes equipped with a Traveler's Cloak (and thus the "Traveler" job) by default, because that's the "no changes, everything is default, no job at all" equivalent state. I just equipped everyone with different Merits to change their jobs in the previous post, but here I didn't. But that just proves what I mean about how the Merits applying the States already works perfectly; it's just the nicknames (which I just hard-coded like that in the Databases -> Actors fields as a "This is what we would want it to look like, if it worked" visual aid) that we're still stuck on.


text2.png

const sy = rect.y + rect.height - this.lineHeight() * 4;
The text is no longer stretched and therefore looks nicer. In exchange, it's not as perfectly centered as before, but I can probably fix that by finding the exact number to add or subtract after that final multiplication there. I have no earthly idea why the division was causing the stretching, and even though I fixed it and thus don't need help troubleshooting it, I have to admit I'm just morbidly curious in hindsight why that happened.

Again, that... I'm pretty sure that's unrelated, but you wanted the code we were using and I didn't want to omit anything, just in case.
Classes in RPG Maker feel too powerful, with too much tied to them
........... well, they're there for just that: holding the information pertaining to the character.

the real flexibility of classes, is that you define them once and can be duplicated across different characters.
you don't need to do that, but they *can* do that.
and, since the GUI already accounts for that, pulling information from the class, instead of modifying the GUI, modify the class! (especially when dealing with items AND states, which is something the GUI has to work twice as much to read, if you're giving it the class, and on top has to pull things from another table)
Okay, but... again, how do you give the characters themselves a core identity, then, in that case? "Kit as a Sentry" is supposed to be about what you'd expect if you take this total nerd wizard kid and put them in armor (still essentially them but maybe a tiny bit slower and beefier.) They're not supposed to change archetypes entirely and become a clone of Augustus (or anyone else) as a Sentry.

The only way I can see to implement that is to make classes for "Kit as a Sentry," "Augustus as a Sentry," "Kit as a Traveler," "Augustus as a Traveler," etc., and that feels... I mean, I'm not going to say it's more convoluted than what we have here, but... I don't know....

(This would be so much easier if the VS Elements and Status Core Traits feature worked. This is literally what that entire feature was made for. We just really need for the player to be able to change traits on the fly from within the menu, with various traits not available at first but unlocking when you talk to the right NPC, etc. and we just couldn't find a way to wrangle that.)
Holy cow. Um. May I suggest a pruning down of the info-dumps? 🤣

For the relatively minor bit of stuff you want done, you have some long essays you're expecting people to read through (note: I did not).

So this is a simple change, just reference the equipment slot for Merits. Let's say they're slot 4 - the slot number is one less than what you see in the Equipment Types list in the Types tab of your database.

Code:
if (actor.equips()[4])
    this.drawText($dataArmors[actor.equips()[4].id].meta.title, sx2, sy);

And on your Merit equipment you'll give them a notetag
<title: Farmhand>
Holy cow. Um. May I suggest a pruning down of the info-dumps? 🤣

For the relatively minor bit of stuff you want done, you have some long essays you're expecting people to read through (note: I did not).
Ah... I'm sorry about that. That's... a problem I have. It's... yeah. I know. I'm bad with that. I try to control it and I usually fail. I'm sorry.

So this is a simple change, just reference the equipment slot for Merits. Let's say they're slot 4 - the slot number is one less than what you see in the Equipment Types list in the Types tab of your database.

Code:
if (actor.equips()[4])
    this.drawText($dataArmors[actor.equips()[4].id].meta.title, sx2, sy);

And on your Merit equipment you'll give them a notetag
<title: Farmhand>
That did the trick. Thank you so much. 🙂
A bit late to the punch, but I threw together this plugin over my coffee this morning. Enables weapons/armours etc to set an actor's nickname, and restore it when unequipped. Even if you don't end up using it, still a good wake-up exercise xD
Oh, wow, that is beautiful! Thank you so much! :yhappy:

If you could by any chance have it so weapons/armor can add/remove those "Traits" from the VisuStella Elements and Status Menu Core, that wouldn't be late to the punch at all; we would drop everything in a heartbeat and remake this entire system using those instead. That's a "just checking/curious" thing and not trying to be picky or anything, though; what you have here is already glorious, especially for a random unexpected gift from nowhere. Heck, even if the previous solution works, this just feels so elegant and exactly what we were asking for that we may just go back and run this one anyway. :LZSjoy:
Okay, but... again, how do you give the characters themselves a core identity, then, in that case? "Kit as a Sentry" is supposed to be about what you'd expect if you take this total nerd wizard kid and put them in armor (still essentially them but maybe a tiny bit slower and beefier.) They're not supposed to change archetypes entirely and become a clone of Augustus (or anyone else) as a Sentry.
Why not just use Subclasses for this? Pretty sure the VS Class Change System uses it, much like the YEP counterpart. You can tie each actor's stat growth to their primary class, while subclasses just add a modifier. Pretty much exactly what you're going for.
Why not just use Subclasses for this? Pretty sure the VS Class Change System uses it, much like the YEP counterpart. You can tie each actor's stat growth to their primary class, while subclasses just add a modifier. Pretty much exactly what you're going for.
An excellent idea, but we don't have VS Class Change. We only have the free cores plus the Wave 4 bundle, and as much as I'd love to have the entire eight waves set (plus some non-bundled ones like the events title screen,) budget is not infinite....
Oh, wow, that is beautiful! Thank you so much! :yhappy:

If you could by any chance have it so weapons/armor can add/remove those "Traits"...
No problem! Glad y'all find it useful~
If I've understood what y'all are after correctly then Trait Groups (which is what the VisuStella plugin is about) are a bit overkill here, I feel. You can probably just use the built-in Traits that equipment can have, and have the nickname change appropriately. Using the earlier Sentry Merit as an example, something like this:
1693535828470.png

(I'm using a VisuStella's Aggro Control System notetag here, just as an example. The VisuStella Item & Equips Core has notetags for extra things items can modify, as does the Elements & Status Core.)
If you need to check if someone has a certain Merit, since it is an equippable item you can just see if they have the right item equipped. Then you can also gate access to new Merits by handing them out to the player as rewards or whatever.
No passive states needed and the one Merit/Job item can apply all the respective stat changes so no need for multiple items for the same job, either.
An excellent idea, but we don't have VS Class Change. We only have the free cores plus the Wave 4 bundle, and as much as I'd love to have the entire eight waves set (plus some non-bundled ones like the events title screen,) budget is not infinite....
Hey, I feel that.
@kjorteo , I'm a little late to the party and uninvited, but I might have a recommendation to help with these kinds of coding/scripting hangups. Using a combination of flow charts and pseudo code can help a lot with organizing what you're doing, and providing a clear plan of action.

For instance:


OUR KNOWNS --
  • We have items that contain data related to a "job" so to speak.
  • When we equip a new item, new job should be updated.
  • Job should have benefits attached to them.
  • current job should be displayed on X page in Y location.
  • removing said item should clear out job title.
From there, you can flow out troublesome points.

OUR ACTION ITEMS --

  • current job should be displayed on X page in Y location
    • Find code that displays x page
      • find code that prints at Y location
        • enable check to dynamically select data
  • We need to dynamically update data.
    • We have items with meta values
      • how do we access meta value?
        • generate script to output meta value as text
    • We need to call the script in the correct location
      • replace code found in rendering X page at Y location.

If you follow this general format, even if you can't solve the problem yourself, it can help guide your requests for assistance greatly -- and dramatically increase your confidence as you do so.

Original thread: https://forums.rpgmakerweb.com/threads/best-way-to-change-actor-nicknames-dynamically.160791/