I'm trying to add a little cheat system in a game I'm making. What I'm having trouble with at the moment is an event that lets me add an item to the inventory by ID. So far I've got an event that sets variable id 0152 with button input processing, then I was going to use a script to add the specified item. I'm not so good at scripting so I just guessed this by looking at other scripts...
$game_party.gain_item ($game_variable[152], 1)
Anyone know what I'd have to change to make this work? It works if I specify an item id, but how can I make it work to use the variable as the item id?
var = $game_variables[152]
$game_party.gain_item(var, 1)
Should work. Just put it in a call script. Also, remember that it's $game_party.gain_weapon for weapons and $game_party.gain_armor for armours.
Copied that letter for letter, tried it with item id 001, gave an error message "NoMethodError occurred while running script. undefined method '[]' for nil:NilClass"
:(
That's weird. Did you remember to put an s after $game_variable? So it was $game_variables?
Otherwise, it might be something wrong with your RPG Maker XP.
No, of course I didn't remember to put the s. -.-
Thanks a lot for the help, it's working now! You saved me from having to make a conditional branch for every single item... heh.