Uncle
Warcraft Moderator
- Joined
- Aug 10, 2018
- Messages
- 7,866
Edit:
Here's the solution i'm going with now. Using dummy units for every type of Shop would be a lot easier than this workaround, but I don't want dummy units. Will hiding/unhiding units like this cause any issues? It appears to work fine ingame.
Let's say there's a Goblin Merchant pre-placed on the map. The trigger works like this:
1) You select the Goblin Merchant
2) The Goblin Merchant and nearby units are hidden
3) A copy of the Goblin Merchant is created on top of it
4) The hidden units are all un-hidden
5) The copy or "Dummy" as I refer to it has it's size set to 1% so you can't see it or select it
6) The game automatically selects the "dummy" shop
This gives the illusion that you're still selecting the Goblin Merchant, but you're really selecting
a shop hidden underneath it.
Note:
The only reason I have to hide ALL nearby units is because of player-built shops like Arcane Vault having "Placement Requires: Buildable". This one field messes things up. A pre-placed shop like a Goblin Merchant doesn't have any problems and you don't actually have to hide/unhide anything for it to work.
So don't even bother with this if you're solely working with pre-placed shops.
Here's the solution i'm going with now. Using dummy units for every type of Shop would be a lot easier than this workaround, but I don't want dummy units. Will hiding/unhiding units like this cause any issues? It appears to work fine ingame.
-
Select Shop Copy
-
Events
-
Player - Player 1 (Red) Selects a unit
-
-
Conditions
-
Actions
-
Set ushop_SelectUnit = (Triggering unit)
-
Set ushop_tempPlayer = (Triggering player)
-
-------- - --------
-
Set ushop_tempPoint[0] = (Position of ushop_SelectUnit)
-
-------- - --------
-
Set ushop_HideGroup = (Units within 400.00 of ushop_tempPoint[0])
-
Unit Group - Pick every unit in ushop_HideGroup and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Picked unit) is A flying unit) Equal to False
-
((Picked unit) is hidden) Equal to False
-
((Picked unit) is alive) Equal to True
-
-
Then - Actions
-
Unit - Hide (Picked unit)
-
-
Else - Actions
-
-
-
-
-------- - --------
-
Unit - Create 1 (Unit-type of ushop_SelectUnit) for ushop_tempPlayer at ushop_tempPoint[0] facing Default building facing degrees
-
Set ushop_ShopDummy[(Player number of ushop_tempPlayer)] = (Last created unit)
-
Set ushop_tempUnit = (Last created unit)
-
-------- - --------
-
Unit - Add Select Hero to ushop_tempUnit
-
Unit - Add Sell Items to ushop_tempUnit
-
Unit - Add Invulnerable (Neutral) to ushop_tempUnit
-
Animation - Change ushop_tempUnit's size to (1.00%, 1.00%, 1.00%) of its original size
-
-------- - --------
-
Unit Group - Pick every unit in ushop_HideGroup and do (Actions)
-
Loop - Actions
-
Unit - Unhide (Picked unit)
-
-
-
Custom script: call DestroyGroup (udg_ushop_HideGroup)
-
-------- - --------
-
Selection - Select ushop_tempUnit for ushop_tempPlayer
-
-
Let's say there's a Goblin Merchant pre-placed on the map. The trigger works like this:
1) You select the Goblin Merchant
2) The Goblin Merchant and nearby units are hidden
3) A copy of the Goblin Merchant is created on top of it
4) The hidden units are all un-hidden
5) The copy or "Dummy" as I refer to it has it's size set to 1% so you can't see it or select it
6) The game automatically selects the "dummy" shop
This gives the illusion that you're still selecting the Goblin Merchant, but you're really selecting
a shop hidden underneath it.
Note:
The only reason I have to hide ALL nearby units is because of player-built shops like Arcane Vault having "Placement Requires: Buildable". This one field messes things up. A pre-placed shop like a Goblin Merchant doesn't have any problems and you don't actually have to hide/unhide anything for it to work.
So don't even bother with this if you're solely working with pre-placed shops.
Attachments
Last edited: