• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Custom Feature Question] Temporary Inventory Removal

Cuprite (Kyu)

Formerly TheGoldenRiolu
  • 128
    Posts
    8
    Years
    Is there any good way of temporarily removing the player's current inventory to give back to them later? Ideally you'd still have access to your Bag, but the items that were in it beforehand aren't there, if that makes sense.
    Is this possible at all, or is there just no reliable way to do it (Or any way at all)?
     
    I think you can store $PokemonBag in a variable but I'm not so sure don't quote me on that.
     
    Yeah, as far as I can tell, that doesn't seem to work (If you mean something along the lines of "$game_variables[26]=$PokemonBag"). I can easily clear the Bag, but saving and restoring the previous state is an issue.
     
    I don't know if this helps but you can maybe disable access to the bag in the menu,party and battle until a switch is on, which can emulate the effect of not having an inventory.
     
    Thing is, I still want the player to be able to access the bag to pick up items found on the area (The idea is that you start a dungeon without any items on you, and you just have to work with what you find. Could also use it for an actual story purpose at some point) tho... Idk, I guess if I can't figure it out, I can maybe figure out some other way.
     
    Perhaps it would be somehow easier to replicate the bag code, calling it something else and use that for these dungeons (creating a switch for your menu in the bag portion which you can turn on when entering dungeon and off when exiting them).

    You could also call an event at the end of the dungeon which checks the items you have leftover in the second bag and gives the items to the first bag.

    Just make sure to erase the items in the second bag after checking and giving to the first bag, else the next dungeon the player enters they'll still have those items in their "dungeon bag".
     
    A really crude way to store your bag in a variable is to have a loop running through the bag items and storing each item and its quantity in an array. Then once you're done, you can use pbStoreBag to add all the items back along with their correct quantity.
     
    I'll try these when I get a chance to. Here's hoping one of 'em works for me.
     
    Code:
    # To save the bag...
    $game_variables[XXX] = $PokemonBag
    $PokemonBag = PokemonBag.new
    
    # To restore the bag...
    $PokemonBag = $game_variables[XXX]
     
    Code:
    # To save the bag...
    $game_variables[XXX] = $PokemonBag
    $PokemonBag = PokemonBag.new
    
    # To restore the bag...
    $PokemonBag = $game_variables[XXX]

    That works? This thread says otherwise.
     
    I don't see why it shouldn't work.

    EDIT: I've just tested and confirmed that it does indeed work.

    Omg it actually worked. I could have sworn I had tried this already. I... guess not. Thanks for the help. Lol.
    (Also I finally figured out how quoting works. lol)
     
    Back
    Top