So I tried to make a knockback spell that knocks back units in front of the caster but the problem is the units are only knocked back if the caster faces a certain angle (180 to 360 degrees) and not knocked back if the caster faces 0 to 180 degrees.
Here are the conditions that check if the unit should be knocked back or not:
KnockbackOrigin is the location of the caster.
Thank you in advance.
Here are the conditions that check if the unit should be knocked back or not:
Code:
Set KnockbackUnitsPre[(Player number of (Owner of (Triggering unit)))] = (Units within 500.00 of KnockbackOrigin[(Player number of (Owner of (Triggering unit)))] matching ((Matching unit) Not equal to (Triggering unit)))
Unit Group - Pick every unit in KnockbackUnitsPre[(Player number of (Owner of (Triggering unit)))] and do (Actions)
Loop - Actions
Set KnockbackUnitLoc[(Player number of (Owner of (Picked unit)))] = (Position of (Picked unit))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Facing of (Triggering unit)) + 45.00) Greater than or equal to (Angle from KnockbackOrigin[(Player number of (Owner of (Triggering unit)))] to KnockbackUnitLoc[(Player number of (Owner of (Picked unit)))])
((Facing of (Triggering unit)) - 45.00) Less than or equal to (Angle from KnockbackOrigin[(Player number of (Owner of (Triggering unit)))] to KnockbackUnitLoc[(Player number of (Owner of (Picked unit)))])
KnockbackOrigin is the location of the caster.
Thank you in advance.