Skip to content

1. Basic Usage

Nick Tsaizer edited this page Jan 31, 2021 · 6 revisions

alt text

1. Create an Item Class

(MUST BE (U)GameItem child class)

In my example I just added weight and volume variables, but nobody limits you to create anything you want. Just remember that all items with equal stats are one item in engine logic. So if you're doing item-specific logic (like Event Dispatchers) you have to explicitly specify the context.

alt text

1.1. Create an Item Struct (Optional)

You can use the default "ItemStruct" structure, but if you need to overload item properties, you must represent them in your structure. You always need "ItemClass" (U)GameItem class-reference property in your struct.

This is my TestItem example:

alt text

2. Create an Item at runtime:

Just get the "GUIS" subsystem and call the "Create Item" function. As a result, you will get an object that has the class you specified with the variable values you specified.

alt text

3. ???

Now you can do whatever you want with your object! You can add it to your inventory (just add InventoryComponent to your actor), remove it from your inventory, or transact it from one to another!

alt text

Clone this wiki locally