[Solved] Attack Neutral Unit on Right Click

Status
Not open for further replies.

Deleted member 231919

D

Deleted member 231919

Not sure why this simple trigger doesn't work. When the worker unit right clicks on the unit called stone, the worker unit should just be ordered to attack the stone unit but instead I get kicked out of the game.

  • Clicked On
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Unit-type of (Ordered unit)) Equal to Worker
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Target unit of issued order)) Equal to Stone
        • Then - Actions
          • Unit - Order (Ordered unit) to Attack (Target unit of issued order)
        • Else - Actions
 

Deleted member 231919

D

Deleted member 231919

I don't know how this works but it does. Thanks for the help anyway. :)

  • Clicked On
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Unit-type of (Ordered unit)) Equal to Worker
          • (Unit-type of (Target unit of issued order)) Equal to Stone
    • Actions
      • Trigger - Turn off (This trigger)
      • Unit - Order (Ordered unit) to Attack (Target unit of issued order)
      • Trigger - Turn on (This trigger)
 
Although this one is already solved, you could do the same without disabling and enabling the trigger by checking if the order being issued is not equal to attack. If the condition stated beforehand is true, then you issue that order, which will fire the trigger again, only that the condition will become false, thus preventing a loop.
 
Status
Not open for further replies.
Top