# Create Purchase Item
Grammar — Create a new purchase item for Players in slot slot under __purchaseGroup|Purchase Group __
Flags —Native
|Action
Creates a purchasable tech item for the specified purchase group and players. Use “Last Created Purchase Item” to get the purchase item created by this action. Tech purchase actions are used to populate the Hyperion Armory tech purchase UI with data.
# Arguments
playergroup
— Playersint
<preset::PurchaseGroup> — Purchase Groupint
— Slot
Returns — int
<preset::PurchaseItem>
native int PurchaseItemCreate(
playergroup inPlayerGroup,
int inPurchaseGroupId,
int inSlot,
);
# Related
Category: Story / Tech Purchase Panel / Purchase Items
- Create Purchase Item —
int
<preset::PurchaseItem> — PurchaseItemCreate - Last Created Purchase Item —
int
<preset::PurchaseItem> — PurchaseItemLastCreated - Destroy Purchase Item —
void
— PurchaseItemDestroy - Destroy All Purchase Items —
void
— PurchaseItemDestroyAll - Set Purchase Item Name —
void
— PurchaseItemSetNameText - Set Purchase Item Tooltip —
void
— PurchaseItemSetTooltipText - Set Purchase Item Description —
void
— PurchaseItemSetDescriptionText - Set Purchase Item Cost —
void
— PurchaseItemSetCost - Set Purchase Item Slot —
void
— PurchaseItemSetSlot - Set Purchase Item Icon —
void
— PurchaseItemSetIconFilePath - Set Purchase Item Movie —
void
— PurchaseItemSetMovieFilePath - Set Purchase Item Players —
void
— PurchaseItemSetPlayerGroup - Set Purchase Item State —
void
— PurchaseItemSetState - Set Purchase Item Recently Purchased —
void
— PurchaseItemSetRecentlyPurchased
# Examples
campaigns/libertystory.sc2campaign — base.sc2data/TriggerLibs/CampaignLib.galaxy:7637
lv_techIndex = (lv_indexTech);
if ((libCamp_gv_tS_Tech_UI[lv_techIndex] == c_invalidPurchaseItemId)) {
PurchaseItemCreate(PlayerGroupAll(), libCamp_gv_tS_TechGroup_UI[(libCamp_gv_tS_Tech_GroupID[lv_techIndex])], libCamp_gf_StoryTechSlot(lv_indexTech));
libCamp_gv_tS_Tech_UI[lv_techIndex] = PurchaseItemLastCreated();
PurchaseItemSetCost(PurchaseItemLastCreated(), libCamp_gf_StoryTechCost(lv_indexTech));