void main() { object oItem; int nSlot; oItem = GetFirstItemInInventory(OBJECT_SELF); while (GetIsObjectValid(oItem)) { if (GetLocalInt(oItem, "X4ToEquip") == TRUE) { if (GetBaseItemType(oItem) == BASE_ITEM_ARMOR) nSlot = INVENTORY_SLOT_CHEST; else if (GetBaseItemType(oItem) == BASE_ITEM_CLOAK) nSlot = INVENTORY_SLOT_CLOAK; else if (GetBaseItemType(oItem) == BASE_ITEM_SMALLSHIELD) nSlot = INVENTORY_SLOT_LEFTHAND; else if (GetBaseItemType(oItem) == BASE_ITEM_LARGESHIELD) nSlot = INVENTORY_SLOT_LEFTHAND; else if (GetBaseItemType(oItem) == BASE_ITEM_TOWERSHIELD) nSlot = INVENTORY_SLOT_LEFTHAND; else if (GetBaseItemType(oItem) == BASE_ITEM_HELMET) nSlot = INVENTORY_SLOT_HEAD; else nSlot = INVENTORY_SLOT_RIGHTHAND; SetLocalInt(oItem, "X4ToEquip", FALSE); ActionEquipItem(oItem, nSlot); return; } oItem = GetNextItemInInventory(OBJECT_SELF); } }