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

Javo

Villager
Member
Joined
Jun 25, 2020
Messages
19
Reaction score
2
First Language
Spanish
Primarily Uses
RMMV
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 :)
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,358
Reaction score
1,519
First Language
English
Primarily Uses
RMMV
Code:
$gameParty.members()[index]._name = "new name here"
 

Javo

Villager
Member
Joined
Jun 25, 2020
Messages
19
Reaction score
2
First Language
Spanish
Primarily Uses
RMMV
Amazing! Thanks a lot for the reply Trihan! :D

$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 :)
 

Kuro DCupu

Trust me, I'm a veteran RMer
Veteran
Joined
Jul 6, 2014
Messages
449
Reaction score
1,402
First Language
Indonesia
Primarily Uses
RMMV
....
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
 

Piyan Glupak

Veteran
Veteran
Joined
Nov 14, 2016
Messages
64
Reaction score
38
First Language
English
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.]
 

Javo

Villager
Member
Joined
Jun 25, 2020
Messages
19
Reaction score
2
First Language
Spanish
Primarily Uses
RMMV
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.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,358
Reaction score
1,519
First Language
English
Primarily Uses
RMMV
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.
 

Javo

Villager
Member
Joined
Jun 25, 2020
Messages
19
Reaction score
2
First Language
Spanish
Primarily Uses
RMMV
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!
 

Javo

Villager
Member
Joined
Jun 25, 2020
Messages
19
Reaction score
2
First Language
Spanish
Primarily Uses
RMMV
Code:
SceneManager.push(Scene_Name);
SceneManager.prepareNextScene($gameParty.members()[index]._actorId, 8);
This is exactly what I needed! My deepest gratitude Trihan :D
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,358
Reaction score
1,519
First Language
English
Primarily Uses
RMMV
No worries! Glad to be of assistance.
 

Javo

Villager
Member
Joined
Jun 25, 2020
Messages
19
Reaction score
2
First Language
Spanish
Primarily Uses
RMMV
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"
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,358
Reaction score
1,519
First Language
English
Primarily Uses
RMMV
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.
 

Javo

Villager
Member
Joined
Jun 25, 2020
Messages
19
Reaction score
2
First Language
Spanish
Primarily Uses
RMMV
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?
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,358
Reaction score
1,519
First Language
English
Primarily Uses
RMMV
Does esc not remove the last character?
 

Javo

Villager
Member
Joined
Jun 25, 2020
Messages
19
Reaction score
2
First Language
Spanish
Primarily Uses
RMMV
Yes! It does! This newbie status is overwhelming... thanks for the patience Trihan :D
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,358
Reaction score
1,519
First Language
English
Primarily Uses
RMMV
Yes! It does! This newbie status is overwhelming... thanks for the patience Trihan :D
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!
 

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

Latest Threads

Latest Profile Posts

I'm slightly disappointed that the MZ codebase still uses core.js, managers.js, objects.js, scenes.js, sprites.js and windows.js instead of core/Bitmap.js, core/Graphics.js, managers/AudioManager.js, managers/DataManager.js, etc...
just a few more hours until the toughest, most pressure 72 hours of my life, wish me luck guys
Working on some bosses for my game-
His tracks are always so wonderful.

Forum statistics

Threads
100,561
Messages
977,237
Members
132,141
Latest member
Peridot_Programmer
Top