If you've ever wanted to know how to create a storage module in your Pixel Dungeon mod, this is the right guide to help you.

In this tutorial, I will show you how to create a storage, where players can place extra items.

Prerequisites Edit

Before you begin to follow this tutorial, you should have a build of Pixel Dungeon that you can compile for testing. You should also know some java.

Setting up the storage Edit

1. Make a copy of the belongings file, which is in the hero folder.

2. Rename it to be Storage.

3. Add the text public Storage storage; to the file, underneath the belongings variable.

4. Go to the file, and add a new boolean, storage, which should equal false. (This will be used to check if we are accessing the storage or not.)

5. Go to the file, and find the line that begins with add( btnInventory = new Tool( 60, 7, 23, 25 ). Inside of that, you should see a function called OnClick(). Add the line, = false; inside of it.

6. You should also make something that triggers = true; so that the player can actually access his or her storage.

Implementing the Storage Functions Edit

1. Go to the file, and add these two lines under the AC_THROW variable.

Lines to add:

 public static final String AC_STORE     = "STORE";
  public static final String AC_RETRIEVE  = "RETRIEVE";

2. Find the function,

public ArrayList<String> actions( Hero hero )

Replace everything inside of that function with this:

 ArrayList<String> actions = new ArrayList<String>();
 if( == true){
 else if( == false){
 actions.add( AC_DROP );
 actions.add( AC_THROW );
 actions.add( AC_STORE );
 return actions;

3. Underneath the doThrow function, add these lines

public void doStore (Hero hero){
  public void doRetrieve (Hero hero){

4. Find the execute function, and add these lines of code after the else if for AC_THROW

else if(action.equals(AC_STORE)){
 else if(action.equals(AC_RETRIEVE)){

Triggering the Storage Edit

Now, all you have to do is have something trigger the Storage. You could use an NPC's interact() function, like me, or you could have a tile from the tilemap do it. The lines of code that will do the trick are these: = true; WndBag(,null,WndBag.Mode.ALL,null));

After doing this, you should be able to have a functional storage bag!


If you have any problems, feel free to post them on the forums, or in the comments section for this page.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.