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

Computer Attackers and Patroling

Status
Not open for further replies.
Level 5
Joined
Jul 11, 2007
Messages
152
I'm making a survival map but am experiencing many problems with the computer movement. Right now after spawning the unit group attack-moves to a random point in the map and in addition to stop them from returning to the spawn region I have:

Events
Time - Every 25.00 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of (Picked unit)) Equal to Player 12 (Brown)
Then - Actions
Unit - Order (Matching unit) to Attack (Random unit from (Units in (Playable map area) owned by Player 1 (Red)))
Else - Actions
Do nothing

(Will later be changed to all human players not just red)
The problem is it gets sloppy if the units are being attacked and have a conflict of where to go. They sometimes run around in circles or dance around before attacking defenses. How do I fix this?

Also I have a separate unit group that I want to patrol around the perimeter of the map but cannot get it to work smoothly with regions. Any solutions?

Thanks
 
Level 10
Joined
Jun 10, 2007
Messages
557
Well, if you're ordering them to attack a random unit every 25 seconds, I think they'd get re-assigned several times. I'd have them attack move to the position of a random unit as opposed to the actual unit itself.

If this doesn't address the problem, I'm sorry, but it's what sprang to mind when I saw your trigger.
 
Level 8
Joined
Sep 9, 2007
Messages
395
Patrolling (assuming they just go around the perimeter, attacking everything they find):
Four regions, top-left, top-right, bottom-left, bottom-right.

1) Create units in top left (or move them there)
2) Need 4 triggers:
  • Event - A unit enters (top-left)
  • Conditions - Entering unit equal to (Patroller)
  • Events - Order entering unit to (attack-move) to (top-right)
  • Event - A unit enters (top-right)
  • Conditions - Entering unit equal to (Patroller)
  • Events - Order entering unit to (attack-move) to (bottom-right)
  • Event - A unit enters (bottom-right)
  • Conditions - Entering unit equal to (Patroller)
  • Events - Order entering unit to (attack-move) to (bottom-left)
  • Event - A unit enters (bottom-left)
  • Conditions - Entering unit equal to (Patroller)
  • Events - Order entering unit to (attack-move) to (top-left)
 
Level 5
Joined
Jul 11, 2007
Messages
152
Modo that is what I had initially but once they reached a region they would either return to their spawn or stay there. I changed it to and if/then with entering regions but that hasn't worked either

As for the trigger Redeemer suggested I'm still having some problems because even after a long time and many spawns some defending units are still left untouched
 
Level 5
Joined
Jul 11, 2007
Messages
152
Ok that makes sense I'll try that now

Update on the general movement:
It seems that when the acquisition range is very high for the units they ALL attack one specific group of defenses but
when the acquisition range is normal they go to random places attacking random defenses but then they return to their spawn points after killing whatever it is

My goal is that the computer will attack-move randomly and then continue to move randomly if they do not find enemies
 
Level 5
Joined
Jul 11, 2007
Messages
152
Heres what seems to be working somewhat now. Its after each unit group spawn

Unit Group - Order (Last created unit group) to Attack-Move To (Position of (Random unit from (Units in (Playable map area) matching ((Owner of (Matching unit)) Not equal to Player 12 (Brown)))))

However when there are too many units it causes lag and they dont follow orders so well what can I do for that?
 
Level 11
Joined
Aug 25, 2006
Messages
971
Ok, if I get what you want, you want the computer units to wander around and attack w/e they find?

If thats what you want, add (to every unit you want this to work for) the ability 'wander' to them. *poof* your done.
 
Level 5
Joined
Jul 11, 2007
Messages
152
I wanted them to attack in groups, and now I've finally got it, but incorporating all the ideas everyone has given me I've finally gotten it all to work

If anyone else has a similar problem this is what worked for me:

Redeemer - Have attackers attack-move to the position of unit instead of unit itself, fixes so that the attackers don't dance around
Modo - Patrolling triggers were being overruled by my other triggers and my regions were too small. Too many units were lagging and messing up the triggers so I made ways to kill extra units or reduce them overall
wd40 - Attackers will get them the wander ability if they do not find a unit

Thanks so much everyone who helped! +Rep!
 
Status
Not open for further replies.
Top