CNC-TD AI doesn't use Engineer correctly

Engineers brew

Information and discussion for custom maps and mods.
Post Reply
Bard
Posts: 1
Joined: Thu Feb 05, 2015 9:44 pm

CNC-TD AI doesn't use Engineer correctly

Post 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

Matt
Posts: 1039
Joined: Tue May 01, 2012 12:21 pm
Location: Germany

Post by Matt »


BenjaminLSR
Posts: 43
Joined: Sun May 22, 2011 3:26 pm

Post 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&#40;unit.CenterLocation, Game.CellSize * 6&#41;.Where&#40;a1 => !a1.Destroyed && !a1.IsDead&#40;&#41; && a1.HasTrait<ITargetable>&#40;&#41; && a1.HasTrait<Capturable>&#40;&#41; && unit.Owner.Stances&#91;a1.Owner&#93; == Stance.Enemy&#41;;

                    if &#40;!capture.Any&#40;&#41;&#41;
                        continue;

                    var t_capture = capture.ClosestTo&#40;unit.CenterLocation&#41;;

                    if &#40;t_capture == null&#41;
                        continue;

                    world.IssueOrder&#40;new Order&#40;"CaptureActor", unit, false&#41; &#123; TargetActor = t_capture &#125;&#41;;
                &#125;

Post Reply