# Create Inventory Item

Grammar — Create one itemType item in the inventory of u
FlagsNative | Action

Creaters an item in a unit’s inventory. Use the “Last Created Inventory Item” function to refer to the created item.

# Arguments

  • unit — Unit
  • string<gamelink::Unit> — Item Type

Returns — void

native unit UnitInventoryCreate(
	unit inUnit,
	string itemType,
);

Category: Unit / Items

# Examples

mods/warcoop/warclassicsystem.sc2modbase.sc2data/TriggerLibs/WarClassicSystem.galaxy:471

        lv_itItemStack = ItemGetChargeCount(lv_item, false);
        lv_container = UnitInventoryContainer(lv_item);
        UnitInventoryCreate(lv_target, UnitGetType(lv_item));
        lv_itemCopy = UnitInventoryLastCreated();
        UnitInventoryMove(lv_itemCopy, lv_container, lv_slot);

mods/warcoop/warclassicsystem.sc2modbase.sc2data/TriggerLibs/WarClassicSystem.galaxy:1441

    }

    UnitInventoryCreate(lv_caster, lv_itemType);
    return true;
}

mods/warcoop/warcoopdata.sc2modbase.sc2data/TriggerLibs/WarCoopData.galaxy:1759

                lv_item = (lv_itemid);
                if ((CatalogEntryIsValid(c_gameCatalogUnit, lv_item) == true)) {
                    UnitInventoryCreate(lp_hero, lv_item);
                }

mods/warcoop/warmeleeai.sc2modbase.sc2data/TriggerLibs/Orc/Orc.galaxy:646

        }
        UnitGroupAdd(aiHeroes[player],u);
        UnitInventoryCreate(u,c_IT_PotionofHealingAI);
        UnitInventoryCreate(u,c_IT_PotionofManaAI);
        UnitInventoryCreate(u,c_IT_ScrollofRegenerationAI);

mods/warcoop/warmeleeai.sc2modbase.sc2data/TriggerLibs/Orc/Orc.galaxy:647

        UnitGroupAdd(aiHeroes[player],u);
        UnitInventoryCreate(u,c_IT_PotionofHealingAI);
        UnitInventoryCreate(u,c_IT_PotionofManaAI);
        UnitInventoryCreate(u,c_IT_ScrollofRegenerationAI);
        UnitInventoryCreate(u,c_IT_ScrollofTownPortalAI);

mods/warcoop/warmeleeai.sc2modbase.sc2data/TriggerLibs/Orc/Orc.galaxy:648

        UnitInventoryCreate(u,c_IT_PotionofHealingAI);
        UnitInventoryCreate(u,c_IT_PotionofManaAI);
        UnitInventoryCreate(u,c_IT_ScrollofRegenerationAI);
        UnitInventoryCreate(u,c_IT_ScrollofTownPortalAI);
    }

mods/warcoop/warmeleeai.sc2modbase.sc2data/TriggerLibs/Orc/Orc.galaxy:649

        UnitInventoryCreate(u,c_IT_PotionofManaAI);
        UnitInventoryCreate(u,c_IT_ScrollofRegenerationAI);
        UnitInventoryCreate(u,c_IT_ScrollofTownPortalAI);
    }
    if (type == ZEPPLIN) {