People experienced in trigger execution count please view this thread.
Woot 12 views!
Ok, this is just probably logical errors, but i can't seem to find them. So I call to the helper. The trigger basically disables a plane from making sharp turns, forcing it to fly in a circle until it faces the destination using trig ratios and etc...
You can just ignore the math part, I highlighted the problem area. The purpose of this part is to cancle any pre-existing instances if say the user updates the destination. But the If-Then-Else statement always comes out false.
Eh...I can't find spoiler tags...
Edit: Oh, crap, the bold didn't nest in the
Woot 12 views!
Ok, this is just probably logical errors, but i can't seem to find them. So I call to the helper. The trigger basically disables a plane from making sharp turns, forcing it to fly in a circle until it faces the destination using trig ratios and etc...
You can just ignore the math part, I highlighted the problem area. The purpose of this part is to cancle any pre-existing instances if say the user updates the destination. But the If-Then-Else statement always comes out false.
Code:
FLY Copy
Events
Unit - A unit Is issued an order targeting a point
Conditions
(Issued order) Equal to (Order(smart))
(Unit-type of (Triggering unit)) Equal to Airplane
Actions
Custom script: local integer locExecCount = GetTriggerExecCount(GetTriggeringTrigger())
Custom script: if locExecCount == 50 then
Custom script: call ResetTrigger(GetTriggeringTrigger())
Custom script: endif
Custom script: set udg_trigexeccount = locExecCount
Game - Display to (All players) the text: --Initial
Game - Display to (All players) the text: ( local exec: + (String(trigexeccount)))
Set orderPoint[trigexeccount] = (Target point of issued order)
For each (Integer forloopInteger[trigexeccount]) from 1 to 50, do (Actions)
Loop - Actions
Game - Display to (All players) the text: --Loop
[B]Custom script: set udg_trigexeccount = locExecCount //trigexeccount is set to the local variable, which is the execution count of this particular instance[/B]
Game - Display to (All players) the text: ( local exec: + (String(trigexeccount)))
Game - Display to (All players) the text: ( global exec: + (String((Execution count of (This trigger)))))
Set customvalueInteger = (Custom value of (Triggering unit))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
[B]If - Conditions
trigexeccount Not equal to (Execution count of (This trigger)) //Execution count should be higher than the local variable because this is an old instance
Then - Actions
Skip remaining actions
Game - Display to (All players) the text: Endloop
Game - Pause the game
Else - Actions
Game - Display to (All players) the text: Continueloop[/B]
Set unitPoint = (Position of (Triggering unit))
Set facingAngle = (Facing of (Triggering unit))
Set xReal = (Abs((X of orderPoint[trigexeccount])))
Set yReal = (Abs((Y of orderPoint[trigexeccount])))
Set facingAngle = (Facing of (Triggering unit))
Set hypotenuseReal = (Distance between orderPoint[trigexeccount] and unitPoint)
Set quadrantReal[0] = ((X of orderPoint[trigexeccount]) - (X of unitPoint))
Set quadrantReal[1] = ((Y of orderPoint[trigexeccount]) - (Y of unitPoint))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
quadrantReal[0] Greater than or equal to 0.00
quadrantReal[1] Greater than or equal to 0.00
Then - Actions
Set orderAngle = (Asin((yReal / hypotenuseReal)))
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
quadrantReal[0] Less than or equal to 0.00
quadrantReal[1] Greater than or equal to 0.00
Then - Actions
Set orderAngle = (Asin((xReal / hypotenuseReal)))
Set orderAngle = (orderAngle + 90.00)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
quadrantReal[0] Less than or equal to 0.00
quadrantReal[1] Less than or equal to 0.00
Then - Actions
Set orderAngle = (Asin((yReal / hypotenuseReal)))
Set orderAngle = (orderAngle + 180.00)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
quadrantReal[0] Greater than or equal to 0.00
quadrantReal[1] Less than or equal to 0.00
Then - Actions
Set orderAngle = (Asin((xReal / hypotenuseReal)))
Set orderAngle = (orderAngle + 270.00)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Abs((orderAngle - facingAngle))) Less than or equal to 18.00
Then - Actions
Unit - Order (Triggering unit) to Move To orderPoint[trigexeccount]
Unit - Set the custom value of (Triggering unit) to 0
Game - Display to (All players) the text: order
Skip remaining actions
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
facingAngle Greater than or equal to 180.00
Then - Actions
Set turnaroundAngle = (facingAngle - 180.00)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
orderAngle Greater than or equal to turnaroundAngle
orderAngle Less than or equal to facingAngle
Then - Actions
Set directionReal = -1.00
Else - Actions
Set directionReal = 1.00
Else - Actions
Set turnaroundAngle = (facingAngle + 180.00)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
orderAngle Less than or equal to turnaroundAngle
orderAngle Greater than or equal to facingAngle
Then - Actions
Set directionReal = 1.00
Else - Actions
Set directionReal = -1.00
Game - Display to (All players) the text: circle
Set circlePoint[trigexeccount] = (unitPoint offset by 120.00 towards (facingAngle + (18.00 x directionReal)) degrees)
Unit - Order (Triggering unit) to Move To circlePoint[trigexeccount]
Wait 0.01 seconds
Eh...I can't find spoiler tags...
Edit: Oh, crap, the bold didn't nest in the
Trigger:
- tags =/ Oh well, it's the first conditional inside the loop.