Detect a unit that has no nearby allied.

zero9x

Active Member
Reaction score
1
I make a trigger like this:

"If you attacks a unit, if that unit has no nearby allied (375 AoE), then slow it 50%"

"Nvm, it worked xD"

Trigger:
  • Events
    • Unit - A unit Is attacked
    • Conditions
    • (Level of XXXX for Attacking Unit) Greater than (>) 0
    • Actions
    • Actions
    • Set Temp_Point = (Position of Attacked Unit)
    • Set Temp_Group = (Units within 350.00 of Temp_Point matching (((Matching unit) Not equal to (!=) Attacked Unit) and ((((Matching unit) is alive) Equal to (==) True) and (((Matching unit) belongs to an ally of (Owner of Attacked Unit)) Equal to (==) True))))
    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • (Number of units in Temp_Group) Equal to (==) 0
    • Then - Actions
    • Unit - Create 1 Craggy Exterior Dummy for (Owner of Attacking Unit) at Temp_Point facing Default building facing (270.0) degrees
    • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
    • Unit - Add Slow to (Last created unit)
    • Unit - Set level of Slow for (Last created unit) to (Level of XXXX for AttackingUnit)
    • Unit - Order (Last created unit) to Human Sorceress - Slow Attacked Unit
    • Else - Actions
    • Custom script: call DestroyGroup (udg_Temp_Group)
    • Custom script: call RemoveLocation(udg_Temp_Point)
 

thorhunter

You can change this now in User CP.
Reaction score
32
Instead of picking every unit in group, try 'if unit group is empty' boolean statement, since if the group is empty then the loop won't even run once.
 

Dameon

"All the power in the world resides in the eyes"
Reaction score
127
3 things to check
1: Does your dummy have enough mana to cast your spell?
2: Are you giving your dummy enough time to cast the spell?
3: Can the spell be casted on friendly targets?
 

zero9x

Active Member
Reaction score
1
@Dameon: lol, if the problem are those little things, then i dont need to post it. Ok?
 

Dameon

"All the power in the world resides in the eyes"
Reaction score
127
Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
Try disabling that action then attack a unit.
Looking over your trigger it is the only thing I can see causing a problem.
 

thorhunter

You can change this now in User CP.
Reaction score
32
Dude, the problem is the only time the condition is true is when the unit group is empty therefore 'pick every unit in unit group' won't even run once.
 

SouLEDGE

Damn you advanced calculus
Reaction score
75
Trigger:
  • Slow
    • Events
    • Unit - A unit Is attacked
    • Conditions
    • ((Attacked unit) is A Hero) Equal to True
    • (Level of XXXX for Attacking Unit) Greater than (>) 0
    • Actions
    • Set AALoc1 = (Position of Attacked Unit)
    • Set temp_group = (Units within 350.00 of AALoc1 matching (((Owner of (Attacking unit)) is an enemy of (Owner of (Attacked unit))) Equal to True))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • (Number of units in temp_group) Equal to 0
    • Then - Actions
    • Unit - Create 1 Craggy Exterior Dummy for (Owner of Attacking Unit) at AALoc1 facing Default building facing (270.0) degrees
    • Unit - Add a 2 second Generic expiration timer to (Last created unit)
    • Unit - Order (Last created unit) to Human Sorceress - Slow Attacked Unit
    • Else - Actions
    • Do nothing


I saw your expiration timer was 0.5secs, make sure your dummy has enough time to actually cast slow before it is removed, also make sure your slow can target the unit type, as is mechanical etc.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
612
Just to make it clear, the problem was that you used a Pick Every Unit loop. That won't run if the effect desired is supposed to happen, so SouLEDGE brought the If/Then/Else block out of the loop.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
612
No, but you don't have to pick the units in the group to do it. The number of units in the group will suffice.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top