Item Script

From RPG Creation Kit
Jump to navigation Jump to search

An Item Script is a type of script that runs a piece of code when certain events regarding items occurs.

Each Item can have only one Item Script set, and the Item Script is set in the 'Configure Item' Window.

You can create a Quest Stage Script by right-clicking in the Project Window -> Create -> RPG Creation Kit -> C# -> New Item Script.

Item Scripts are extremely useful when you want some things to happen in base of certain events that involve items, such as when the Player takes an item, or when the Player deposits an Item inside a container. In the tutorial A First Look we've seen that an Item Script is used to start the Quest.

The list of events is:

  • OnAdd(inventory): the respective code runs when the Item gets added to an Inventory.
  • OnRemove(inventory): called when the Item gets removed to an Inventory.
  • OnEquip(inventory): called when the Item gets equipped by the entity that owns inventory.
  • OnUnequip(inventory): called when the Item gets unequipped by the entity that owns inventory.
  • OnDepositInContainer(container): called when the item gets deposited inside a Looting Point.
  • OnTakeFromContainer(container): called when the item is took from a Looting Point.


To learn how to create and assign Item Scripts, see the tutorial Creating a New Item Script