Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
Originally by ALiEN95, who's offline since 2011, but after changes with Reforged it wasn't working anymore. Original system here.
So for his amazing work not to be lost, I fixed it for the latest Warcraft 3 Reforged versions.
Features
- This system allows you to create lists/sections in shops, and thus increases the max of items per shop from 11 to 121, and even 144 if you remove the cancel buttons.
Technical features
- MUI
- Leak-less
- Works fine for multiplayer, and any number of shops.
How to Install
- Make sure you checked "Automatically create unknown variables while pasting trigger data" in the world editor settings.
- Copy/paste the trigger folder "Shop Lists" from the attached map.
- Copy paste the 2 abilities "Select Hero [Arrow]" and "Select Hero [No Arrow]" from the attached map.
- Copy/paste a [List Xxxx] unit from the attached map, and create your own lists by setting the items they sell. Then set them as the unit sold by your shop.
- Check/fix the abilities ids in the triggers & List units ability list for "Select Hero [Arrow]" and "Select Hero [No Arrow]".
- For each shop, on map init or when it's created, apply the following trigger code to set up the dummy units for each section:
ShopSetup
Events
Conditions
Actions
Set VariableSet UNIT = <shop>
Set VariableSet POINT = (Position of (Last created unit))
Unit - Create 1 [List 1 Books] for Neutral Hostile at POINT facing Default building facing degrees
Unit - Set Unit: (Last created unit)'s Real Field: Selection Scale ('ussc') to Value: (Unit: UNIT's Real Field: Selection Scale ('ussc'))
Unit - Create 1 [List 2 Swords] for Neutral Hostile at POINT facing Default building facing degrees
Unit - Set Unit: (Last created unit)'s Real Field: Selection Scale ('ussc') to Value: (Unit: UNIT's Real Field: Selection Scale ('ussc'))
Unit - Create 1 [List 3 Rings] for Neutral Hostile at POINT facing Default building facing degrees
Unit - Set Unit: (Last created unit)'s Real Field: Selection Scale ('ussc') to Value: (Unit: UNIT's Real Field: Selection Scale ('ussc'))
Custom script: call RemoveLocation(udg_POINT)
Alternatively you can set the "Selection Scale" as fixed in the WE object editor.
Open List
Events
Unit - A unit Sells a unit
Conditions
(Level of Select Hero [Arrow] for (Triggering unit)) Not equal to 0
Actions
-------- Open List --------
Set VariableSet TYPE = (Unit-type of (Sold unit))
Unit - Remove (Sold unit) from the game
Set VariableSet POINT = (Position of (Triggering unit))
Set VariableSet UG = (Units within 0.01 of POINT matching ((Unit-type of (Matching unit)) Equal to TYPE).)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in UG) Equal to 1
Then - Actions
Set VariableSet UNIT = (Random unit from UG)
Selection - Select UNIT for (Owner of (Buying unit))
Else - Actions
Custom script: call DestroyGroup(udg_UG)
Custom script: call RemoveLocation(udg_POINT)
Events for Cancel List ESC
Events
Map initialization
Conditions
Actions
Player Group - Pick every player in (All players) and do (Actions)
Loop - Actions
Trigger - Add to Cancel List ESC <gen> the event (Player - (Picked player) skips a cinematic sequence)
Cancel List ESC
Events
Conditions
Actions
-------- Cancel List --------
Set VariableSet UG = (Units in (Entire map) matching ((((Matching unit) is selected by (Triggering player).) Equal to True) and ((Level of Select Hero [No Arrow] for (Matching unit)) Not equal to 0)))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in UG) Equal to 1
Then - Actions
Set VariableSet UNIT = (Random unit from UG)
Set VariableSet POINT = (Position of UNIT)
Custom script: call DestroyGroup(udg_UG)
Set VariableSet UG = (Units within 0.01 of POINT matching ((Level of Select Hero [Arrow] for (Matching unit)) Not equal to 0).)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in UG) Equal to 1
Then - Actions
Set VariableSet UNIT = (Random unit from UG)
Selection - Select UNIT for (Triggering player)
Else - Actions
Custom script: call RemoveLocation(udg_POINT)
Else - Actions
-------- Player is not in a shop category --------
Custom script: call DestroyGroup(udg_UG)
Cancel List Item
Events
Unit - A unit Sells an item (from shop)
Conditions
(Item-type of (Sold Item)) Equal to Cancel
Actions
-------- Cancel List --------
Set VariableSet POINT = (Position of (Triggering unit))
Set VariableSet UG = (Units within 0.01 of POINT matching ((Level of Select Hero [Arrow] for (Matching unit)) Not equal to 0).)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in UG) Equal to 1
Then - Actions
Set VariableSet UNIT = (Random unit from UG)
Selection - Select UNIT for (Owner of (Buying unit))
Else - Actions
Custom script: call DestroyGroup(udg_UG)
Custom script: call RemoveLocation(udg_POINT)
v2.00:
- Added the abilities "Invulnerable" & "Sell items" to the list dummy units.
- Fixed 1 unit leak in "Open List" trigger.
- Set the dummy units selection scale (i.e. selection circle) equal to the one of the original shop (cosmetics).
- Removed "Pathing placement requires = buildable" from the list dummy units, otherwise since patch 1.32 (Reforged) it offset their position and bugged the system.
- Replaced "Selection - Select unit group for player" by the selection of a single unit, because it causes systematic desync in multiplayer since patch 1.32 (Reforged).
Set VariableSet UG = (Units in (Entire map) matching ((((Matching unit) is selected by (Triggering player).) Equal to True) and ((Level of Select Hero [No Arrow] for (Matching unit)) Not equal to 0)))
This action in Cancel List ESC is very...
Set VariableSet UG = (Units in (Entire map) matching ((((Matching unit) is selected by (Triggering player).) Equal to True) and ((Level of Select Hero [No Arrow] for (Matching unit)) Not equal to 0)))
This action in Cancel List ESC is very demanding (very bad for performance), you could just add "main shops" to a group manually, and then pick every one from there.
The variable names are too generic and there's a good probability of clashing if a user imports this. SL_Unit instead of UNIT is a better name (SL as in Shop List).
Aside from that, the idea is similar to another resource, however this has its own uniqueness and it's for GUI while the other one is for JASS/vJASS.
Set VariableSet UG = (Units in (Entire map) matching ((((Matching unit) is selected by (Triggering player).) Equal to True) and ((Level of Select Hero [No Arrow] for (Matching unit)) Not equal to 0)))
This action in Cancel List ESC is very demanding (very bad for performance), you could just add "main shops" to a group manually, and then pick every one from there.
The variable names are too generic and there's a good probability of clashing if a user imports this. SL_Unit instead of UNIT is a better name (SL as in Shop List).
Aside from that, the idea is similar to another resource, however this has its own uniqueness and it's for GUI while the other one is for JASS/vJASS.
Very good points about variables name being too generic for globals. I'll rename it.
About the "Pick units in (entire map) matching Condition" you also have a good points. First:
It made me figure that I leak a few units if the shops are killed/removed. I'll expose a "Unregister Shop" trigger for that (and the example of how to call it on unit death or deindex event).
Saving a group of existing shops means to handle their life-cycle if they're not invulnerable/staying untill the map end (groups with removed units, or loop to refresh the group, or adding a dependence to an indexer).
A good alternative could be to use "Pick units selected by (triggering player)" then "Pick every unit in group and do actions" to check the condition:
ESC Key Pressed
Events
Conditions
Actions
-------- Retrieve the selected item-list unit and set id to ShopLists_TempUnit --------
Set VariableSet ShopLists_TempUnitGroup = (Units currently selected by (Triggering player))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in ShopLists_TempUnitGroup) Equal to 1
Then - Actions
Set VariableSet ShopLists_TempUnit = (Random unit from ShopLists_TempUnitGroup)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Select Hero [No Arrow] for ShopLists_TempUnit) Greater than 0
Then - Actions
-------- The player selection is an item-list unit --------
Set VariableSet ShopLists_TempPlayer = (Triggering player)
Trigger - Run Exist List <gen> (ignoring conditions)
Else - Actions
-------- The player selection is something else. Just clear temp variables --------
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.