Detect when unit starts doing nothing

Joccaren

You can change this now in User CP.
Reaction score
54
Is there a way to detect when a unit stops doing anything or has no targets to attack? Thanks and +rep to all who help.

(I'm probably missing something so the answer will probably be something very obvious)
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Why not simply use the event:
Trigger:
  • Unit - A unit Is issued an order with no target


And, maybe check if Issued Order Equal to Stop/holdposition
 

Joccaren

You can change this now in User CP.
Reaction score
54
Why not simply use the event:
Trigger:
  • Unit - A unit Is issued an order with no target


And, maybe check if Issued Order Equal to Stop/holdposition

Tried that but it didn't work
Tried both ideas now, niether worked
 

Joccaren

You can change this now in User CP.
Reaction score
54
Found a way to do it:
Trigger:
  • Event: Every 0.05 seconds of game time
    • Conditions: And - All conditions are true
      • Units current order not equal to move
      • Units current order not equal to attack


I just had to check whether the unit was doing any of the things it was supposed to do (Move and Attack)
Note: The trigger was done in freehand so it may not be entirely accurate.
 

cleeezzz

The Undead Ranger.
Reaction score
268
add "smart" too

>check positions periodically?
..if it's stationary,,

it would work, you probably just did it wrong, but it sometimes might not work because the unit is stationary when attacking something.
 

Joccaren

You can change this now in User CP.
Reaction score
54
I checked its position every second and every 0.95 seconds, checked the distance between where it was at that point of time and where it was 0.95 seconds ago. If the distance between the points was 0, I did my actions. But my actions never happened. Can you see anything that I did wrong? if so tell me so I know for next time.
 

Kahem

New Member
Reaction score
2
lol
:banghead:
(Current order of (Picked Unit)) Equal to (Order(<empty string>))
that auta do it!
 

cleeezzz

The Undead Ranger.
Reaction score
268
>(Current order of (Picked Unit)) Equal to (Order(<empty string>))

what about stop and hold?
 

Joccaren

You can change this now in User CP.
Reaction score
54
>(Current order of (Picked Unit)) Equal to (Order(<empty string>))

what about stop and hold?

Tried that and it didn't work, don't ask me why. I no longer have the distance between points trigger as I have, as said above, found another way to do it.
 

ZugZugZealot

New Member
Reaction score
33
Here's triggers I wrote.

Trigger:
  • BreakAbility
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • If (((Issued order) Equal to (Order(stop))) or ((Issued order) Equal to (Order(holdposition)))) then do (Skip remaining actions) else do (-------- Do Nothing --------)
      • If (((Triggering unit) Equal to nullUnit) or ((Attacking unit) Not equal to theUnit)) then do (Skip remaining actions) else do (-------- Do Nothing --------)
      • Set orderInfo = 0


Trigger:
  • ChannelDetection
    • Events
      • Unit - A unit Begins channeling an ability
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • Set channeling = True


Trigger:
  • ChannelEndDetection
    • Events
      • Unit - A unit Stops casting an ability
      • Unit - A unit Finishes casting an ability
    • Conditions
    • Actions
      • Set channeling = False


Trigger:
  • AbilityScan
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • If (useAbility Equal to False) then do (Skip remaining actions) else do (-------- Do Nothing --------)
      • Set currentPoint = (Position of theUnit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Distance between previousPoint and currentPoint) Not equal to 0.00
              • channeling Equal to True
        • Then - Actions
          • Set orderInfo = 0
          • Custom script: call RemoveLocation( udg_previousPoint )
          • Set previousPoint = currentPoint
          • Set currentPoint = nullPoint
          • Skip remaining actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • orderInfo Less than 8
            • Then - Actions
              • Custom script: call RemoveLocation( udg_previousPoint )
              • Set previousPoint = currentPoint
              • Set currentPoint = nullPoint
              • Set orderInfo = (orderInfo + 1)
              • Skip remaining actions
            • Else - Actions
      • -------- Start ability actions after this --------
      • -------- End ability actions before this --------
      • Custom script: call RemoveLocation( udg_previousPoint )
      • Set previousPoint = currentPoint
      • Set currentPoint = nullPoint
      • Set orderInfo = 0


And you'll need to set previousPoint and currentPoint to the unit before you have it start "scanning". I used...

Trigger:
  • Initialize
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set theUnit = Footman 0004 &lt;gen&gt;
      • Set previousPoint = (Position of theUnit)
      • Set currentPoint = (Position of theUnit)



It requires 0.90 seconds of unit doing nothing to launch the ability. "useAbility" is true by default. channeling is false by default.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top