1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  3. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  4. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  5. Choose your ride to damnation in the 5th Special Effect Contest Poll.
    Dismiss Notice
  6. The winners of the 13th Techtree Contest have been announced!
    Dismiss Notice
  7. The 13th Music Contest Poll is up! Vote for the best tracks in this symphony of frost and flame.
    Dismiss Notice
  8. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Simple GUI Shop System 1.02

Submitted by Shoto
This bundle is marked as approved. It works and satisfies the submission rules.
I needed a shop system, so I made one. It's loosely based on Adiktus "Shop within a Shop"
This is a system that lets you add categories to a shop. Instead of having multiple shops, this system lets you give the illusion that there is only one shop.
It's easy to toggle between the main shop and the categories and each category can hold up to 10 items (11 if you hide the select hero button).
A description of how to implement it to your map is in the test map.

It's really simple, GUI, leakless and MUI.

Triggers
  • ShopSetup
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set ShopTable = (Last created hashtable)
      • -------- ShopUnitType is the main shop, the one you place on the map. --------
      • Set ShopUnitType = Shop
      • -------- ShopTotalCategories is the number of categories you want to have INCLUDING YOUR MAIN SHOP. --------
      • -------- So you set ShopTotalCategories to your number of categories plus one. --------
      • Set ShopTotalCategories = 3
      • -------- ShopCategory 1 is your main shop. --------
      • Set ShopCategory[1] = Shop
      • -------- The rest is your categories in numerical order. --------
      • Set ShopCategory[2] = Shop Category 1 (dummy)
      • Set ShopCategory[3] = Shop Category 2 (dummy)
      • -------- ShopSpell 1 is the spell you use for returning to the main shop. --------
      • Set ShopCategoryItem[1] = Return
      • -------- The rest is for the categories in numerical order. --------
      • Set ShopCategoryItem[2] = Category Weapon
      • Set ShopCategoryItem[3] = Category Armor
      • Trigger - Run ShopInit <gen> (ignoring conditions)
  • ShopInit
    • Events
    • Conditions
    • Actions
      • Set ShopTempGroup = (Units owned by Neutral Passive matching ((Unit-type of (Matching unit)) Equal to ShopUnitType))
      • Unit Group - Pick every unit in ShopTempGroup and do (Actions)
        • Loop - Actions
          • Set ShopTempUnit = (Picked unit)
          • Set ShopTempPoint = (Position of ShopTempUnit)
          • Set ShopInteger = (ShopInteger + 1)
          • Set ShopNumber[ShopInteger] = ShopTempUnit
          • Hashtable - Save ShopInteger as 0 of (Key (Picked unit)) in ShopTable
          • Custom script: if udg_ShopGroup[udg_ShopInteger] == null then
          • Custom script: set udg_ShopGroup[udg_ShopInteger] = CreateGroup()
          • Custom script: endif
          • Unit Group - Add ShopTempUnit to ShopGroup[ShopInteger]
          • Trigger - Add to ShopCategory <gen> the event (Unit - (Picked unit) Sells an item (from shop))
          • For each (Integer A) from 2 to ShopTotalCategories, do (Actions)
            • Loop - Actions
              • Unit - Create 1 ShopCategory[(Integer A)] for Neutral Passive at ShopTempPoint facing Default building facing degrees
              • Hashtable - Save ShopInteger as 0 of (Key (Last created unit)) in ShopTable
              • Unit Group - Add (Last created unit) to ShopGroup[ShopInteger]
              • Trigger - Add to ShopCategory <gen> the event (Unit - (Last created unit) Sells an item (from shop))
          • Custom script: call RemoveLocation(udg_ShopTempPoint)
      • Custom script: call DestroyGroup(udg_ShopTempGroup)
  • ShopCategory
    • Events
    • Conditions
    • Actions
      • Set ShopPlayer = (Owner of (Buying unit))
      • Set ShopPersonalInteger = (Load 0 of (Key (Selling unit)) from ShopTable)
      • For each (Integer A) from 1 to ShopTotalCategories, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Sold Item)) Equal to ShopCategoryItem[(Integer A)]
            • Then - Actions
              • Set ShopSoldCatNumber = (Integer A)
            • Else - Actions
      • Unit Group - Pick every unit in ShopGroup[ShopPersonalInteger] and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to ShopCategory[ShopSoldCatNumber]
            • Then - Actions
              • Selection - Select (Picked unit) for ShopPlayer
            • Else - Actions


Keywords:
Shop, Category, Categories,
Contents

Shop System 1.0 by Shoto (Map)

Reviews
Moderator
Simple GUI Shop System 1.02 | Reviewed by Maker | 20th Feb 2013 APPROVED This is a neat little system that allows the user to have more items per shop. Very useful, definitely recommended. A good addition to many maps. One thing you could add...
  1. Simple GUI Shop System 1.02 | Reviewed by Maker | 20th Feb 2013
    APPROVED
    This is a neat little system that allows the user to have more items per shop.
    Very useful, definitely recommended. A good addition to many maps.

    One thing you could add is Skip remaining actions when the correct
    shop category item and unit types are found.


    Old review

    Simple GUI Shop System 1.02 | Reviewed by Maker | 18th Feb 2013
    Needs Fix
    Required changes
    • Units of type x function leaks, don't use it
    • Destroy ShopTempGroup outside the unit group loop
    • If you have more than 2 shops, the system won't work by default.
      The shop groups are not created

     
  2. Chaosy

    Chaosy

    Joined:
    Jun 9, 2011
    Messages:
    10,699
    Resources:
    18
    Maps:
    1
    Spells:
    11
    Tutorials:
    6
    Resources:
    18
    post triggers plx.
    btw I dislike those shops :p
     
  3. maddeem

    maddeem

    Joined:
    Jan 1, 2011
    Messages:
    1,284
    Resources:
    5
    Maps:
    2
    Spells:
    3
    Resources:
    5
    Make the selection circle of the dummy equal to the selection circle of the shop, so that they look the same.
     
  4. Almia

    Almia

    Joined:
    Apr 24, 2012
    Messages:
    4,843
    Resources:
    35
    Spells:
    30
    Tutorials:
    4
    JASS:
    1
    Resources:
    35
    What about using AddItemToStock?

    Triggers
      • Init
        • Events
          • Time - Elapsed game time is 0.01 seconds
        • Conditions
        • Actions
          • Unit Group - Pick every unit in (Units of type Shop) and do (Actions)
            • Loop - Actions
              • Set TempPoint = (Position of (Picked unit))
              • Set ShopInteger = (ShopInteger + 1)
              • Set ShopNumber[ShopInteger] = (Picked unit)
              • Unit Group - Add (Picked unit) to ShopGroup[ShopInteger]
              • -------- Here, we create the dummy shops that hold items. --------
              • Unit - Create 1 Shop Category 1 (dummy) for Neutral Passive at TempPoint facing Default building facing degrees
              • Unit Group - Add (Last created unit) to ShopGroup[ShopInteger]
              • -------- Repeat these two steps for every category you're using. --------
              • Unit - Create 1 Shop Category 2 (dummy) for Neutral Passive at TempPoint facing Default building facing degrees
              • Unit Group - Add (Last created unit) to ShopGroup[ShopInteger]
              • Custom script: call RemoveLocation(udg_TempPoint)
      • Category 1
        • Events
          • Unit - A unit Starts the effect of an ability
        • Conditions
          • (Ability being cast) Equal to Category 1
        • Actions
          • For each (Integer A) from 1 to ShopInteger, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Casting unit) Equal to ShopNumber[(Integer A)]
                • Then - Actions
                  • Unit Group - Pick every unit in ShopGroup[(Integer A)] and do (Actions)
                    • Loop - Actions
                      • -------- The unit type and the cast spell must match! --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of (Picked unit)) Equal to Shop Category 1 (dummy)
                        • Then - Actions
                          • Selection - Select (Picked unit)
                        • Else - Actions
                • Else - Actions
      • Category 2
        • Events
          • Unit - A unit Starts the effect of an ability
        • Conditions
          • (Ability being cast) Equal to Category 2
        • Actions
          • For each (Integer A) from 1 to ShopInteger, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Casting unit) Equal to ShopNumber[(Integer A)]
                • Then - Actions
                  • Unit Group - Pick every unit in ShopGroup[(Integer A)] and do (Actions)
                    • Loop - Actions
                      • -------- The unit type and the cast spell must match! --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of (Picked unit)) Equal to Shop Category 2 (dummy)
                        • Then - Actions
                          • Selection - Select (Picked unit)
                        • Else - Actions
                • Else - Actions
      • Cancel
        • Events
          • Unit - A unit Starts the effect of an ability
        • Conditions
          • (Ability being cast) Equal to cancel
        • Actions
          • For each (Integer A) from 1 to ShopInteger, do (Actions)
            • Loop - Actions
              • Unit Group - Pick every unit in ShopGroup[(Integer A)] and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Picked unit) Equal to (Casting unit)
                    • Then - Actions
                      • Unit Group - Pick every unit in ShopGroup[(Integer A)] and do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Unit-type of (Picked unit)) Equal to Shop
                            • Then - Actions
                              • Selection - Select (Picked unit)
                            • Else - Actions
                    • Else - Actions

    Review:
    @Trigger Init
    -Cache picked unit to increase speed.Ex. set myunit = picked unit
    or just use this:
    • Set ShopInteger = (ShopInteger + 1)
    • Set ShopNumber[ShopInteger] = (Picked unit)
    • Set TempPoint = (Position of (ShopNumber[ShopInteger]))
    • Unit Group - Add (ShopNumber[ShopInteger]) to ShopGroup[ShopInteger]

    -Units of Type Shop leaks
    -0.01 loop is very fast,make it 0.03
    @Category 1
    -Use custom integer,then replace Integer A in case some trigger uses Integer A and accidentally collides w/ your system
    -Cache picked unit again
    @Category 2
    -Just like Category 1
    @Cancel
    -Cache picked unit
    -Use Triggering Unit instead of Casting Unit
    -You are enumarating (picking) the group inside the group
    Overall Review:
    -Add Prefixes(to prevent variable collision)
    -Add Return ability
    -Lacks Configuration

    Note:
    Configuration is a must.Configuration easily makes the users create their own w/o looking inside the object editor.Just like this:http://www.hiveworkshop.com/forums/spells-569/compressed-tavern-v1-4-a-223378/?prev=status=a&u=Almia
    Or this:
    http://www.hiveworkshop.com/forums/...d713672ee03eea635908ce5d9&dateline=1360745136

    I would like to suggest looking this:http://www.hiveworkshop.com/forums/general-mapping-tutorials-278/shop-within-shop-193048/
    w/c is faster than yours
     
  5. Shoto

    Shoto

    Joined:
    May 11, 2010
    Messages:
    276
    Resources:
    1
    Spells:
    1
    Resources:
    1
  6. Almia

    Almia

    Joined:
    Apr 24, 2012
    Messages:
    4,843
    Resources:
    35
    Spells:
    30
    Tutorials:
    4
    JASS:
    1
    Resources:
    35
    Im going to submit a much shorter,but heavy configurative system like yours.
    I have a deleted system but it is hard coded
     
  7. Shoto

    Shoto

    Joined:
    May 11, 2010
    Messages:
    276
    Resources:
    1
    Spells:
    1
    Resources:
    1
    I've uploaded an updated version.
    Here are the new triggers:

    Triggers
    Setup
    • Setup
      • Events
        • Time - Elapsed game time is 0.01 seconds
      • Conditions
      • Actions
        • -------- ShopUnitType is the main shop, the one you place on the map. --------
        • Set ShopUnitType = Shop
        • -------- ShopTotalCategories is the number of categories you want to have INCLUDING YOUR MAIN SHOP. --------
        • -------- So you set ShopTotalCategories to your number of categories plus one. --------
        • Set ShopTotalCategories = 3
        • -------- ShopCategory 1 is your main shop. --------
        • Set ShopCategory[1] = Shop
        • -------- The rest is your categories in numerical order. --------
        • Set ShopCategory[2] = Shop Category 1 (dummy)
        • Set ShopCategory[3] = Shop Category 2 (dummy)
        • -------- ShopSpell 1 is the spell you use for returning to the main shop. --------
        • Set ShopSpell[1] = Return
        • -------- The rest is for the categories in numerical order. --------
        • Set ShopSpell[2] = Category 1
        • Set ShopSpell[3] = Category 2
        • Trigger - Run Init <gen> (ignoring conditions)
    Init
    • Init
      • Events
      • Conditions
      • Actions
        • Set ShopTempGroup = (Units of type ShopUnitType)
        • Unit Group - Pick every unit in ShopTempGroup and do (Actions)
          • Loop - Actions
            • Set ShopTempUnit = (Picked unit)
            • Set ShopTempPoint = (Position of ShopTempUnit)
            • Set ShopInteger = (ShopInteger + 1)
            • Set ShopNumber[ShopInteger] = ShopTempUnit
            • For each (Integer A) from 2 to ShopTotalCategories, do (Actions)
              • Loop - Actions
                • Unit - Add ShopSpell[(Integer A)] to ShopTempUnit
            • Unit Group - Add ShopTempUnit to ShopGroup[ShopInteger]
            • For each (Integer A) from 2 to ShopTotalCategories, do (Actions)
              • Loop - Actions
                • Unit - Create 1 ShopCategory[(Integer A)] for Neutral Passive at ShopTempPoint facing Default building facing degrees
                • Unit - Add ShopSpell[1] to (Last created unit)
                • Unit Group - Add (Last created unit) to ShopGroup[ShopInteger]
            • Custom script: call RemoveLocation(udg_ShopTempPoint)
            • Custom script: call DestroyGroup(udg_ShopTempGroup)
    Category Clicked
    • Category Clicked
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
      • Actions
        • For each (Integer A) from 1 to ShopTotalCategories, do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Or - Any (Conditions) are true
                  • Conditions
                    • (Unit-type of (Casting unit)) Equal to ShopUnitType
                    • (Unit-type of (Casting unit)) Equal to ShopCategory[(Integer A)]
              • Then - Actions
                • Trigger - Run Select Shop <gen> (checking conditions)
              • Else - Actions
    Select Shop
    • Select Shop
      • Events
      • Conditions
      • Actions
        • For each (Integer A) from 1 to ShopTotalCategories, do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Ability being cast) Equal to ShopSpell[(Integer A)]
              • Then - Actions
                • Set ShopCastSpellNumber = (Integer A)
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • ShopCastSpellNumber Equal to 1
                  • Then - Actions
                    • For each (Integer A) from 1 to ShopInteger, do (Actions)
                      • Loop - Actions
                        • Unit Group - Pick every unit in ShopGroup[(Integer A)] and do (Actions)
                          • Loop - Actions
                            • Set ShopTempUnit = (Picked unit)
                            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                              • If - Conditions
                                • ShopTempUnit Equal to (Casting unit)
                              • Then - Actions
                                • Selection - Select ShopNumber[(Integer A)]
                              • Else - Actions
                  • Else - Actions
                    • For each (Integer A) from 1 to ShopInteger, do (Actions)
                      • Loop - Actions
                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • (Casting unit) Equal to ShopNumber[(Integer A)]
                          • Then - Actions
                            • Unit Group - Pick every unit in ShopGroup[(Integer A)] and do (Actions)
                              • Loop - Actions
                                • Set ShopTempUnit = (Picked unit)
                                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                  • If - Conditions
                                    • (Unit-type of ShopTempUnit) Equal to ShopCategory[ShopCastSpellNumber]
                                  • Then - Actions
                                    • Selection - Select ShopTempUnit
                                  • Else - Actions
                          • Else - Actions
              • Else - Actions

    (Did i just put hiddens in hiddens? We need to go deeper)

    However, I'm unsure about the function
    • Selection - Select Unit

    Does it select the unit for all players? Because if it does I'd need to use "select unit for player" but i'm not sure how to refer to the clicking player. Both "Triggering Player" and "Owner of Triggering unit" returns Player 16, owner of the shop.
     
  8. Almia

    Almia

    Joined:
    Apr 24, 2012
    Messages:
    4,843
    Resources:
    35
    Spells:
    30
    Tutorials:
    4
    JASS:
    1
    Resources:
    35
  9. Shoto

    Shoto

    Joined:
    May 11, 2010
    Messages:
    276
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Remade the system, inspired by Shop within a Shop. The description has been updated and new test map is up.

    @Almia: Encapsulation method is Jass, wich i don't do. I do GUI. This spell is categorised as GUI and as such I do not intend to make it Jass.
     
  10. Almia

    Almia

    Joined:
    Apr 24, 2012
    Messages:
    4,843
    Resources:
    35
    Spells:
    30
    Tutorials:
    4
    JASS:
    1
    Resources:
    35
    You can do it via GUI.Using run trigger actions
     
  11. Shoto

    Shoto

    Joined:
    May 11, 2010
    Messages:
    276
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Fix'd. Happy now? :p
     
    Last edited: Feb 19, 2013
  12. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,181
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    You could improve the description. Describe what does the system do, how can users take advantage of it and how it is useful.