Why isn't this "order when unit created" trigger working?

Strilanc

Veteran Scripter
Reaction score
42
I'm trying to give units attack-move orders as they are trained, based on whether or not a behavior is present.

So I have this trigger:
Trigger:
  • AutoPath
    • Events
      • Unit - Any Unit creates a unit with Any or Any
    • Local Variables
    • Conditions
      • ((Created Unit()) has AutoPath) == true
    • Actions
      • SetupUnitPath((Created Unit()), ((Owner of (Created Unit())) is in Teams[0]))


There are several levels of problems I'm running into:
- The condition is never satisfied. Even by units with the AutoPath behavior.
- When I disable the condition, I get a debug error which makes it look like the created unit *has no owner either*.
Code:
Trigger Error in 'gt_AutoPath_Func': Parameter out of bounds in PlayerGroupHasPlayer [value: 16, min: 0, max:15]
- Changing the trigger to work on 'enters region' results in the same errors with triggering unit.

Now, obviously I'm missing something pretty basic here. It looks like I'm checking the properties of the null unit or something, except that the unit *does* get ordered (to the wrong place because of the default result from PlayerGroupHasPlayer, but ordered!).

So what the heck is going on here?
 

Strilanc

Veteran Scripter
Reaction score
42
Aha! I solved the first issue. Apparently a unit which has a behavior with "0 points" fails the "has behavior" test. Changing the behavior's minimum number of points from 0 to 1 solved that part of the problem. Still getting that weird error, though.
 

Strilanc

Veteran Scripter
Reaction score
42
Second problem resolved! It was an error inside SetupUnitPath. So much easier to find once you trust the triggering unit function.
 
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