Main Menu

$PLAYER_1 type variable for player names to use in message text?

Started by mortexic, May 18, 2008, 06:10:35 PM

0 Members and 1 Guest are viewing this topic.

mortexic

The game im working on allows custom player names. Is there a way to use something like "Hello There $PLAYER1" in message text to auto-insert players names?

DeathLock~

If the RMVX has the same code as RMXP.

Posted wrong code, go lower for the correct one.



DeathLock~

Sorry about that.

Its suppose to be \n[X]. XD

Use \n[X], X = Actor ID in the database.

So, in the event you use that code for the name, and in the game it will show the name of the player.

Example:
\n[0] shows the name of the first member of the party.
\n[1] shows the name of the first actor in the database.


mortexic

The syntax is correct now, but I get a windows error popup window anytime the event is invoked.  :-\

The error is "Script 'Window_Message' line 218: NoMethodError occured. undefined method 'name' for nil:nilclass"

I tried with different combinations of numbers of players in party and all that. No luck.

Thoughts?

DeathLock~



mortexic


DeathLock~

Don't know, maybe you should copy all the data from your project into a new project.


Tsunokiette

Actually, it's the default script's fault. It doesn't include an option to use the 0.

To fix it, go to line 218 in Window_Message and replace it with the following -

    @text.gsub!(/\\N\[([0-9]+)\]/i) { if $1.to_i == 0
                                        $game_party.members[$1.to_i].name
                                      else
                                        $game_actors[$1.to_i].name
                                      end }
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They're bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I'm the only one, I'm the only one."