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!
Set TempGroup = (Units in (Playable map area) matching ((((Triggering unit) is A Hero) Equal to False) and ((Owner of (Matching unit)) Equal to Player 1 (Red))))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in TempGroup) Greater than 0
Then - Actions
-------- add your action here --------
Else - Actions
it requires a Unit Group variable, currently it checks only for Player 1 (red), specified region can be changed, initially set as Playable Map Area.
trigger event is emptied so add your own event, whether it check periodically or certain circumstance.
trigger not optimized to be leak free, do it yourself
You're going to want to use a loop.
I don't have WE. but just look over this pseudo and try to implement it.
For Each TempInteger from 1 to 12
Set TempPlayer == Player(TempInteger)
Set TempGroup == Units in yourRegion matching condition (Matching Unit is not a Hero) and (Matching Unit is owned by TempPlayer)
Pick every unit in TempGroup and do actions
--Do what you'd like to do them--such as move them, give them HP, whatever.
custom script: call DestroyGroup(udg_TempGroup)
TempGroup == Unit Group Variable
TempPlayer == Player
TempInteger == Integer
yourRegion is either a preplaced Region or one that you created during gameplay. If each player has a specific region you're checking, you should save the regions like this:
PlayerRegions[1] == NameofPlayer1Region <gen>
PlayerRegions[2] == NameofPlayer2Region <gen>
The event is for you to decide for whenever or under what circumstances you'd like this to fire.
what your trigger does is doing action with all units in certain region owned by all players by looping on each player. it doesn't check if the unitgroup is empty or in other words there is no units owned by that certain player in the region which is different than what the question is.
The question is "Checking if region has non-hero units owned by player"
I take this to mean the OP's asking to check if there are non-hero units in a region for whichever player, do X, Y, and Z. If there are not any units in that region, none of the actions will happen. There is no need to check if the group is empty.
I believe the OP was having difficulty with creating the unit group to then sort through and do actions with, not with checking for units within that group.
set boolean = false
pick units in region
--loop
----if (conditions)
------picked unit is hero equal to false
------*some player condition(s) that you need*
----then
------set boolean = true
--endloop
if boolean == true then *units in region*
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.