• 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!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Why i cannot detect no unit within group?

Level 18
Joined
Jun 2, 2009
Messages
1,233
  • CrushRun
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set TempPointCrush = (Position of crush_caster)
      • Set TempPointCrush2 = (TempPointCrush offset by 30.00 towards (Angle from TempPointCrush to CrushTargetPoint) degrees)
      • Animation - Play Faceless Hunter Kam Ghoststeer 0003 <gen>'s spell animation
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Integer((Distance between TempPointCrush and CrushTargetPoint))) Less than or equal to 64
        • Then - Actions
          • Set TempGroupCrush = (Units within 100.00 of TempPointCrush)
          • Unit Group - Pick every unit in TempGroupCrush and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (crush_caster belongs to an enemy of (Owner of (Picked unit))) Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in TempGroupCrush) Greater than 0
                    • Then - Actions
                      • Unit - Cause crush_caster to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Magic
                      • Special Effect - Create a special effect at TempPointCrush2 using Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Game - Display to (All players) for 1.00 seconds the text: (Name of (Picked unit))
                    • Else - Actions
                      • Game - Display to (All players) for 1.00 seconds the text: NO TARGET
                • Else - Actions
          • Unit - Turn collision for crush_caster On
          • Unit - Unpause crush_caster
          • Animation - Change crush_caster's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
          • Custom script: call DestroyGroup(udg_TempGroupCrush)
          • Custom script: call RemoveLocation(udg_CrushTargetPoint)
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Unit - Move crush_caster instantly to TempPointCrush2
      • Custom script: call RemoveLocation(udg_TempPointCrush)
      • Custom script: call RemoveLocation(udg_TempPointCrush2)
Bottom of the trigger.

  • Game - Display to (All players) for 1.00 seconds the text: (Name of (Picked unit))
  • Else - Actions
    • Game - Display to (All players) for 1.00 seconds the text: NO TARGET
When i cast it on empty area, i cannot get the NO TARGET message.
What am i missing in here?
 
Level 24
Joined
Feb 27, 2019
Messages
833
How many times do you get this message if you cast it on 5 enemies?
  • Game - Display to (All players) for 1.00 seconds the text: (Name of (Picked unit))
How many times do you get it if you cast it on 2 enemies?
What do you think will happen if you tried to display this message when casting it on 0 enemies?
  • Game - Display to (All players) for 1.00 seconds the text: NO TARGET
 
Level 24
Joined
Feb 27, 2019
Messages
833
Do you understand that everything that happens in the red field in the image happens for every unit in the unit group? So if there are 5 units in the unit group, the actions in red occur 5 times. If there are 0 units in the unit group the actions in red occur 0 times. Does that make sense?
 

Attachments

  • 11.png
    11.png
    22.2 KB · Views: 8
Level 24
Joined
Feb 27, 2019
Messages
833
You already know how to check. The red parts of the picture is the parts required to check how many units are in the unit group. THE PROBLEM is that these actions dont run because of what I explained earlier. What you need to do is to make a copy of these red parts and put them OUTSIDE "Unit Group - Pick every unit in TempGroupCrush and do (Actions)"
 

Attachments

  • 33.png
    33.png
    14.1 KB · Views: 7
Level 13
Joined
Feb 5, 2018
Messages
567
  • x23eds23as
    • Events
    • Conditions
    • Actions
      • Set VariableSet TempCroushPoint = (Position of (Triggering unit))
      • Set VariableSet TempCrushGroup = (Units within 100.00 of TempCroushPoint.)
      • -------- ADD THIS BEFORE "Pick every unit in unit group) --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempCrushGroup) Equal to 0
        • Then - Actions
          • Game - Display to (All players) the text: NO TARGET
        • Else - Actions
      • Unit Group - Pick every unit in TempCrushGroup and do (Actions)
        • Loop - Actions
          • -------- Your actions --------
Also you are missing filters for the damage targets, meaning that the charging unit will damage himself and allied units if there any.

The message you are trying to display is never ran, BECAUSE THE ACTION WILL NOT RUN IF THE UNIT GROUP IS EMPTY. Which means the conditions are never checked. Add the line in my example trigger above the "Pick units in unit group" function.
 
Level 18
Joined
Jun 2, 2009
Messages
1,233
  • x23eds23as
    • Events
    • Conditions
    • Actions
      • Set VariableSet TempCroushPoint = (Position of (Triggering unit))
      • Set VariableSet TempCrushGroup = (Units within 100.00 of TempCroushPoint.)
      • -------- ADD THIS BEFORE "Pick every unit in unit group) --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempCrushGroup) Equal to 0
        • Then - Actions
          • Game - Display to (All players) the text: NO TARGET
        • Else - Actions
      • Unit Group - Pick every unit in TempCrushGroup and do (Actions)
        • Loop - Actions
          • -------- Your actions --------
Also you are missing filters for the damage targets, meaning that the charging unit will damage himself and allied units if there any.

The message you are trying to display is never ran, BECAUSE THE ACTION WILL NOT RUN IF THE UNIT GROUP IS EMPTY. Which means the conditions are never checked. Add the line in my example trigger above the "Pick units in unit group" function.
Thank you for your help. Solved.
But still i wonder why Else not works. This is how i learned.

Condition
Then = If the conditions are met
Else = If the conditions ARE NOT MET

My action can detect Then. That means if requirements are not met, they will go for the Else?

About the missing filters, i have not shared the first trigger.
 
Level 13
Joined
Feb 5, 2018
Messages
567
Unit Group - Pick every unit in TempGroupCrush and do (Actions)
It does'nt run, because if there are no units in the group the action has no target to run for. "Pick every unit in unit group and do actions" will not result into anything if there are no units.

Meaning everything below this is never executed in the map code. Hope this sheds some light to you :)
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
Will you be willing to totally ignore finding the solution to your problem for a moment and fully focus on understanding a few actions instead?

Okay, lets start, do you know what an action is?
@JFAMAP Do not ignore this. We know you have a language barrier, and Duck is trying to help you to understand something very important and simple that you are confused about.

We do this same dance with you in every one of your threads, so I guess this is nothing new. (It’s an English phrase that means “the same sequence of events happens again and again.”)
 
Level 18
Joined
Jun 2, 2009
Messages
1,233
@JFAMAP Do not ignore this. We know you have a language barrier, and Duck is trying to help you to understand something very important and simple that you are confused about.

We do this same dance with you in every one of your threads, so I guess this is nothing new. (It’s an English phrase that means “the same sequence of events happens again and again.”)
Doomblade solved my issue by typing less than anyone else. I have asked, he showed how to do. Solved.

But you are trying to force me to understand that something i am not capable at it. Think about it. If it was easy like this, i would have not asked it in the first place. "Why this guy asking this? Because he does not know"

What is the 10+10? I need the answer for my trigger.

The answer i am expecting: 20.

The answer i get: Look there are 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 in there and it means 10. Now there are other 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 and it means 10. Now what do you think about the answer JFAMAP?

If i need the details, i can ask and expect explanation about that. Here is the wonderful example.

DoomBlade answered my question. It is solved. But this time i have asked for details.

JFAMAP Thank you for your help. Solved.
But still i wonder why Else not works. This is how i learned.

Condition
Then = If the conditions are met
Else = If the conditions ARE NOT MET

My action can detect Then. That means if requirements are not met, they will go for the Else?

About the missing filters, i have not shared the first trigger.
As you can see, i can ask more if i want to learn details.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
Doomblade solved my issue by typing less than anyone else. I have asked, he showed how to do. Solved.
That’s not using Hive as a resource to become a better mapmaker. That’s literally having users of this site make your map for you.
The answer i am expecting: 20.

The answer i get: Look there are 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 in there and it means 10. Now there are other 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 and it means 10. Now what do you think about the answer JFAMAP?
I get that it’s “more” than you expect in return, but bro…. That’s because when you have made an error that causes your triggers not to work as you expect, we hope to teach you something. We want you to understand why your trigger does the things it does when it runs so that you do not continue to make the same error again in the future.
As you can see, i can ask more if i want to learn details.
Yes I do see that and I appreciate that you continued to think about it. That is essentially all I am hoping that you do.

However, Duck tried three different times to explain that the problem is not with the If/Then/Else block behaving unusually but is instead with your understanding of the Pick Every Unit in <Group> and do (Actions) action.

When he saw that you did not understand he attempted to work up to a full and complete explanation starting from the very beginning of “what is an action?”
 
Level 18
Joined
Jun 2, 2009
Messages
1,233
All of you trying to help me. I am sure about that. But you have to understand what i feel. I am trying to get "exact" answer. That means i do not understand. And if you continue forcing me for the understand the things i am not capable of it. I am giving up.
 
Top