change character with variable problem

JasonGames

Warper
Member
Joined
Jan 15, 2015
Messages
4
Reaction score
0
First Language
French
Primarily Uses
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.
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
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.
 

JasonGames

Warper
Member
Joined
Jan 15, 2015
Messages
4
Reaction score
0
First Language
French
Primarily Uses
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
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
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
 

JasonGames

Warper
Member
Joined
Jan 15, 2015
Messages
4
Reaction score
0
First Language
French
Primarily Uses
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)
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,074
Members
137,578
Latest member
JamesLightning
Top