# [Trigger]Problems with angles facing and offset...

#### Lord Marcus XVI

Level 3
So I have a custom ability just like mirror image but the caster splits up into three units (unaffected by dispels and not mirror image but original), my problem is that I cannot make them summon in a way it should be (take a look on this pic):

EXPLANATION:
The yellow boundary is the limit angle (I guess 270 degress to 90 degrees) where I can summon the copies of the caster.
The problem is that SOME instances, the copies are summoned at the back of the caster.

The correct function must be that the copies are summoned in within the yellow boundary and offsets are considered.

--------

• Chal Trilocation
• Events
• Unit - A unit Starts the effect of an ability
• Conditions
• Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Ability being cast) Equal to Trilocation
• Then - Actions
• Set A_Chal_Trilocation_Index = (A_Chal_Trilocation_Index + 1)
• Set A_Chal_Trilocation_Caster[A_Chal_Trilocation_Index] = (Casting unit)
• Set A_Chal_Trilocation_Distance[A_Chal_Trilocation_Index] = ((Position of A_Chal_Trilocation_Caster[A_Chal_Trilocation_Index]) offset by (Random real number between 300.00 and 600.00) towards (Random real number between 90.00 and 270.00) degrees)
• Unit - Create 1 Footman for Player 1 (Red) at A_Chal_Trilocation_Distance[A_Chal_Trilocation_Index] facing (Facing of A_Chal_Trilocation_Caster[A_Chal_Trilocation_Index]) degrees
• Else - Actions

Any fix?

Last edited:

#### Nichilus

Level 18
When you look at the caster, the angle 90 is above caster (to the north), 180 is to the left of him (west) and 270 is below him (south). If anything, you need to use arithmetic function like and facing of unit like (facing of caster) + (random number between 0 and 180), etc.

#### Wietlol

Level 24
Facing angle of casting unit + random number between -90 and 90 (not 0 and 180)

#### Lord Marcus XVI

Level 3
Thanks, people. I have solved it via complex math ahhahaha arithmetic as Nichilus said. Thanks you all!

Replies
7
Views
518
Replies
4
Views
3K
Replies
5
Views
515
Replies
9
Views
1K
Replies
12
Views
524