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

[Scripting Question] Piramid Bag

6
Posts
3
Years
    • Seen Jul 31, 2020
    Hello there!

    Does anyone know how to create a new bag where you can only use certain items (so there would be two bags, the one you get at the beginning of the game and this one)? Then, how can I disable the access to the first one (keeping the items the player has) and give access to the new one?

    If you cannot understand it correctly, it's basically the same thing that is done in the Battle Piramid [in the Battle Frontier - Emerald Version].

    Thanks in advance!
     
    Last edited:
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    According to the wiki you can create a new bag with $PokemonBag=PokemonBag.new. Make sure to put the old bag in a variable so that you can restore it later.
     
    6
    Posts
    3
    Years
    • Seen Jul 31, 2020
    Thank you ever so much for your response. I highly appreciate it.

    According to that link, that'd be the way to create a new bag, but wouldn't this bag be empty in the sense that there is no code as to which items you can store in there or how many slots it'd have? Or would it just use the exact same information that was initially coded for the default bag you use?

    Also, can I just put this script anywhere or do I need to copy it right under the other bag's script?

    And with regards to the variable, which I suppose could also just be a global switch, which is the correct and easiest way to do this? I've been trying some days ago and I always get a script error when emulating the game. I'm quite bad at this, sorry.
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    I think it will create an empty bag, like you would get if you started a new game. I'm not good at RMXP scripting, but I think the way you'd want to make this work is by having two events, one that saves the old bag and switches to the new one (in this example we save to variable 0, but you probably want to change that):
    Code:
    $game_variables[0] = $PokemonBag
    $PokemonBag = PokemonBag.new

    And an event that restores the old bag:
    Code:
    $PokemonBag = $game_variables[0]
     
    6
    Posts
    3
    Years
    • Seen Jul 31, 2020
    Ok, so this is what I did in the script section called "PSystem_Utilities":

    $game_variables[82] = $PokemonBag
    $PokemonBag = PokemonBag.new
    $PokemonBag = $game_variables[81]

    I tried adding +1 to the variable, and then I thought it didn't make much sense. Then I tried calling a script with an event, but I can still access my bag and no new bag was created.

    $game_variables[81] = false
    $game_variables[82] = true
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    I didn't intend for you to put any code in the script sections. I think you can make these changes entirely from within the scripts for individual events. You could define a function in the scripts to help, but I'd advise against that for now because it seems you're still learning and that's just going to make things more complicated.

    I wish I could be more helpful, but I've never written any events for RMXP. You might want to try the #game-dev channel on the PC Discord server. You could point them at this thread so that they understand the problem and (potential) solution better.
     
    6
    Posts
    3
    Years
    • Seen Jul 31, 2020
    Oh, alright! I've just tried it and it worked! Amazing. I cannot believe it was that easy!

    Thank you once again for your help!
     
    Back
    Top