User Tools

Site Tools


equipment_slot

Differences

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

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
equipment_slot [2020/11/30 18:47] – created justinequipment_slot [2021/07/03 22:47] justin
Line 2: Line 2:
 ---- ----
  
-An **equipment slot** is a [[widget] element for equipping an [[item]] to (for example, a sword or shield). The player can equip an [[item]] to the slot if the [[item]] has been configured as equippable in the [[Item Editor]] and it includes a tag matching the slot ID assigned to the equipment slot.+An **equipment slot** is a [[widget]] element for equipping an [[item]] to (for example, a sword or shield). The player can equip an [[item]] to the slot if the [[item]] has been configured as equippable in the [[Item Editor]] and it includes a valid tag assigned to that to the equipment slot.
  
 =====Element Properties===== =====Element Properties=====
 ^Icon^Property^Description^ ^Icon^Property^Description^
 +|{{:wiki:tag_id.png?nolink|}}|Element ID|ID for the equipment slot. This ID must be unique amongst other elements within the same [[widget]]. It is currently auto-generated but will be editable in a future update.|
 +|{{:wiki:sword.png?nolink|}}|Equipment Slot ID|ID that will determine which [[item|items]] can be equipped to this slot. A particular slot ID will only allow [[item|items]] that include a tag listed for that slot in the "Equipment" section of the Stats Editor. For example, the "head" slot will only accept an [[item]] tagged with "helmet" (e.g. an iron helmet).|
  
 =====Scripting===== =====Scripting=====
 +You can access certain properties of an equipment slot from a [[script]] by simply referencing the parent [[widget]] and the element by their unique IDs. See below for examples of retrieving the slot's [[item]]. In this case, we are assuming that the slot currently contains an [[item]], the [[widget]] has an ID of "test", and the equipment slot has an ID of "0001". If the slot is empty, its "item" property will be null.
  
-(Accessing/changing properties of the element via scripts)+**Retrieving the item data for an equipment slot:** 
 +<code bauxite> 
 +$item_id = widget["test"].element["0001"].item.id; 
 +$item_count = widget["test"].element["0001"].item.count; 
 +</code> 
 + 
 +**Checking if an item exists in an equipment slot:** 
 +<code bauxite> 
 +if widget["test"].element["0001"].item == null then 
 +   display_message("There isn't an item in this slot.")
 +end; 
 +</code>
  
 ~~NOTOC~~ ~~NOTOC~~
equipment_slot.txt · Last modified: 2021/07/03 22:48 by justin