RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[Resolved]Storing a player's name in a variable?

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 82
The crazy, scissors-wielding demoness
Hey, I'm trying to figure out how I can store a character's name (once the player enters it) into a variable...then apply that variable name to a different character.

Basically, for my game I have a couple of different classes. But the way I have to do it is each class gets a character, so as not to eff up the levels and such.

Problem is, though, that their names will never be the same as the original character. Due to the player having the ability to enter any name they want for the original. >_<

Can anyone help me out? (If this belongs in scripting,put it there =D)
« Last Edit: December 29, 2010, 06:00:35 PM by meiko_suzuki »
Game in the works:
The Adventures of the Generic Hero(ine)
Gameplay: 20%
Mapping: 10%
Characters: 80%
Events: 30%
Ways to Die: 30%
Cliches: 65/192
?? ??
PROFIT!

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
Use the event "Call Script", and use:

Code: [Select]
$game_variables[x] = $game_actors[y].name

X is the variable which you want to store the actors name. Y is the place that the actor is stored in the database, which can be found to the right of the characters name in the actors sidebar.

**
Rep:
Level 82
The crazy, scissors-wielding demoness
._.' When I try to apply it in game, I get a NoMethodError...undefined method 'name' for [1]:Array

This is what I put in the script:
$game_variables[8] = $game_actors[001].name

...scripting newb is n00b? XD

And if you can help me figure out how to apply that variable to the other characters I will love you for life XD
« Last Edit: December 29, 2010, 04:54:59 PM by meiko_suzuki »
Game in the works:
The Adventures of the Generic Hero(ine)
Gameplay: 20%
Mapping: 10%
Characters: 80%
Events: 30%
Ways to Die: 30%
Cliches: 65/192
?? ??
PROFIT!

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
It has to be all on one line. Also, don't bother with the 0s before the 1

Anyway do it like this:
Code: [Select]
a = $game_actors[1]
$game_variables[8] = a.name

I recommend that you clear it back to 0 once you are done with it, as otherwise you will get errors if you try to operate on it accidentally.

**
Rep:
Level 82
The crazy, scissors-wielding demoness
Ah, I got it. So, let's say I wanted Actor 10 to have the same name as Actor 1. How would I go about that?  :D

Thanks for your patience XD
Game in the works:
The Adventures of the Generic Hero(ine)
Gameplay: 20%
Mapping: 10%
Characters: 80%
Events: 30%
Ways to Die: 30%
Cliches: 65/192
?? ??
PROFIT!

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Code: [Select]
a1 = $game_actors[1].name
$game_actors[10].name = a1

**
Rep:
Level 82
The crazy, scissors-wielding demoness
THANK YOU SO MUCH! <3 <3 <3

You, good sir, win the internet.
Game in the works:
The Adventures of the Generic Hero(ine)
Gameplay: 20%
Mapping: 10%
Characters: 80%
Events: 30%
Ways to Die: 30%
Cliches: 65/192
?? ??
PROFIT!

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
(...) Also, don't bother with the 0s before the 1 (...)

Lemme elaborate a bit on this because there is a functional difference in that having any leading 0s causes the number to be parsed with base 8 rather than base 10. I.e.

01 == 1
07 == 7
08 and 09 gives an error
010 == 8
011 == 9
012 == 10
...

*hugs*