• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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
7
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)?
     

    Cuprite (Kyu)

    Formerly TheGoldenRiolu
    128
    Posts
    7
    Years
  • 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.
     
    658
    Posts
    7
    Years
  • 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.
     

    Cuprite (Kyu)

    Formerly TheGoldenRiolu
    128
    Posts
    7
    Years
  • 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.
     

    Natzen

    Creator of Pokémon: Sanguine
    49
    Posts
    8
    Years
  • 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".
     
    89
    Posts
    4
    Years
    • Seen Jan 17, 2023
    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.
     
    971
    Posts
    7
    Years
    • Age 21
    • Seen Nov 28, 2022
    Code:
    # To save the bag...
    $game_variables[XXX] = $PokemonBag
    $PokemonBag = PokemonBag.new
    
    # To restore the bag...
    $PokemonBag = $game_variables[XXX]
     
    Back
    Top