-
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)
-
Use the event "Call Script", and use:
$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.
-
._.' 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
-
It has to be all on one line. Also, don't bother with the 0s before the 1
Anyway do it like this:
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.
-
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
-
a1 = $game_actors[1].name
$game_actors[10].name = a1
-
THANK YOU SO MUCH! <3 <3 <3
You, good sir, win the internet.
-
(...) 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*