• 🏆 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!

Units moving back to their spawn position after casting

Status
Not open for further replies.
Level 14
Joined
Aug 31, 2009
Messages
774
To clarify the topic name, I have a problem involving Attack-Moving units and them casting spells.

In my map, there are units that are ordered to attack-move towards the enemy base, and they have a Holy Light type ability, allowing them to heal each other and other units.

The problem I have is that once the unit casts the Holy Light ability (of its own will, and standard AI, not by triggers) the unit will continue to engage units in its nearby vicinity then completely ignore the Attack-move command and run all the way back to its original spawn location.

I've tried adding a periodic trigger that picks out units with a "move" or "stop" order active and redirect them the correct way, but for some reason these caster units totally ignore that also.

I even put a test trigger in that outputs the current order of a selected unit into a Chat message, and when selecting one of these backward-moving casters, it simply says "attack" as though somehow they'd been redirected. Once they reach their destination (back at their spawn) their order is completely non-existant (i.e. nothing appears in chat).

Are there methods to counter-act units controlled by a Computer Player from moving back to their spawn locations after casting a spell in this manner, and continue attack moving?
 
Level 14
Joined
Aug 31, 2009
Messages
774
I've already added a trigger that does this:
  • Cast Continue
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering Unit)) Equal to Player 1 (Red)
        • Then - Actions
          • Set temppoint = (Position of Origin of Elements 0027 <gen>)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Triggering Unit)) Equal to Player 7 (Green)
            • Then - Actions
              • Set temppoint = (Position of Origin of Elements 0026 <gen>)
            • Else - Actions
              • Do nothing
      • Unit - Order (Triggering Unit) to Attack-Move To temppoint
      • Custom script: call RemoveLocation(udg_temppoint)
And it does not work. The unit still disobeys the orders.
(For Reference, Red and Green are the AI players that control the units, the "Origin of Elements" unit is their main base structure, with 0026 being the red's and 0027 being the green's)

Standard AI is removed, but there is still some sort of "underlying AI" that knows how and when to cast spells. So the melee AI is deleted/not active, but the casters will still use their abilities when appropriate.
 
Level 30
Joined
Sep 30, 2008
Messages
1,460
hmm... I'm not an expert when it comes to positions, but could it be that the position is being removed before the unit gets a chance to have his order issued? I don't really know how blizzard made "issued orders" work, but there might be some sort of time delay there perhaps?

Might be worth seeing what happens if you add a short wait between the "move trigger" and the "remove point trigger".
 
Level 14
Joined
Aug 31, 2009
Messages
774
If you're referring to the RemoveLocation function call in the "Unit Finishes Casting" trigger, then this can't possibly be the cause, as I've used the RemoveLocation in the initial spawn trigger and the melee type units move fine, even though the location gets removed instantly after use. See below:
  • Attack
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
    • Actions
      • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) - 1.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) belongs to an ally of Player 1 (Red)) Equal to True
        • Then - Actions
          • Unit - Change ownership of (Trained unit) to Player 1 (Red) and Retain color
          • Set temppoint = (Position of Origin of Elements 0027 <gen>)
          • Unit - Order (Trained unit) to Attack-Move To temppoint
          • Custom script: call RemoveLocation(udg_temppoint)
        • Else - Actions
          • Unit - Change ownership of (Trained unit) to Player 7 (Green) and Retain color
          • Set temppoint = (Position of Origin of Elements 0026 <gen>)
          • Unit - Order (Trained unit) to Attack-Move To temppoint
          • Custom script: call RemoveLocation(udg_temppoint)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Mana of (Triggering unit)) Equal to 0.00
        • Then - Actions
          • Unit - Kill (Triggering unit)
        • Else - Actions
(Where the unit being trained is assigned to a computer, told to attack-move to a location, which is then Removed).
 
Level 14
Joined
Aug 31, 2009
Messages
774
Does removing Guard Positions affect this?

A similar map in concept to mine, called Raccoon Wars, had almost the exact same method of unit creation (auto training buildings, units assigned to computer) although none of his units ever returned to base erroneously. The only different thing he did was tell the computer to Ignore the Guard Positions of the newly created units... will this fix it?
 
Status
Not open for further replies.
Top