Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[SOLVED]"Call Script" question

I'm looking to add a character's armor1_id to a variable. (ie "$game_variables[11] = $game_party.actors[0].armor1_id") but when i try that i get an error. any ideas? :huh:
 
First, this belongs to RGSS support.

Second, your script looks like it should work, given that Game_Actors class has this in it:
Code:
def armor1_id

  ...

end
Other than that, I see no reason why it shouldn't work, but since it obviously doesn't, run some checks, like these (put each in a call script directly before yours is executed):
Code:
p $game_party.actors

p $game_party.actors[0]

p $game_party.actors[0].armor1_id

p $game_variables[11]
Depending on which one of those works, you know what level your error is at. If it's the first, chances are you didn't initialize $game_party yet, aka before title screen (where setting a $game_variable would be pointless anyway). Second print command means there's no actor[0] (which indeed is the first actor in your party though), which means you probably want to write this anyway:
Code:
$game_variables[11] = $game_party.actors[0].armor1_id if $game_party.actors[0].exist?
Third of those checks returning an error means that you can't access armor1_id, which would be strange since it should be readable (check for 'attr_reader :armor1_id' or 'attr_accessor :armor1_id' within Game_Actor, at the top of the script), or you have a typo.
Finally, if the last check returns an error, that indicates your $game_variables haven'T been initialized, aka before starting a new game.

I can't really help any farther than that, considering I haven'T used RMXP for years, but I think you should be fine with this checkup. You might also try setting a different variable ($game_temp.avatar_armor1_id or something - got to set that manually). Hope this works.
 
I agree with BlueScope, you should be trying to use variables that aren't initialized. So to make sure you'll be able to use them, you should make sure both are available. Could you tell us what's the script where you tried to add this line of code? Or was it a script call?

Just in case it wasn't clear, could you show us where were you using that code snippet?
 
fisirstly, i'd like to thank everyone who answered this. :wink:
this is a script call in events, thats why i didn't put this in script support.

@blue scope: i tried your print check and i got info from all of them(ALOT!) the others weren't of any help. :cry:

@brewmeister: Thanks a bunch for that it works like it should. You Rock! :biggrin:
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top