IsCategory functionallity?

joran

New member
say i have a category "Spell"

I also have a category EarthSpell or something like that which has Spell as a parent

can i say something like
Code:
isType(itemInstance,"Spell")

so that an instance of EarthSpell returns true ?
 

Sangemdoko

Moderator
Staff member
You can get the Item Category and check if the Item, Item Definition or (another) Item Category is part of that category.
This is done using the category.InherentlyContains function.

There is an example on this page: https://opsive.com/support/documentation/ultimate-inventory-system/item/

C#:
// Check if the item is part of a category.
var weapon = InventorySystemManager.GetItemCategory("Weapon");
var swordIsWeapon = weapon.InherentlyContains(sword);
// Similar function are available for Item Definition or even between categories.
var weaponIsWeapon = weapon.InherentlyContains(weapon);
var swordDefinitionIsWeapon = weapon.InherentlyContains(swordDefinition);
 
Top