Items Ownership, Metadata and Stealing

From RPG Creation Kit
Jump to navigation Jump to search
An Item In World owned by Adelinde Venturia

The Update 1.6 of the RPG Creation Kit brought a new essential component for the Items System that is metadata, this component allows for items ownership, stealing and pickpocketing.

The metadata, regarding the Items, allows us to store unique information about a single instance of an Item, for example, who's the owner of that item, what are the conditions of the item and which enchants are applied to that item.

Items Ownership

As for v1.6, the metadata only stores information about Ownership of an item, which allows us to track which items are owned by NPCs and which are free for the Player to take. In every Item In Inventory and Item In World reference you will find a Metadata section:

Item In World:

Itemsmeta 2.png

A bottle of wine placed in the "CityKingPalace" cell, owned by The King


Item In Inventory:

Itemsmeta 3.png

An Armor Equipment item placed in the Inventory of the NPC "Lanius"


The flag Is Owned is true when someone else that is not the Player owns that item, and Owner ID states the ID of the owner. When Is Owned is false, the Item doesn't belong to anyone, and the Player is free to take it.

On the other hand, when the Player takes an owned item this is considered stealing.

Stealing

When looking at an Item the interface will clearly show if someone owns it.

When a player steals an item, this will be represented in a special way in the Inventory:

Itemsmeta 5.png


The red hand icon shows that the Item was stolen, and it may not be sold to merchants unless they are set to also buy stolen items.

By default, when the Player steals an Item the owner of the Item is the only one that can do something about it, if the owner sees the player stealing one of his items, he will attack him.

This behavior can be changed in the function CheckPlayerStealsItem(...) in the RCKFunctions.cs script, for example, you may want to trigger a special dialogue and make that the NPC takes the item back, or you may want to have guards to also look for other people's items.

Looting Points

Itemsmeta 6.png


Looting Points can also be owned, and their ownership will change the Interface when the Player looks at said point. Giving ownership to a Looting Point does not automatically assign ownership to all the Items in the Looting Point, but you can do so easily by Right-Clicking on the "Looting Point (Script)" header (in blue in the image above) and then click on "Apply LootingPoint Ownership to Items".

Itemsmeta 7.png


In fact, what really counts is the Metadata assigned to each item in the Inventory component of the Looting Point. This is done to allow placing in Looting Points items that belongs to different characters (or nobody).

Note that if an item without ownership is placed in a Looting Point owned by someone, it will not be considered a crime for the player to take it.

Pickpocketing

When crouched and close to an NPC, the Player can press the Interact button to start pickpocketing.

With this system in place, pickpocketing NPCs is possible.

As for it happens for Looting Points, every Item placed in the NPCs inventory can be owned or not, and you can set the ownership in the RckAI Editor or in the RckAI Inspector.

When the Player starts a pick-pocket, a special version of the Looting UI pops up:

Itemsmeta 10.png


On the top-right there will be the chance for the player to steal the item without the NPC to notice, the value will change in base of the Item selected or hovered with the mouse.

The chance to pick-pocket an item is determined by the following factors:

  • A base chance (20%)
  • The weight of the item
  • The Dexterity attribute of the Player
  • Amount of items to take (for example, taking 1 gold has a better chance than taking all 6)
  • Whether the NPC has the item equipped or not
  • If the player is behind the NPC or in front

Each factor has a specific weight in the calculation. You can edit the calculation of the chance anytime in the function CheckPlayerStealsItem(...) in the RCKFunctions.cs script.

When the player clicks to steal an item a random number is generated, and if it's less or equal than the chance the pickpocket is successful, otherwise the NPC will detect the attempt and aggro the player.


As said above, in the RckAI Editor you can configure the ownership of the item:

Itemsmeta 11.png


If Can be pick-pocketed is false, the player will not be able to do it.

Set Ownership automatically sets all the Items in the list to be owned by the RckAI.

Clear Ownership on the other hand clears the ownership of all the Items in the list.

Note that when an RckAI dies, all ownership is cleared, this is done to allow the player to loot a corpse without it being considered a crime.

Merchants and Stolen Items

Merchants can be set to buy or not stolen items, in addition to that, the Update 1.6 also added the Buy/Sell multipliers, to avoid flat economy in the game:

Itemsmeta 13.png