# Last Created Purchase Item

Grammar — Last created Purchase Item
FlagsNative | Function

Returns the last purchase item created by the “Create Purchase Item” action.

Returns — int<preset::PurchaseItem>

native int PurchaseItemLastCreated();

Category: Story / Tech Purchase Panel / Purchase Items

# Examples

campaigns/libertystory.sc2campaignbase.sc2data/TriggerLibs/CampaignLib.galaxy:7638

        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));
            PurchaseItemSetIconFilePath(PurchaseItemLastCreated(), libCamp_gf_StoryTechIcon(lv_indexTech));

campaigns/libertystory.sc2campaignbase.sc2data/TriggerLibs/CampaignLib.galaxy:7639

            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));
            PurchaseItemSetIconFilePath(PurchaseItemLastCreated(), libCamp_gf_StoryTechIcon(lv_indexTech));
            PurchaseItemSetMovieFilePath(PurchaseItemLastCreated(), libCamp_gf_StoryTechMovie(lv_indexTech));

campaigns/libertystory.sc2campaignbase.sc2data/TriggerLibs/CampaignLib.galaxy:7640

            libCamp_gv_tS_Tech_UI[lv_techIndex] = PurchaseItemLastCreated();
            PurchaseItemSetCost(PurchaseItemLastCreated(), libCamp_gf_StoryTechCost(lv_indexTech));
            PurchaseItemSetIconFilePath(PurchaseItemLastCreated(), libCamp_gf_StoryTechIcon(lv_indexTech));
            PurchaseItemSetMovieFilePath(PurchaseItemLastCreated(), libCamp_gf_StoryTechMovie(lv_indexTech));
            PurchaseItemSetNameText(PurchaseItemLastCreated(), libCamp_gf_StoryTechName(lv_indexTech));

campaigns/libertystory.sc2campaignbase.sc2data/TriggerLibs/CampaignLib.galaxy:7641

            PurchaseItemSetCost(PurchaseItemLastCreated(), libCamp_gf_StoryTechCost(lv_indexTech));
            PurchaseItemSetIconFilePath(PurchaseItemLastCreated(), libCamp_gf_StoryTechIcon(lv_indexTech));
            PurchaseItemSetMovieFilePath(PurchaseItemLastCreated(), libCamp_gf_StoryTechMovie(lv_indexTech));
            PurchaseItemSetNameText(PurchaseItemLastCreated(), libCamp_gf_StoryTechName(lv_indexTech));
        }

campaigns/libertystory.sc2campaignbase.sc2data/TriggerLibs/CampaignLib.galaxy:7642

            PurchaseItemSetIconFilePath(PurchaseItemLastCreated(), libCamp_gf_StoryTechIcon(lv_indexTech));
            PurchaseItemSetMovieFilePath(PurchaseItemLastCreated(), libCamp_gf_StoryTechMovie(lv_indexTech));
            PurchaseItemSetNameText(PurchaseItemLastCreated(), libCamp_gf_StoryTechName(lv_indexTech));
        }