Events

## Output Events

Note: Changes to a brick's or vehicle's inventory by events will cause the GUIs of other players who are viewing that inventory to instantly update and apply the changes.

**RPGx\_AddStack** -> [**Player / Brick**] [**Item**] [**1 - 999**]

Adds a stack of items to either a player's inventory (or to an item's inventory a player may be carrying) or a brick's / vehicle's inventory; you can choose the item type and amount of items in the stack in the event's output events.

**RPGx\_ClearInv** -> [**Player / Brick**]

Completely clears a player's or brick's / vehicle's inventory.

**RPGx\_CloseInv**

Closes the Personal Inventory GUI for the player who called the event.

**RPGx\_ifCanAccess**

Checks if the brick's / vehicle's inventory is locked. If the inventory isn't locked, or if the player has the right key to access it, this event will then call the input event "onRPGxCanAccessPass". Otherwise, the event calls "onRPGxCanAccessFail".

**RPGx\_ifHasStack** -> [**Player / Brick**] [**Item**] [**1 - 999**]

Checks if a player or brick / vehicle inventory has a certain amount of a particular item (the item's don't have to be present in only a single stack). If the specified amount of items are found, the event calls "onRPGxHasStackPass". Otherwise, it calls "onRPGxHasStackFail".

Note: This event is useful for custom shop systems, i.e. for checking if a player has a specific amount of gold coins to purchase an item.

**RPGx\_ifStackInCell** -> [**Player / Brick**] [**0 - 99**] [**Item**] [**1 - 999**]

Checks if a player or brick / vehicle inventory has a certain amount of a particular item in a specific inventory slot. In the output parameters, the first popup menu is the inventory to search in. The following textbox is the cell number to check. If the specified amount of items are found in the exact slot, the event calls "onRPGxHasStackPass". Otherwise, it calls "onRPGxHasStackFail".

**RPGx\_OpenBrInv**

Open's the Personal Inventory GUI for the player who called the event.

**RPGx\_RandomInv** -> [**Player / Brick**] [**1 - 999**]

Completely clears the specified inventory, and replaces it with random items. The textbox in the event's output parameters specifies the max amount of items per stack - the amount itself is also randomized.

**RPGx\_RmvStack** -> [**Player / Brick**] [**Item**] [**1 - 999**]

Removes a specific amount of items from a player's or brick's / vehicle's inventory (or from an item's inventory which a player may be carrying).

Note: You can use "RPGx\_ifHasStack" to check if the stack of items exists before removing it.

**RPGx\_SetLoot** -> [**Add / Remove**] [**LootFileName**]

Clears the inventory and replaces it with items from the loot file specified (item's are randomly selected, based on each item's frequency specified in the file). This event also set's the brick as a "loot brick", which causes the inventory to update routinely during each loot "tick". Make sure to enter the name of the file in the event's textbox - the file path and extension are not required.

Note: Select "Remove" in the output parameters to disable the brick from being a loot brick (once the event is called) and to prevent it from being routinely updated.

Note: Loot files are stored in the "config/server/RPGx\_Beta/Loot/" folder.

**RPGx\_SetStore** -> [**Add / Remove**] [**StoreFileName**]

Set's the brick as a "shop brick", which randomizes it's "buy" and "sell" inventories with items from the shop file specified (based on each item's frequency specified in the file). This event also causes the inventories to update routinely during each store "tick". Once the brick is activated, the shop GUI will open instead of the brick's inventory. Make sure to enter the name of the file in the event's textbox - the file path and extension are not required.

Note: Select "Remove" in the output parameters to disable the brick from being a shop brick (once the event is called) and to prevent it from being routinely updated.

Note: Loot files are stored in the "config/server/RPGx\_Beta/Shops/" folder.

## Input Events

**onRPGxCanAccessPass** and **onRPGxCanAccessFail** are called relative to the RPGx\_ifCanAccess output event.

**onRPGxHasStackPass** and **onRPGxHasStackFail** are called based on RPGx\_ifHasStack.

**onRPGxHasStackPass** and **onRPGxHasStackFail** are called relative to RPGx\_ifStackInCell.

**onRPGxBrInvTransfer** - called when a brick's / vehicle's inventory is updated via the Personal Inventory GUI.

**onRPGxInvUnlocked** - called when a brick's / vehicle's inventory is successfully unlocked by a key, or picked by a lock pick.

**onRPGxVehInvAccess** - called on a vehicle's spawn brick when the vehicle's inventory is accessed.

**All other input events** are called when certain RPGx tools or items are used on a brick.