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!
I want to check all the hero units controlled by all players to see if they have a specific item, how should I do that? Is there a function for that?
Thanks all.
This is probably what you're looking for. Claws of Attack is just whatever Item you're looking for. I assumed you wanted to give it to them if they don't have it. That's the purpose of the Boolean and the If
EDIT:
Actions
Do Multiple ActionsFor each (Integer TempInteger) from 1 to 12, do (Actions)
Loop - Actions
Set TempBoolean = False
Set TempPlayer = (Player(TempInteger))
Set TempGroup = (Units owned by TempPlayer matching ((((Matching unit) is A Hero) Equal to (==) True) and (((Matching unit) has an item of type Claws of Attack +15) Equal to (==) True)))
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(TempGroup is empty) Equal to (==) True
Then - Actions
Set TempBoolean = True
Else - Actions
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
TempBoolean Equal to (==) True
Then - Actions
Else - Actions
Set TempUnit = (Random unit from TempGroup)
Hero - Create Claws of Attack +15 and give it to TempUnit
This is probably what you're looking for. Claws of Attack is just whatever Item you're looking for. I assumed you wanted to give it to them if they don't have it. That's the purpose of the Boolean and the If
EDIT:
Actions
Do Multiple ActionsFor each (Integer TempInteger) from 1 to 12, do (Actions)
Loop - Actions
Set TempBoolean = False
Set TempPlayer = (Player(TempInteger))
Set TempGroup = (Units owned by TempPlayer matching ((((Matching unit) is A Hero) Equal to (==) True) and (((Matching unit) has an item of type Claws of Attack +15) Equal to (==) True)))
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(TempGroup is empty) Equal to (==) True
Then - Actions
Set TempBoolean = True
Else - Actions
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
TempBoolean Equal to (==) True
Then - Actions
Else - Actions
Set TempUnit = (Random unit from TempGroup)
Hero - Create Claws of Attack +15 and give it to TempUnit
Thanks a lot. This is better than the method I am using right now, which is to check all the units within a certain range. LOL
Edit:
@Maker, after further looked into your code I got a question: is the first custom script an unfinished line? Why use "GetHandleId(...) ==49"? Does it point to the first event ---> a unit acquiring an item?
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.