Page 1 of 1

CNC-TD AI doesn't use Engineer correctly

Posted: Thu Feb 05, 2015 10:10 pm
by Bard
Hello all! I wanted to make a couple AI's that engineer rushed, but they don't seem to use them correctly. They squad up with infantry units, but they just sit outside buildings pretending they have a weapon. Does anyone know if there is a way to code in special behaviors for them? I can't find the AI behavior file, or is it Hardcoded?

Side note: Engineer and Commando aren't in any of the Default AI build ques

Engineer is "E6"
Commando is "RMBO"

If you add those and a % they will produce those units :D

Posted: Sun Feb 08, 2015 9:20 am
by Matt

Posted: Fri Feb 13, 2015 9:46 am
by BenjaminLSR
Well, I had this brutally working on my HackyAI. And that was dangerous as **** :)

Code: Select all

if (unit.Info.Name == "e6")
                {
                    var capture = world.FindUnitsInCircle(unit.CenterLocation, Game.CellSize * 6).Where(a1 => !a1.Destroyed && !a1.IsDead() && a1.HasTrait<ITargetable>() && a1.HasTrait<Capturable>() && unit.Owner.Stances[a1.Owner] == Stance.Enemy);

                    if (!capture.Any())
                        continue;

                    var t_capture = capture.ClosestTo(unit.CenterLocation);

                    if (t_capture == null)
                        continue;

                    world.IssueOrder(new Order("CaptureActor", unit, false) { TargetActor = t_capture });
                }