Script command (call) for changing the name of any current party members

Greetings:

I'm new with JS script commands; a day ago I tried to learn how to find the regionID and current player location via a script command. The following forum suggested a simple one line script call that does the job: https://forums.rpgmakerweb.com/index.php?threads/no-check-location-region-id-script-calls.46841/

My interest is to ask if there is a similar way to use script calls in an event (with a "show choices" clause perhaps), but now for getting any of the current 4 party members, and being able in the same fashion to re-assign their name.

I've being looking for a while at the net, and there seems to be not much information about this. Thanks a lot in advanced for the suggestions and help 🙂
Code:
$gameParty.members()[index]._name = "new name here"
Amazing! Thanks a lot for the reply Trihan! 😀

$gameParty.members()[index]._name = "new name here"

Could you please tell me how can I call the "input name screen" so the name can now entered "in-game" instead of "hard-coded"?

Thanks for the help 🙂
....
I don't understand, what you are asking is already in event command. You don't need a script call.
This is to change actor name directly.
1593322174491.png

This is to change actor name in-game via name input processing.
1593322253801.png
I can't speak for the original poster, but for much of what is provided by event commands, you need to specify which actor. You can't do it by an actor id held in a variable, or by current position in the party. With script calls you can use something like "$gameVariables.value(4)" for "index" instead of a constant:

$gameParty.members()[$gameVariables.value(4)]._name = "new name here".

[Other variables are available; you don't have to always use variable 4.]
Greetings Kuro:

The reason I'm asking for a script call instead of the event command, is that I wish to do it in a dynamic fashion for the current party members (and not just the direct starting four). If the player changes his party members in the development of the game (quite likely for the game I'm designing), then the conditional branches that need to be done each time the player wants to change the actors name would be quite tedious (you'll need to do all the possible actors combinations and I don't see it code-wise efficient imo).

The script call Trihan delivered quite much does the job: I just need to connect it to the input name screen.
Code:
SceneManager.push(Scene_Name);
SceneManager.prepareNextScene($gameParty.members()[index]._actorId, 8);

Where index is the party index you want to change the name of, and 8 is the max length for the name input screen.
Hello Piyan 🙂

for much of what is provided by event commands, you need to specify which actor. You can't do it by an actor id held in a variable, or by current position in the party. With script calls you can use something like "$gameVariables.value(4)" for "index" instead of a constant:

Yes! My precise point!
Code:
SceneManager.push(Scene_Name);
SceneManager.prepareNextScene($gameParty.members()[index]._actorId, 8);

This is exactly what I needed! My deepest gratitude Trihan 😀
No worries! Glad to be of assistance.
Hello there:

It took me a while to test this thing again (was suddenly focused in other features of the game n.n). The thing is that I've tested the suggestion in the next scenario:

+ A NPC dedicated for name changing which, triggers a local event.
+ A MessangeBox which shows four options for namechanging any of the current party members:

* Show choices: \P[1], \P[2], \P[3], \P[4]
* When: \P[1]
* Script: SceneManager.push(Scene_Name);
: SceneManager.prepareNextScene($gameParty.members()[1]._actorId, 8);

And I get the next error: Unable to get property '_actorId' of undefined or null fererence.

Any ideas what's happening? (or better yet, howto fix it)

p.s. please forgive my delay in testing this n.n"
Hello there:

It took me a while to test this thing again (was suddenly focused in other features of the game n.n). The thing is that I've tested the suggestion in the next scenario:

+ A NPC dedicated for name changing which, triggers a local event.
+ A MessangeBox which shows four options for namechanging any of the current party members:

* Show choices: \P[1], \P[2], \P[3], \P[4]
* When: \P[1]
* Script: SceneManager.push(Scene_Name);
: SceneManager.prepareNextScene($gameParty.members()[1]._actorId, 8);

And I get the next error: Unable to get property '_actorId' of undefined or null fererence.

Any ideas what's happening? (or better yet, howto fix it)

p.s. please forgive my delay in testing this n.n"

How many people are in the party when you try this? 1 is the ID of the *second* member.
How many people are in the party when you try this? 1 is the ID of the *second* member.


Such a dumb error: thanks as always dear Trihan (please forgive if I'm giving myself too much confidence with you, but I do appreciate your help 🙂 )

The "change your name" screen now appears without problem. My issue now is that I cannot delete any input chars (once they are selected, there is no way back); any ideas?
Does esc not remove the last character?
Yes! It does! This newbie status is overwhelming... thanks for the patience Trihan 😀
Yes! It does! This newbie status is overwhelming... thanks for the patience Trihan 😀

Any time buddy, we all had to start somewhere. 🙂 I'm always happy to help, so if you have any other questions don't hesitate to ask!

Original thread: https://forums.rpgmakerweb.com/threads/script-command-call-for-changing-the-name-of-any-current-party-members.123375/