User Tools

Site Tools


item_pickup_tutorial

This is an old revision of the document!


Item Pickups

(WIP)

This tutorial will explain how to set up map objects as items for the player to pick up, for example a key that the player can pick up by walking into/over it and then use to open a door or treasure chest.

Note: This tutorial assumes that you already understand the basics of using the RPG in a Box editors, in particular the Map Editor and Voxel Editor.

Creating the Object Model

Open the New Resource Dialog and create a new object. Once the Voxel Editor opens for the new object model, use the voxel tools to build a key as shown below (or whatever will best visually represent the item).

After the model is complete, be sure to enable the “Passable” property on the Model Properties panel. This will prevent the Map Editor from automatically removing navigation paths to its tile when placed into a map. Save the model if you haven't already.

Before proceeding to the next section, you can optionally create a “floating” animation for the object by following the Creating a Simple Floating Animation tutorial. This will give a nice effect to the object in-game and also provide a cue to the player that it's an item pickup.

Defining the Item

In addition to the object model, you'll also need to define the corresponding item that the player will receive in their inventory. Go to the Item Editor tab and add a new item, then enter a name, description, and image to use.

Remember the name you used for your item (including case) as it will be referenced in a quick script later on. Click the “Save” button () to save the changes to you've made to the item database.

Creating a Sound Effect

Optionally, you can create a sound effect for the game to play when the item is picked up by the player. To do so, click the |Sound FX Generator button at the top, then click one of the presets along the left to find a sound that goes well with the item. In this example, the “Pickup/Coin” preset should work well.

Once you are happy with the sound, click the “Save Sound” button () and enter a name. Remember this name (including case) as it will also be referenced in our quick script later on.

Setting Up the Object in a Map

Open the map where you'd like to have the item pickup. Select the object model you created earlier from the resource container on the right, then place the object onto an open tile in the map.

Switch into “Edit” mode, then either double-click the object or right-click on it and select “Properties” to open the Entity Properties dialog. Enter a unique ID into the “Entity ID” box and click OK. I'm using “key_01” for this example since my map will contain multiple keys (“key_02”, “key_03”, etc.).

Open properties dialog for object's tile and add quick script

set_entity_script(self, "");
remove_entity(entity["key_01"]);
play_sound("give_key");
give_item("Gold Key")

Testing the Pickup In-Game

Finished! Save map and export game, player will now “pick up” key when walking onto the tile.

item_pickup_tutorial.1520482887.txt.gz · Last modified: 2018/03/07 20:21 by justin