• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

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
720
  • 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