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

How to make unit go back to following after its done attacking?

Status
Not open for further replies.
Level 4
Joined
Jul 26, 2008
Messages
57
[SOLVED, PLEASE LOCK]How to make unit go back to following after its done attacking?

:ned: I'm trying to make a system in which there is 1 Hero who is controlled by the Player, and then there are 4 other Heroes which are controlled by 4 separate AI-controlled players. All 5 players (the 1 human player and the 4 AI players) are on the same force, so they act as a 5-man Party. Think of it like Kingdom Hearts, where there is 1 character who is controlled by the player (Sora) and then there are 2 other chars. who are controlled by the AI, following Sora (the player) wherever he goes, attacking enemies on their own and comming to the player's aid should they think he needs assistance.

However, there's one aspect of this (so far) that i'm quite confused about as to how i'm supposed to go about triggering it. See, I currently have a trigger that makes all the AI Heroes follow the player's hero as the norm. However, without another trigger that tells them to attack enemies when they come in range, the AI Heroes will never go after any enemy units. They will do nothing except follow the player's Hero unless I trigger them to do otherwise.

The problem with this, however, is the fact that after they're done attacking enemies and there are no more within the AI Hero's sight range, they will not go back to following the player's Hero on their own because they were previously ordered to attack the targets that were within range, and therefore, must be ordered to follow the player's Hero once again or else they will simply stand there doing absolutely nothing until the end of days v_v.

And, well uh, to be frank... I don't know what event or condition (or both) to use that allows me to detect when a unit is done attacking, seeing as that's what I would need in order to make this trigger happen.

Anybody know what I can do to make it happen? Or, does anybody have any ideas as to maybe making a mini-system that can do this? Any help at all is appreciated.


P.S: If making this happen requires Jass or other script, then unless you can provide me with the script, just tell me that i'd need Jass to make it work so that I can go sulk in my corner for the rest of eternity. Because I AM NOT A JASS MAN. I DO NOT HAVE JASS HANDS.:ned:
 
Last edited:
Level 8
Joined
Jun 26, 2010
Messages
530
You want the AI heros to follow the player hero after killing the enemy unit?

just a simple idea, but maybe you find it usefull (maybe for it simplicity ;p)

  • Events
    • Unit - A unit is attacked
  • Conditions
    • Attacking unit = AI hero
    • Life of attacked unit equal equal or less* 0
    • Integer - Number of enemy units in range of attacking unit greater than 0**
  • Actions
    • Unit - Issue Order - Order Atacking Unit to follow HeroControlledByPlayer
*i don't know if it can drop bellow 0 when a unit dies so i added "equal or less than"

**For detecting wich unit is enemy or not just use player-onwing conditions
 
Level 14
Joined
Aug 31, 2009
Messages
775
That trigger won't work, as they can't attack something that is already dead.

If you just use the standard follow command, units will follow and assist another unit when it attacks. They should automatically continue to walk with the unit once it is done "assisting" the hero kill other units.
 
Level 8
Joined
Jun 26, 2010
Messages
530
That trigger won't work, as they can't attack something that is already dead.

Forgot the triggers gets the events before the dmg calculation. Spend too much time playing card games ;p

That should work:

  • Events
    • Unit - A unit is attacked
  • Conditions
    • Attacking unit = AI hero
  • Actions
    • Wait - 1 second
    • If-Then-Else
      • if
        • Life of attacked unit equal equal or less than 0
        • Integer - Number of enemy units in range of attacking unit greater than 0
      • then
        • Unit - Issue Order - Order Atacking Unit to follow HeroControlledByPlayer
      • else
        • do nothing
If you just use the standard follow command, units will follow and assist another unit when it attacks. They should automatically continue to walk with the unit once it is done "assisting" the hero kill other units.

For the reason below (bold) i think the standard follow command would not be usefull.

However, without another trigger that tells them to attack enemies when they come in range, the AI Heroes will never go after any enemy units. They will do nothing except follow the player's Hero unless I trigger them to do otherwise.
 
Level 4
Joined
Jul 26, 2008
Messages
57
:ned: Soulburn, you've give me an idea... See, there's another order option for the...
  • Unit - Order Unit1 to <Action> Unit2
...trigger, called "Right-Click". Where...
  • Unit - Order Unit1 to Right-Click Unit2
Do you think that the Right-Click option would emulate the effect that Damage suggested? Where it would follow the targeted unit as if they were rightclicked and attack and assist? :ned:
 
Level 8
Joined
Jun 26, 2010
Messages
530
:ned: Soulburn, you've give me an idea... See, there's another order option for the...
  • Unit - Order Unit1 to <Action> Unit2
...trigger, called "Right-Click". Where...
  • Unit - Order Unit1 to Right-Click Unit2
Do you think that the Right-Click option would emulate the effect that Damage suggested? Where it would follow the targeted unit as if they were rightclicked and attack and assist? :ned:

That's pretty much the "Unit - Issue Order - Order Atacking Unit to follow HeroControlledByPlayer" i wrote. But i never write the triggers exactly like tey are in the editor, i just give the idea. It might work. By the way, i know you will need to know, so, the order string to "right-click" is "smart" ;D
 
Status
Not open for further replies.
Top