User Tools

Site Tools


item_container_tutorial

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
item_container_tutorial [2017/12/05 11:09] justinitem_container_tutorial [2017/12/06 13:50] justin
Line 2: Line 2:
 ---- ----
  
-Coming soon!+This tutorial demonstrates how to add an [[item container]] to a [[map]]. For this walk-through, we will add a treasure chest to our main [[map]] that will contain some [[item|items]] for the [[player_character|player]] to retrieve.
  
-In the meantime, you can check out this tutorial on IndieDB: +**Note:** This tutorial assumes that you already understand the basics of navigating around the [[Map Editor]]. 
-[[http://www.indiedb.com/engines/rpginabox/tutorials/adding-an-item-container-to-a-map]]+ 
 +To begin, open the [[map]] that you want to add an [[item container]] to in the [[Map Editor]] and switch to "Place" mode.
  
 {{:wiki:place_mode_button.png?nolink|}} {{:wiki:place_mode_button.png?nolink|}}
 +
 +Select the [[object]] that you want to be an [[item container]] from the resource selection panel on the right and place it into the [[map]] in the desired location. For this example, I will be placing a treasure chest.
  
 {{:wiki:item_container_place_chest.gif?nolink|}} {{:wiki:item_container_place_chest.gif?nolink|}}
 +
 +Next, switch the [[Map Editor]] into "Edit" mode so the necessary modifications can be made to the [[object]].
  
 {{:wiki:edit_mode_button.png?nolink|}} {{:wiki:edit_mode_button.png?nolink|}}
 +
 +Right-click on your [[object]] and select "Properties" from the context menu.
  
 {{:wiki:item_container_popup_menu.png?nolink|}} {{:wiki:item_container_popup_menu.png?nolink|}}
 +
 +In the Properties dialog, check the [[Item Container]] checkbox to indicate that you want this [[object]] to behave as a container. Double-click any [[item|items]] that you wish to initially be included in the [[item container]] - this will add them to the box on the right labelled "Items in Container". Click the OK button once you are finished. It is not required to add any [[item|items]] initially, as you may just want the [[object]] to act as an [[item container]] but initially be empty at the start of the game.
  
 {{:wiki:item_container_properties.png?nolink|}} {{:wiki:item_container_properties.png?nolink|}}
 +
 +**Note:** You can also add a [[script]] to the [[object]] to have an event occur when the [[player_character|player]] opens the [[item container]] and an "On Close" [[script]] for when the [[player_character|player]] closes the container window or steps away from it. For example, you could play an opening [[animation]] for the [[object|object's]] main [[script]]: 
 +<code lua>
 +play_animation(self, "open")
 +</code>
 +And a closing [[animation]] for the "On Close" [[script]]
 +<code lua>
 +play_animation(self, "close")
 +</code>
 +
 +If markers are enabled in the [[Map Editor]], an [[item container]] marker ({{:wiki:box.png?nolink|}}) will appear over the object to indicate that the object is now an item container once you've closed the Properties dialog. You'll also see a [[script]] marker if you assigned a [[script]] to the [[object]].
  
 {{:wiki:item_container_markers.png?nolink|}} {{:wiki:item_container_markers.png?nolink|}}
 +
 +There is one more step to ensure that the [[player_character|player]] can interact with the [[item container]]. When I placed the treasure chest, the [[Map Editor]] removed any [[navigation_and_interaction|navigation paths]] to the [[tile]] that the chest is located on because the [[object]] is configured as being not passable. First, decide which adjacent [[tile|tiles]] the [[player_character|player]] should be able to interact with the [[item container]] from. In this case, there are two adjacent [[tile|tiles]] from which the [[player_character|player]] should be able to access the chest.
 +
 +To do so, switch the [[Map Editor]] into "Connect" mode.
  
 {{:wiki:connect_mode_button.png?nolink|}} {{:wiki:connect_mode_button.png?nolink|}}
  
 +Select "Interact Only" from the Navigation Palette in the top left corner, then click and drag from each adjacent [[tile]] to either the treasure chest or the [[tile]] it's located on. As shown below, connections of type "Interact Only" (colored orange by default) have been made between each adjacent [[tile]] and the [[tile]] that the chest is located on. This will allow the [[player_character|player]] to open the [[item container]] from these [[tile|tiles]]
 + 
 {{:wiki:item_container_connect_nav.gif?nolink|}} {{:wiki:item_container_connect_nav.gif?nolink|}}
 +
 +Save the [[map]], [[exporting_your_game|export the game]], then try out the [[item container]] you've created!
 +
 +{{:wiki:item_container_in_game.gif?nolink|}}
item_container_tutorial.txt · Last modified: 2017/12/06 13:51 by justin