Hi, guy, I try to make a game with 649 pokemons, $game_variables[41] contain a number each 1....649.
and I make $game_variables[32]="$$game_variables[41]" because the pokemon filename is $xxx (ex : $001, $382, $151)
when I make hero.set_graphic($game_variables[32], 0, "Evil", 2) it's doesn't work ('cause the variable 32 don't contain what I want and IDK how to store in $game_variables32 : "$xxx"
I need these " 'cus if I make hero.set_graphic($202, 0, "Evil", 2) ($202 is a example) it's doesn't work too.
I spend 4 hours in that but I'm not really good in english.
So, I just want to know how to store in $game_variables[32] that > "$$game_variables[41]"
Thank's for answer.
change character with variable problem
● ARCHIVED · READ-ONLY
-
-
the problem here is a wrong use of the quotes.
Quotes are used to mark textstrings in programming, and filenames need to be textstrings - but variables are not textstrings.
"$202" is a filename, but $202 is (depending on the language) either a number or a variable name (with an undefined and content-less variable
"$"+$game_variables[32] should convert a number inside the game variable into part of a string, but without leading zeroes. So if the variable 32 would contain the number 33, the result would be "$33".
To get the leading zero (like "$033") will either require formatting commands or if-sequences that add one zero for values between 10 and 99 and two zeroes for values between 0 and 9. -
okay, I know when variable are in string there not convert to value, and I used for "$33" > "$033" : $game_variables[41]=0$game_variables[32]
So idk if it's work, cause when I use
test="$"+$game_variables[41]
hero.set_graphic(test, 0, "Evil", 2)
he say test = undefined.
I'm very bad in ruby x).
EDIT1 : this night I search how to store text in variable and I say here (with edit) if I find how to do that.
EDIT2 : I use :
lep="$"+$game_variables[32] (I PUT IN 32 : 182, so no need to add any zeroes)
hero.set_graphic(lep, 0, "Evil", 2)
He say : can't convert fixnum into string "Game_Interpreter" line 1411 (the line where is put eval(script))
Any clue for that ? IDK what that.
Full code :
lep="$"+$game_variables[32]
$game_variables[1]=$game_actors[6,true]
$game_party.add_actor($game_variables[1])
hero = $game_actors[$game_variables[1]]
hero.set_graphic(lep, 0, "Evil", 2)
$game_player.refresh -
that means that the conversion is not automatic, you'll need the command to convert the variable content into a string. Sorry, I don't know that - it's different depending on language
-
okay, thank's for help for the strings, but the problem is the "$" too, 'cuz when we use $$game_variables[32] isn't say result, x)
EDIT : In rpg maker vx ace, for write message, we use on message \V[31] for variable, I think in string we use \V[x] for show var, I go test that and say result. Okay it's not work xD
EDIT2 : Okay, today I finded how to put a variable in string, but when I use $game_variables[41]="$"+$game_variables[32] he say he can't convert fixnum into string, how I can put this "$" in my variable ? and for variable result have string, we use that : $game_variables[41].to_s
SOLUTION FINDED ! :
I used $game_variables[41]="$"+$game_variables[32]... but I'm very stupid.
We must use $game_variables[41]="$"+$game_variables[32].to_s
for result "$"+"(number)"
and finally use in the end :
hero.set_graphic($game_variables[41].to_s, 0, "Evil", 2)
Okay here my full code, it's work, for put var in string it's .to_s =D thx for helped me.
$game_variables[41] =
"$" +
$game_variables[32].to_s
$game_variables[1]=$game_actors[6,true]
$game_party.add_actor($game_variables[1])
hero = $game_actors[$game_variables[1]]
hero.set_graphic($game_variables[41].to_s, 0, "Evil", 2)
$game_player.refresh
# ID = Actor Index
# character_index = Starts from 0 (Top Left), 1, 2, ...
# faceset_index = Starts from 0 (Top Left), 1, 2, ...
SceneManager.call(Scene_Name)
SceneManager.scene.prepare($game_variables[1], 16)