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.

Setting Up the Object in a Map

Place object into map in desired location

Open properties dialog for object and assign an entity ID

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 Item Pickup In-Gamep

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

item_pickup_tutorial.1520482216.txt.gz · Last modified: 2018/03/07 20:10 by justin