• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

"Submissive" Unit

Status
Not open for further replies.
Level 6
Joined
May 19, 2004
Messages
267
I need a unit (from now called A) that:
  • Auto-aquires target (from now called B) and charges thowards it to attack.
  • Does not change from target no matter what, unless;
    • I order it to attack another unit (called C).
    • Same applies here, do not change target unless I say so.
  • Can be both ranged and melee.

What I've tried
  • Peon/Worker Classification
    • Added worker-classification at runtime.
    • Result:
      • Didn't seem to make any difference.
  • Permanent Invisibility
    • Result:
      • A did not auto-aquire targets.
  • Acquisition Range
    • Added in OE
    • Result:
      • The reordering works flawless, however, A doesn't auto-aquire targets, and is limited to melee range.
    • Added on runtime.
    • Result:
      • A is reordered to attack C, but as soon as B attacks, A is reordered to attack B.
  • Player Settings
    • Setting A to Computer, Neutral or None in Player Properties
    • Result:
      • Didn't seem to make any difference.
  • Alliance Settings
    • Setting the owner of B to ally/neutral of A.
    • Result:
      • As soon as the B attacks A, A's order is reset to attack B.

The usual problem:
  • A resets order back to B when attacked by it.
  • A doesn't change order at all.

Best results so far:
  • Setting Acquisition Range to 1 in OE gives the desired result, apart from auto-aquire and attackrange
  • Constantly (0.5s timer) setting A to attack C works, but he moves very choppy, and he has serious problems with attacking.
 
Level 8
Joined
Jan 8, 2010
Messages
493
and is B a particular unit? or is it any unit? i think you can just trigger those things :eek:
like for the auto-acquire target, well you changed the auto-acquire thing in OE, i guess you can try Specific Unit Event - Acquires Target or add an specific unit event to a trigger, Trigger - Add Event to Trigger -> Specific Event - (Unit Variable) Acquires Target if A is not in-game at map initialization, so that you can check what unit it targets (B), then add it to a variable so your second problem is easier.

then for does not change target unless you ordered, for example if (A) again acquires a target, check whether it is (B) - or the variable for (B) - and order it to always attack (B).

though im not sure you can make a unit both melee and ranged, unless you change it. adding an orb effect sometimes (i think, sometimes, but most of the times) changes only an attack index, but if it is defaulted to melee, it will always be melee if it can attack the target.

and yes, like Maker suggested. i was also wondering what are the situations where a unit changes target.
 
Level 12
Joined
Aug 22, 2008
Messages
911
Hmm.
If I understand correctly this trigger might help: (using hashtable)
  • Submissive Unit
    • Events
      • Unit - A unit is issued an order targeting a target
    • Conditions
      • (Issued order) equal to Order(attack)
    • Actions
      • If(All conditions are true) then do (Then actions) else do (Else Actions)
        • If - Conditions
          • (Load 0 of Key(Triggering Unit) in hashtable) not equal to No unit
        • Then - Actions
          • If(All conditions are true) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load 0 of Key(Triggering Unit) in hashtable) not equal to (Target Unit of Issued Order)
            • Then - Actions
              • Unit - Order (Triggering Unit) to attack (Load 0 of Key(Triggering Unit))
            • Else - Actions
        • Else - Actions
          • Hashtable - Save 0 of Key(Triggering Unit) in hashtable
Comparison for the unit to be a specific unit or to be in a unit group is too easy for you, I assume.
 
Status
Not open for further replies.
Top