Notice: fwrite(): Write of 8192 bytes failed with errno=28 No space left on device in /home/rmrk/domains/rmrk.net/public_html/Sources/Cache/APIs/FileBased.php on line 96
Print Page - [RMXP] Duplicate player-inputted name across multiple actors[SOLVED]

The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: Michus on September 06, 2012, 05:38:07 PM

Title: [RMXP] Duplicate player-inputted name across multiple actors[SOLVED]
Post by: Michus on September 06, 2012, 05:38:07 PM
I have a situation where the player gets to choose between two different actors at the beginning of the game ID9 and ID14.  Shortly afterwards the player uses name input processing to decide the name for whichever actor they chose, either 9 or 14.

If the player chooses actor 9 and names it 'Martin' I need a script that will then rename ID14 to 'Martin' or 'Martin's Evil Twin'

If someone can tell me how to find '$actor_id_variable' or whatever it's called then I could probably write the rest of it myself.  I tried looking in Game_actor in the script editor but couldn't figure out what I needed.

Thank you.
Title: Re: [RMXP] Duplicate player-inputted name across multiple actors
Post by: pacdiggity on September 06, 2012, 09:11:09 PM
$game_actors[14].name = $game_actors[9].name + "'s Evil Twin"
Would work for VX and Ace, not sure about XP. I bet it would be very similar.
Title: Re: [RMXP] Duplicate player-inputted name across multiple actors
Post by: Michus on September 06, 2012, 11:50:08 PM
Unfortunately that gives me an error:

"NoMethodError occured while running the script.

undefined method 'name' for [14]:Array"

All I'm using for the script is:

"$game_actors[9].name = $game_actors[14].name"

with the inverse:

$game_actors[14].name = $game_actors[9].name

for when the other situation is true.
Title: Re: [RMXP] Duplicate player-inputted name across multiple actors
Post by: modern algebra on September 07, 2012, 02:10:25 AM
It's probably because the expression doesn't fit on one line. Change it to:


$game_actors[14].name =
  $game_actors[9].name


and it should probably be fine.
Title: Re: [RMXP] Duplicate player-inputted name across multiple actors
Post by: pacdiggity on September 07, 2012, 07:55:34 AM
That's a script call too, so call it from the 'Script' command in the event editor when actor 9 is named. Do not put it in the script editor.
Title: Re: [RMXP] Duplicate player-inputted name across multiple actors
Post by: Michus on September 11, 2012, 03:28:41 AM
Thank you both,

The issue was that the script needed two lines, I didn't understand that the script command split lines like that.

It works 100% now, I am super thrilled.