• 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.

UnitGroup selects all units despite conditions?

Status
Not open for further replies.
I really wish i didnt have to come here for help this often but hey, shows how rocky this learning process is. So, i got this spell called VolcanicArmor (refered to as VA_ in triggers) that deals damage to all enemyes around when the hero is hit at 25% chance, its similiar to axe E from DOTA but it scales with strength. Now, the problem im having here is that it hits ALL units. Owned, Allied, Enemy. All of them. But in the pick units line i added the conditions (owner of attacking unit is enemy with owner of attacked unit) yet the group selector still picks ALL possible units and does the dmg to them. And on top of that, it also spawns the Special Effect boom on units that already died, despite the condition Is alive = True in there. Anyone got any idea how to fix dis?

Here be the Trigger:

  • VolcanicArmor
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacked unit) is A Hero) Equal to True
      • ((Attacked unit) has buff Volcanic Armor (caster)) Equal to True
    • Actions
      • Set VariableSet VA_Chance = (Random integer number between 1 and 100)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • VA_Chance Less than or equal to 25
        • Then - Actions
          • Set VariableSet Strength = (Strength of (Attacked unit) (Include bonuses))
          • Set VariableSet RealAttribute = (Real(Strength))
          • Unit Group - Pick every unit in (Units within 300.00 of (Position of (Attacked unit)) matching (((Owner of (Attacking unit)) is an enemy of (Owner of (Attacked unit)).) Equal to True).) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (((Triggering unit) is A structure) Equal to False) and ((((Triggering unit) is alive) Equal to True) and (((Triggering unit) is Magic Immune) Equal to False))
                • Then - Actions
                  • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Other\Incinerate\FireLordDeathExplode.mdl
                  • Set VariableSet VA_Blast = (Last created special effect)
                • Else - Actions
                  • Do nothing
          • Set VariableSet VA_UnitGroup = (Last created unit group)
          • Unit - Cause (Triggering unit) to damage circular area after 0.00 seconds of radius 300.00 at (Position of (Triggering unit)), dealing ((RealAttribute x 0.25) x (Real((Level of Volcanic Armor for (Triggering unit))))) damage of attack type Spells and damage type Fire
          • Wait 0.10 seconds
          • Special Effect - Destroy VA_Blast
          • Unit Group - Remove all units from VA_UnitGroup.
          • Trigger - Turn off (This trigger)
          • Wait 2.00 seconds
          • Trigger - Turn on (This trigger)
        • Else - Actions
          • Do nothing
 
Level 6
Joined
Dec 31, 2017
Messages
138
Triggering unit, Attacking unit and Attacked unit are event responsces.
Here Triggering unit = Attacked unit = "Axe".
Attacked unit = unit that has attacked "Axe".

So this:
  • Unit Group - Pick every unit in (Units within 300.00 of (Position of (Attacked unit)) matching (((Owner of (Attacking unit)) is an enemy of (Owner of (Attacked unit)).) Equal to True).) and do (Actions)
picks all units for which it is true that ("Axe" is an enemy of what attacked "Axe"). And it is true for all the units in the area. Instead, you could check if ("Axe" is an enemy of a unit that was picked). So
  • Unit Group - Pick every unit in (Units within 300.00 of (Position of (Attacked unit)) matching (((Owner of (Matching unit)) is an enemy of (Owner of (Attacked unit)).) Equal to True).) and do (Actions)
Same thing happens inside the loop.
Replace (Triggering unit) with (Picked unit).
 
Triggering unit, Attacking unit and Attacked unit are event responsces.
Here Triggering unit = Attacked unit = "Axe".
Attacked unit = unit that has attacked "Axe".

So this:
  • Unit Group - Pick every unit in (Units within 300.00 of (Position of (Attacked unit)) matching (((Owner of (Attacking unit)) is an enemy of (Owner of (Attacked unit)).) Equal to True).) and do (Actions)
picks all units for which it is true that ("Axe" is an enemy of what attacked "Axe"). And it is true for all the units in the area. Instead, you could check if ("Axe" is an enemy of a unit that was picked). So
  • Unit Group - Pick every unit in (Units within 300.00 of (Position of (Attacked unit)) matching (((Owner of (Matching unit)) is an enemy of (Owner of (Attacked unit)).) Equal to True).) and do (Actions)
Same thing happens inside the loop.
Replace (Triggering unit) with (Picked unit).

Does this apply to all such cases?? here for example is a trigger that is supposed to make a Thunder Clap spell into a Taunting ability but it wont work, and i dunno why when the picked units thing should be okay

  • ScatterAshTaunt
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Thunder Clap
    • Actions
      • Unit Group - Pick every unit in (Units within 350.00 of (Position of (Casting unit)) matching ((Owner of (Picked unit)) Equal to (Random player from (All enemies of (Owner of (Casting unit)).))).) and do (Actions)
        • Loop - Actions
          • Set VariableSet SA_UnitGroup = (Last created unit group)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (((Picked unit) is A structure) Equal to False) and ((((Picked unit) is alive) Equal to True) and (((Picked unit) is Magic Immune) Equal to False))
            • Then - Actions
              • Unit - Order (Picked unit) to Attack (Casting unit)
            • Else - Actions
              • Do nothing
      • Unit Group - Remove all units from SA_UnitGroup.
 
Level 6
Joined
Dec 31, 2017
Messages
138
  • Unit Group - Pick every unit in (Units within 350.00 of (Position of (Casting unit)) matching ((Owner of (Picked unit)) Equal to (Random player from (All enemies of (Owner of (Casting unit)).))).) and do (Actions)
This line contains 2 mistakes.
1. When we use "... matching (Condition)" costructions, we refer to each unit as (Matching unit) not as (Picked unit).
2. "(Random player from (All enemies of (Owner of (Casting unit)).))" - this exprassion does:
  • Find casting (Casting unit)
  • Find it's owner
  • Find All enemies of the owner
  • Pick Random one
If owner of (Picked Matching unit) has multiple enemies, no gurantee RNG picks the right one.

Correct expression would be:
...matching (((Owner of (Matching unit)) is an enemy of (Owner of (Casting unit))) equal True)) and do (Actions)
This condition can be found under: Boolean Comparison -> Player - Player is An enemy of Player.
 
  • Unit Group - Pick every unit in (Units within 350.00 of (Position of (Casting unit)) matching ((Owner of (Picked unit)) Equal to (Random player from (All enemies of (Owner of (Casting unit)).))).) and do (Actions)
This line contains 2 mistakes.
1. When we use "... matching (Condition)" costructions, we refer to each unit as (Matching unit) not as (Picked unit).
2. "(Random player from (All enemies of (Owner of (Casting unit)).))" - this exprassion does:
  • Find casting (Casting unit)
  • Find it's owner
  • Find All enemies of the owner
  • Pick Random one
If owner of (Picked Matching unit) has multiple enemies, no gurantee RNG picks the right one.

Correct expression would be:
...matching (((Owner of (Matching unit)) is an enemy of (Owner of (Casting unit))) equal True)) and do (Actions)
This condition can be found under: Boolean Comparison -> Player - Player is An enemy of Player.
tenks dud
 
Status
Not open for further replies.
Top