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

[General] Sending Units to Attack Base

Status
Not open for further replies.
Level 4
Joined
Mar 20, 2014
Messages
67
Hi all,

Having some trouble here with the enemy AI I coded

I'm working on replicating/creating a new version of Custom Castle Defense v4.2.0

The problem is I have NO idea how they coded their AI, right now Mills provide income, and everyone requires income, so I have the enemy units attack-moving to mills.

This creates problems with hills and trees where they'll get stuck, so I made an anti-stuck system, but it still doesn't work that well, as some people with more cliffs will get no spawns for a while

Does anyone know how they did it?

Thanks!
- Zach
 
Level 13
Joined
Oct 12, 2016
Messages
769
You may have to consider a few things when telling units to attack-move to a location.
1) When editing your map, press "P". This shows you pathing. Anything in pink, nothing can walk there. If you are not using an AI script, the AI can be pretty dumb with attack-move orders to a point. Make sure there is a clear path from where you spawn them, to where they need to attack. You also need to consider collision radius for units in the object editor. This is in the "movement" section. In general, 24 collision size is about 1 small square for pathing. Unit collision could cause problems for units moving to a location, since they cannot walk through each other.

2) If players build these mills for income, then you may want to consider using an AI script instead of attack-move orders. For the AI script, there are a few good tutorials out there. Consider making the mills a "town hall" type unit, so the AI script registers it as a town for priority attacks. In the object data, there is also a section in the "stats" part for each unit called "priority." The higher this number (maximum 20), the more the AI wants to attack this thing.

3) If there are some things you DO NOT want the computer to attack, modify what target types their units can attack. For example, you could make units in the object data attack "non-ancients," then make things you don't want them to attack "ancients." They'll just avoid them. You could also make things you don't want attacked to be invulnerable.

In summary:
Make sure that not only your triggers are in order, but also your object data, target types, collision size and pathing.
 
Last edited:
Level 4
Joined
Mar 20, 2014
Messages
67
Right now what I have it doing is instead of picking mills it checks for walls and units first, so that way it targets the "entrance" of the base, which seems to be working, but thank you all!

I'll still look into the AI editor, I've never messed with it before
 
Status
Not open for further replies.
Top