So I'm working on a store, and I've got a lot of things working (buying items, buying requirements of items, etc) However there is one problem I've ran in to that I'm not sure how to solve. Currently I have items setup like the following:
Basic Items - (these can be used as requirements to purchase "big items")
Big Items - these are "composed" of basic items, and can be used as requirements to purchase "advanced items"
Advanced items - use big items as a requirement for purchase.
Now the problem is if I have two of the same items in a recipe, the store will only take one in to account, and skip over the 2nd duplicate item.
(below is the "upgrade" trigger)
What I want it to do, is take the duplicate item in to consideration, and also remove it from the inventory. I'm drawing a blank as to how I can do this, and could really appreciate any help. If you need a working example, I might be willing to provide that.
Store:UpgradeItemOptions:ActionReturnType:(None)ParametersUpgradeID=0<Integer>CategoryID=0<Integer>SubCategoryID=0<Integer>ItemID=0<Integer>Hero=NoUnit<Unit>GrammarText:Store:UpgradeItem(UpgradeID,CategoryID,SubCategoryID,ItemID,Hero)HintText:(None)CustomScriptCodeLocalVariablesRequirementsMet=false<Boolean[3]>Unit=NoUnit<Unit[3]>i=0<Integer>ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfStore:All_Upgradable_Items[UpgradeID].has_components==trueThenGeneral-Foreachintegerifrom1to6withincrement1,do(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfStore:All_Upgradable_Items[UpgradeID].req1>0ThenGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Unittypeof(ItemcarriedbyHeroini))==Store:All_Upgradable_Items[Store:All_Upgradable_Items[UpgradeID].req1].Upgrade_ItemUnitThenVariable-SetUnit[1]=(ItemcarriedbyHeroini)Variable-SetRequirementsMet[1]=trueElseElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfStore:All_Upgradable_Items[UpgradeID].req2>0ThenGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Unittypeof(ItemcarriedbyHeroini))==Store:All_Upgradable_Items[Store:All_Upgradable_Items[UpgradeID].req2].Upgrade_ItemUnitThenVariable-SetUnit[2]=(ItemcarriedbyHeroini)Variable-SetRequirementsMet[2]=trueElseElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfAndConditionsStore:All_Upgradable_Items[UpgradeID].has_components==trueStore:All_Upgradable_Items[UpgradeID].req2==0ThenVariable-SetRequirementsMet[2]=trueElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfStore:All_Upgradable_Items[UpgradeID].req3>0ThenGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Unittypeof(ItemcarriedbyHeroini))==Store:All_Upgradable_Items[Store:All_Upgradable_Items[UpgradeID].req3].Upgrade_ItemUnitThenVariable-SetUnit[3]=(ItemcarriedbyHeroini)Variable-SetRequirementsMet[3]=trueElseElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfAndConditionsStore:All_Upgradable_Items[UpgradeID].has_components==trueStore:All_Upgradable_Items[UpgradeID].req3==0ThenVariable-SetRequirementsMet[3]=trueElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfAndConditionsRequirementsMet[1]==trueRequirementsMet[2]==trueRequirementsMet[3]==trueThenGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Player(Triggeringplayer)Minerals)>=Store:All_Upgradable_Items[UpgradeID].ItemCostThenPlayer-Modifyplayer(Triggeringplayer)Minerals:SubtractStore:All_Upgradable_Items[UpgradeID].ItemCostGeneral-Pickeachintegerfrom1to3,anddo(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfUnit[(Pickedinteger)]!=NoUnitThenUnit-RemoveUnit[(Pickedinteger)]fromthegameElseGeneral-Wait0.25GameTimesecondsUnit-CreateoneStore:All_Upgradable_Items[UpgradeID].Upgrade_ItemUnititemintheinventoryofHeroElseUI-Display"Insufficient Minerals to purcahse I..."for(Playergroup((Triggeringplayer)))toSubtitleareaElseUI-Display"You do not have the required Items."for(Playergroup((Triggeringplayer)))toSubtitleareaElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfStore:All_Items[UpgradeID][SubCategoryID][ItemID].Upgradable==trueThenGeneral-Foreachintegerifrom1to6withincrement1,do(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfStore:All_Items[CategoryID][SubCategoryID][ItemID].Componet1>0ThenGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Unittypeof(ItemcarriedbyHeroini))==Store:All_Upgradable_Items[Store:All_Items[CategoryID][SubCategoryID][ItemID].Componet1].Upgrade_ItemUnitThenVariable-SetUnit[1]=(ItemcarriedbyHeroini)Variable-SetRequirementsMet[1]=trueElseElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfStore:All_Items[CategoryID][SubCategoryID][ItemID].Componet2>0ThenGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Unittypeof(ItemcarriedbyHeroini))==Store:All_Upgradable_Items[Store:All_Items[CategoryID][SubCategoryID][ItemID].Componet2].Upgrade_ItemUnitThenVariable-SetUnit[2]=(ItemcarriedbyHeroini)Variable-SetRequirementsMet[2]=trueElseElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfAndConditionsStore:All_Items[CategoryID][SubCategoryID][ItemID].Componet2==0ThenVariable-SetRequirementsMet[2]=trueElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfStore:All_Items[CategoryID][SubCategoryID][ItemID].Componet3>0ThenGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Unittypeof(ItemcarriedbyHeroini))==Store:All_Upgradable_Items[Store:All_Items[CategoryID][SubCategoryID][ItemID].Componet3].Upgrade_ItemUnitThenVariable-SetUnit[3]=(ItemcarriedbyHeroini)Variable-SetRequirementsMet[3]=trueElseElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfAndConditionsStore:All_Items[CategoryID][SubCategoryID][ItemID].Componet3==0ThenVariable-SetRequirementsMet[3]=trueElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfAndConditionsRequirementsMet[1]==trueRequirementsMet[2]==trueRequirementsMet[3]==trueThenGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Player(Triggeringplayer)Minerals)>=Store:All_Items[CategoryID][SubCategoryID][ItemID].ItemCostThenPlayer-Modifyplayer(Triggeringplayer)Minerals:SubtractStore:All_Items[CategoryID][SubCategoryID][ItemID].ItemCostGeneral-Pickeachintegerfrom1to3,anddo(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfUnit[(Pickedinteger)]!=NoUnitThenUnit-RemoveUnit[(Pickedinteger)]fromthegameElseGeneral-Wait0.25GameTimesecondsUnit-CreateoneStore:All_Items[CategoryID][SubCategoryID][ItemID].ItemUnititemintheinventoryofHeroElseUI-Display"Insufficient Minerals to purcahse I..."for(Playergroup((Triggeringplayer)))toSubtitleareaElseUI-Display"You do not have the required Items."for(Playergroup((Triggeringplayer)))toSubtitleareaElse
I already have a system like that working, only it's completely automated (you don't have to do the same steps over and over again). My problem is for reason when I have two items that are the same "ingredient" the store only takes the 1, and by passes everything else.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
So I'm working on a store, and I've got a lot of things working (buying items, buying requirements of items, etc) However there is one problem I've ran in to that I'm not sure how to solve. Currently I have items setup like the following:
Basic Items - (these can be used as requirements to purchase "big items") Big Items - these are "composed" of basic items, and can be used as requirements to purchase "advanced items" Advanced items - use big items as a requirement for purchase.
Now the problem is if I have two of the same items in a recipe, the store will only take one in to account, and skip over the 2nd duplicate item.
(below is the "upgrade" trigger)
What I want it to do, is take the duplicate item in to consideration, and also remove it from the inventory. I'm drawing a blank as to how I can do this, and could really appreciate any help. If you need a working example, I might be willing to provide that.
Not sure if this is what you are looking for, but...
http://forums.sc2mapster.com/development/tutorials/6380-trigger-data-item-recipe-combining-system-tutorial/
@zeldarules28: Go
I already have a system like that working, only it's completely automated (you don't have to do the same steps over and over again). My problem is for reason when I have two items that are the same "ingredient" the store only takes the 1, and by passes everything else.