• 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.

Add an Item to Item Storage

thor348

That's Oak to You
  • 137
    Posts
    11
    Years
    I've been searching and tinkering but to no avail. Is there a way to add an item directly to the Item Storage in the Players PC?
     

    thor348

    That's Oak to You
  • 137
    Posts
    11
    Years
    I found that in the PokemonBag script section and tried it but it didn't work.

    EDIT:
    Okay, I played around some more and this works:

    Code:
    $PokemonGlobal.pcItemStorage.pbStoreItem(PBItems::item,quantity)
     
    Last edited:
  • 9
    Posts
    64
    Days
    Couldn't figure out directly how to do this, so I wrote a little code. Apparently they were phasing out the pbStoreItem code in v. 20, which added items directly to the PC. However, instead of replacing it with an equivalent code in v. 20, the devs replaced it with code that just added items directly to the player's inventory.

    Blah blah blah, ignore the above. Here's the fix for you:



    In the Script Editor, go to UI_bag. Scroll to the very bottom. Add this:

    Code:
    #Adds an item directly to the Player's PC and kwatar is a dumb idiot
    def pbDepositItemStorage(item, qty = 1)
        if !$PokemonGlobal.pcItemStorage
              $PokemonGlobal.pcItemStorage = PCItemStorage.new
            end
        storage = $PokemonGlobal.pcItemStorage
        storage.add(item, qty)
    end

    It should look like this:
    Add an Item to Item Storage



    Now, you can call this any time by running the script:
    Code:
    pbDepositItemStorage(<ITEM NAME>, <NUMBER OF ITEMS>)

    Like so:
    Add an Item to Item Storage


    By the way, when you're putting this code in the events, don't forget you might need to run extendtext.exe because RPG Maker XP inserts spaces with line breaks into code and sometimes that breaks everything.


    Hope this helps!
     
    Back
    Top