• 🏆 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 do I make the A.I follow/guard a unit?

Status
Not open for further replies.
Level 2
Joined
Jan 30, 2019
Messages
20
You know how in Diablo you can have companions that arent played controlled following you, and attacking things that get close? How do I basically order a certain unit to ''escort'' another one? I can obviously order it to follow, but it refuses to attack when combat happens. It just keeps following. I tried to create an event where if the unit I want to be protected, lets say Kaelthas, is attacked, then the unit who guards it, lets say the Captain, will attack the triggering unit. But he just keeps following instead. I just want him to follow when theres no action, and then when we're in combat, he'll go back to attacking.
 
Level 17
Joined
Jul 1, 2010
Messages
721
  • Untitled Trigger 001
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
      • (Distance between (Position of Kael 0000 <gen>) and (Position of Captain 0001 <gen>)) Greater than or equal to 500.00
    • Actions
      • Unit - Order Captain 0001 <gen> to Attack-Move To ((Position of Kael 0000 <gen>) offset by 500.00 towards (Random angle) degrees)
and if a unit attacks Kael:
  • Untitled Trigger 001 Copy
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Attacked unit) Equal to Kael 0000 <gen>
      • (Current order of Captain 0001 <gen>) Not equal to (Order(attack))
    • Actions
      • Unit - Order Captain 0001 <gen> to Attack (Attacking unit)
 
Level 2
Joined
Jan 30, 2019
Messages
20
  • Untitled Trigger 001
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
      • (Distance between (Position of Kael 0000 <gen>) and (Position of Captain 0001 <gen>)) Greater than or equal to 500.00
    • Actions
      • Unit - Order Captain 0001 <gen> to Attack-Move To ((Position of Kael 0000 <gen>) offset by 500.00 towards (Random angle) degrees)
and if a unit attacks Kael:
  • Untitled Trigger 001 Copy
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Attacked unit) Equal to Kael 0000 <gen>
      • (Current order of Captain 0001 <gen>) Not equal to (Order(attack))
    • Actions
      • Unit - Order Captain 0001 <gen> to Attack (Attacking unit)
Thank you so much man!
 
Status
Not open for further replies.
Top