AI mod suggestions.

Mods that are being worked on. You can post your teaser here.
User avatar
Secg
Half Track L2
Half Track L2
Posts: 200
Joined: Sat Jun 10, 2017 12:28 am
United States of America

Another AIs which sometimes bugs

Post by Secg »

This is the gbcommando, Infantry counterpart of gbblitz. Sometimes this AI's offensive squads won't attack my base & given enough times, there'll be a horde of bazooka, machinegunner,s & snipers in its base (perhaps my 60-70 units is an exaggeration)

mod.cfg

Code: Select all

///////////////////////////////////////////////////////////////////////////////
//
// Pandemic Studios
//
// AI Personality Configuration - Great Battles
//

// Don't load this for Multi
Random(0);

// Add files to the AI configuration stream
Files("AI")
{
  Add("personality_gbcommando_scripts.cfg");
  Add("personality_gbcommando_orderers_units.cfg");
  Add("personality_gbcommando_bases.cfg");
}

StartActionAll()
{
  // Create the base
  AddBase("base", "personality.gbcommando.army");

  // Add all units currently on the team
  AssignBaseConstructors("base");
  AssignBaseUnits("base");
  
  // Set up an apropriate unit limit
  SetUnitLimit(100);

  // Start up the scripts
  ExecuteScript("offense.land", "personality.gbcommando.offense.land")
  {
    Op("%.danger", "=", 0.6);
    Op("%.base", "=", "base");
  }
  ExecuteScript("offense.advland", "personality.gbcommando.offense.advland")
  {
    Op("%.danger", "=", 0.5);
    Op("%.base", "=", "base");
  }
  ExecuteScript("defense.infantry", "personality.gbcommando.defense.infantry")
  {
    Op("%.base", "=", "base");
  }
  ExecuteScript("defense.vehicles", "personality.gbcommando.defense.vehicles")
  {
    Op("%.base", "=", "base");
  }
}
personality_gbcommando_bases.cfg

Code: Select all

///////////////////////////////////////////////////////////////////////////////
//
// Pandemic Studios
//
// AI Personality Configuration (Bases)
//

Strategic()
{
  CreateBase("personality.gbcommando.army")
  {
    InitialState("initial");

    State("initial")
    {
      Orderers()
      {
        // now, get some rudimentary base defense and upgrade
        Add("personality.gbcommando.defense.infantry", 1, 10, 0);
        Add("personality.gbcommando.offense.infantry", 1, 30, 0);
        // start cranking out some defensive vehicles and a barracks upgrade
        Add("personality.gbcommando.defense.vehicles", 1, 40, 0);
        // Now that we've got a barracks2, lets crank out an attack force
        Add("personality.gbcommando.offense.advinfantry", 1, 50, 0);
        // and the final touches...
        Add("personality.gbcommando.baserepair", 1, 100, 0);
      }
    }
	
    // here until I figure out what to do with them.
    // should provide base defense
    //State("underattack")
    //{
      //Orderers()
      //{
        // Defense
        //Add("personality.gbcommando.defense.infantry", 1, 110, 0);
        //Add("personality.gbcommando.defense.vehicles", 1, 120, 0);
      //}
    //}
	
  }
}
personality_gbcommando_orderers_units.cfg

Code: Select all

///////////////////////////////////////////////////////////////////////////////
//
// Pandemic Studios
//
// AI Personality Configuration (Orderers)
//

Strategic()
{
  // Offense infantry
  CreateBase::Orderer("personality.gbcommando.offense.infantry")
  {
    Manifest("OrdererLevel")
    {
      Script("offense.land");
      Types()
      {
        Add("army.unit.machinegunner", 5);
        Add("army.unit.bazooka", 4);
        Add("army.unit.sniper", 1);
      }
      CanBuild(1);
      Random(1);
      //NoBeyondWeighting(1);
    }
  }

  // Offense infantry
  CreateBase::Orderer("personality.gbcommando.offense.advinfantry")
  {
    Manifest("OrdererLevel")
    {
      Script("offense.advland");
      Types()
      {
        Add("army.unit.machinegunner", 6);
        Add("army.unit.sniper", 2);
        Add("army.unit.mortar", 3);
        Add("army.unit.bazooka", 5);
      }
      CanBuild(1);
      Random(1);
      //NoBeyondWeighting(1);
    }
  }

  // Defense infantry
  CreateBase::Orderer("personality.gbcommando.defense.infantry")
  {
    Manifest("Level")
    {
      Script("defense.infantry");
      Types()
      {
        Add("army.unit.machinegunner", 3);
        Add("army.unit.sniper", 1);
        Add("army.unit.bazooka", 2);
      }
      CanBuild(1);
      Random(1);
      //NoBeyondWeighting(1);
    }
  }
  
  // Defense vehicles
  CreateBase::Orderer("personality.gbcommando.defense.vehicles")
  {
    Manifest("Level")
    {
      Script("defense.vehicles");
      Types()
      {
        Add("army.unit.chopper",1);
        Add("army.unit.tank",1);
      }
      CanBuild(1);
      Random(1);
      //NoBeyondWeighting(1);
    }
  }

  // Base repair
  CreateBase::Orderer("personality.gbcommando.baserepair")
  {
    Manifest("Level")
    {
      Types()
      {
        Add("army.unit.medicjeep");
      }
      CanBuild(1);
      Random(1);
    }
  }
}
personality_gbcommando_scripts.cfg

Code: Select all

///////////////////////////////////////////////////////////////////////////////
//
// Pandemic Studios
//
// AI Personality Configuration (Scripts)
//

Strategic()
{
  // Land offense script
  CreateScript("personality.gbcommando.offense.land")
  {
    InitialState("Start");

    CreateVarFloat("%.danger", 0.2);
    CreateVarInteger("%.cluster.target");
    CreateVarString("%.base");

    State("Start")
    {
      Conditions()
      {
        Condition("ObjectiveCondition")
        {
          Condition("Timer")
          {
            Time(180);
          }
          Transition()
          {
            GoToState("Wait");
          }
        }
      }
    }

    State("Find")
    {
      Action("ApplyRule")
      {
        Rule("FindUndefendedCluster");
        Var("%.cluster.target");
        DangerRatio("%.danger");
      }
      Conditions()
      {
        Condition("Count")
        {
          Amount(9);
          Operator("<=");
          Transition()
          {
            GoToState("Wait");
          }
        }
        Status("Completed")
        {
          GoToState("Move");
        }
        Status("Failed")
        {
          GoToState("Seek");
        }
      }
    }

    State("Seek")
    {
      Action("ApplyRule")
      {
        Rule("FindProtectBase");
        ArmourClass("structure");
        Var("%.cluster.target");
        Base("%.base");
      }
      Conditions()
      {
        Condition("Count")
        {
          Amount(9);
          Operator("<=");
          Transition()
          {
            GoToState("Wait");
          }
        }
        Status("Completed")
        {
          GoToState("Move");
        }
        Status("Failed")
        {
          GoToState("Find");
        }
      }
    }

    State("Move")
    {
      Action("Move")
      {
        Attack(1);
        Location()
        {
          Base("VarCluster", "%.cluster.target");
        }
      }
      Conditions()
      {
        Condition("Count")
        {
          Amount(0);
          Operator("==");
          Transition()
          {
            GoToState("Wait");
          }
        }
        Condition("ObjectiveCondition")
        {
          Condition("Timer")
          {
            Time(30);
          }
          Transition()
          {
            GoToState("Find");
          }
        }
        Status("Completed")
        {
          GoToState("Find");
        }
      }
    }

    State("Wait")
    {
      Conditions()
      {
        Condition("Count")
        {
          Amount(10);
          Operator(">=");
          Transition()
          {
            GoToState("Find");
          }
        }
      }
    }
  }

/////////////////////////////////////////////////////////////////
// Adv Land
//
  CreateScript("personality.gbcommando.offense.advland")
  {
    InitialState("Start");

    CreateVarFloat("%.danger", 0.2);
    CreateVarInteger("%.cluster.target");
    CreateVarString("%.base");

    State("Start")
    {
      Conditions()
      {
        Condition("ObjectiveCondition")
        {
          Condition("Timer")
          {
            Time(180);
          }
          Transition()
          {
            GoToState("Wait");
          }
        }
      }
    }

    State("Find")
    {
      Action("ApplyRule")
      {
        Rule("FindUndefendedCluster");
        Var("%.cluster.target");
        DangerRatio("%.danger");
      }
      Conditions()
      {
        Condition("Count")
        {
          Amount(15);
          Operator("<=");
          Transition()
          {
            GoToState("Wait");
          }
        }
        Status("Completed")
        {
          GoToState("Move");
        }
        Status("Failed")
        {
          GoToState("Seek");
        }
      }
    }

    State("Seek")
    {
      Action("ApplyRule")
      {
        Rule("FindProtectBase");
        ArmourClass("structure");
        Var("%.cluster.target");
        Base("%.base");
      }
      Conditions()
      {
        Condition("Count")
        {
          Amount(15);
          Operator("<=");
          Transition()
          {
            GoToState("Wait");
          }
        }
        Status("Completed")
        {
          GoToState("Move");
        }
        Status("Failed")
        {
          GoToState("Find");
        }
      }
    }

    State("Move")
    {
      Action("Move")
      {
        Attack(1);
        Location()
        {
          Base("VarCluster", "%.cluster.target");
        }
      }
      Conditions()
      {
        Condition("Count")
        {
          Amount(0);
          Operator("==");
          Transition()
          {
            GoToState("Wait");
          }
        }
        Condition("ObjectiveCondition")
        {
          Condition("Timer")
          {
            Time(30);
          }
          Transition()
          {
            GoToState("Find");
          }
        }
        Status("Completed")
        {
          GoToState("Find");
        }
      }
    }

    State("Wait")
    {
      Conditions()
      {
        Condition("Count")
        {
          Amount(16);
          Operator(">=");
          Transition()
          {
            GoToState("Find");
          }
        }
      }
    }
  }
  
  // Land defense script
  CreateScript("personality.gbcommando.defense.infantry")
  {
    InitialState("Find");
    CreateVarInteger("%.cluster");
    CreateVarString("%.base");
    State("Find")
    {
      Action("ApplyRule")
      {
        Rule("FindProtectBase");
        ArmourClass("structure");
        Var("%.cluster");
        Base("%.base");
      }
      Conditions()
      {
        Condition("Count")
        {
          Amount(0);
          Operator("==");
          Transition()
          {
            GoToState("Wait");
          }
        }
        Status("Completed")
        {
          GoToState("Move");
        }
        Status("Failed")
        {
          GoToState("Wait");
        }
      }
    }

    State("Move")
    {
      Action("Move")
      {
        Attack(1);
        Location()
        {
          Base("VarCluster", "%.cluster");
        }
      }
      Conditions()
      {
        Condition("ObjectiveCondition")
        {
          Condition("Timer")
          {
            Time(10);
          }
          Transition()
          {
            GoToState("Find");
          }
        }
      }
    }
    State("Wait")
    {
      Conditions()
      {
        Condition("Count")
        {
          Amount(7);
          Operator(">");
          Transition()
          {
            GoToState("Find");
          }
        }
      }
    }
  }
  
  // Land defense script
  CreateScript("personality.gbcommando.defense.vehicles")
  {
    InitialState("Find");
    CreateVarInteger("%.cluster");
    CreateVarString("%.base");
    State("Find")
    {
      Action("ApplyRule")
      {
        Rule("FindProtectBase");
        ArmourClass("structure");
        Var("%.cluster");
        Base("%.base");
      }
      Conditions()
      {
        Condition("Count")
        {
          Amount(0);
          Operator("==");
          Transition()
          {
            GoToState("Wait");
          }
        }
        Status("Completed")
        {
          GoToState("Move");
        }
        Status("Failed")
        {
          GoToState("Wait");
        }
      }
    }

    State("Move")
    {
      Action("Move")
      {
        Attack(1);
        Location()
        {
          Base("VarCluster", "%.cluster");
        }
      }
      Conditions()
      {
        Condition("ObjectiveCondition")
        {
          Condition("Timer")
          {
            Time(10);
          }
          Transition()
          {
            GoToState("Find");
          }
        }
      }
    }
    State("Wait")
    {
      Conditions()
      {
        Condition("Count")
        {
          Amount(3);
          Operator(">");
          Transition()
          {
            GoToState("Find");
          }
        }
      }
    }
  }
}
Last edited by Secg on Fri Feb 16, 2018 7:18 pm, edited 1 time in total.
ImageImage
User avatar
TommyCD1
Moderator
Moderator
Posts: 1143
Joined: Tue Jun 04, 2013 8:55 am
Location: East Coast
Contact:
United States of America

Re: New personalities for the AI.

Post by TommyCD1 »

Again, I see no issues in your .cfg files, although mod.cfg seems to be missing. lol

Note though that a computer player can only ever use 1 personality at a time, so if you're trying to get your base to use both this personaliy and gbblitz, then that can raise some issues. Also make sure that you are telling your computer player to use the personality properly. You can do this by changing the mission's game.cfg file and modifying the line that reads:
  • Personality("gb");
to whatever personality you like. Be sure that you type in the filename of the personality for it to work properly. Since you have the AI set not to load during multiplayer, this is the only way it can be used.

Also be aware that the following missions:
  • Garden Siege
  • Blind Pass
  • Bathroom Blitz
  • Sandbox Shenanigans
do not actually use the gb.x personality, instead their attacks, if they have any at all, are scripted within the mission itself using objectives, and this may also cause discrepancies to arise during gameplay. For example they could be scripted to build 10 grunts, but their personality also calls 10 grunts, and therefore they build only 10 grunts total, which half each going to both the script and the personality, causing neither squad to be complete and resulting in inaction.

Hopefully I explained that well... :">
I may not make the best maps, or be the best player, but I put a lot of time, effort, and care into my stuff. That counts for something, right? No.
Image
"Can we order a pizza?"
GameRanger ID: 913974
User avatar
Secg
Half Track L2
Half Track L2
Posts: 200
Joined: Sat Jun 10, 2017 12:28 am
United States of America

Another question

Post by Secg »

I just want to ask how this parameter Danger Ratio works?
ImageImage
User avatar
TommyCD1
Moderator
Moderator
Posts: 1143
Joined: Tue Jun 04, 2013 8:55 am
Location: East Coast
Contact:
United States of America

Re: New personalities for the AI.

Post by TommyCD1 »

I can't say for sure, although I think the higher the decimal, the more willing the squad is to enter dangerous situations.
I may not make the best maps, or be the best player, but I put a lot of time, effort, and care into my stuff. That counts for something, right? No.
Image
"Can we order a pizza?"
GameRanger ID: 913974
User avatar
Secg
Half Track L2
Half Track L2
Posts: 200
Joined: Sat Jun 10, 2017 12:28 am
United States of America

Figured out some AIs' behaviors

Post by Secg »

Defensive AI kicks in when enemy units come within a certain range of AI's building with "Structure" armour class. I haven't worked out how far, yet it seems a good distance (about 200-300) from even the farthest placed guardtowers.

I think my problem, that AIs sometimes attacking with Defensive Units, arises from my habit of buildings my extra Depots Pillboxes-AA guns within that range.

Also, I've deduced how my AIs accumulate units within their bases. The problem is that I've edited personality_gbsomething_orderers_units.cfg's Manifests from Manifest("Level") to Manifest("OrdererLevel"), meaning that the AIs will keep churning out units according to the priority within the personality_gbsomething_base.cfg; & if the AI does not find anything "UndefendedCluster" in my base worth attacking, the squads will never move out unless to defend against my units or buildings put within its defensive range . Given enough times, the offensive squads will keep accumulating until the only way to win against them is Bombing Run. :o

However, if I changed the Manifests Back to Manifest("Level"), then there the AIs won't defend itself against me much often anymore. Making the great battle missions waterway; bathroom; basement & tricyle easier than even my modded campaign missions. 8-|

Code: Select all

///////////////////////////////////////////////////////////////////////////////
//
// Pandemic Studios
//
// AI Personality Configuration (Orderers)
//

Strategic()
{
  // Offense vehicles
  CreateBase::Orderer("personality.gbblitz.offense.vehicles")
  {
    Manifest("OrdererLevel")
    {
      Script("offense.vehicles");
      Types()
      {
        Add("army.unit.tank",2);
      }
      CanBuild(1);
      Random(1);
      //NoBeyondWeighting(1);
    }
  }

  // Offense air
  CreateBase::Orderer("personality.gbblitz.offense.air")
  {
    Manifest("OrdererLevel")
    {
      Script("offense.air");
      Types()
      {
        Add("army.unit.chopper",2);
      }
      CanBuild(1);
      Random(1);
      //NoBeyondWeighting(1);
    }
  }

  // Offense heavy vehicles
  CreateBase::Orderer("personality.gbblitz.offense.heavyvehicles")
  {
    Manifest("OrdererLevel")
    {
      Script("offense.heavyvehicles");
      Types()
      {
        Add("army.unit.tank", 4);
      }
      CanBuild(1);
      Random(1);
      //NoBeyondWeighting(1);
    }
  }

  // Dumdum
  CreateBase::Orderer("personality.gbblitz.offense.dumdum")
  {
    Manifest("OrdererLevel")
    {
      Script("offense.dumdum");
      Types()
      {
        Add("army.unit.dumdum", 2);
      }
      CanBuild(1);
      Random(1);
      //NoBeyondWeighting(1);
    }
  }
  
   // Offense heavy air
  CreateBase::Orderer("personality.gbblitz.offense.heavyair")
  {
    Manifest("OrdererLevel")
    {
      Script("offense.heavyair");
      Types()
      {
        Add("army.unit.chopper", 3);
      }
      CanBuild(1);
      Random(1);
    }
  }

  // Defense infantry
  CreateBase::Orderer("personality.gbblitz.defense.infantry")
  {
    Manifest("Level")
    {
      Script("defense.infantry");
      Types()
      {
        Add("army.unit.machinegunner",3);
        Add("army.unit.bazooka",2);
      }
      CanBuild(1);
      Random(1);
      //NoBeyondWeighting(1);
    }
  }

  // Defense vehicles
  CreateBase::Orderer("personality.gbblitz.defense.vehicles")
  {
    Manifest("Level")
    {
      Script("defense.vehicles");
      Types()
      {
        Add("army.unit.chopper",1);
        Add("army.unit.tank",1);
      }
      CanBuild(1);
      Random(1);
      //NoBeyondWeighting(1);
    }
  }

  // Base repair
  CreateBase::Orderer("personality.gbblitz.baserepair")
  {
    Manifest("Level")
    {
      Types()
      {
        Add("army.unit.medicjeep");
      }
      CanBuild(1);
      Random(1);
    }
  }
}
ImageImage
User avatar
TommyCD1
Moderator
Moderator
Posts: 1143
Joined: Tue Jun 04, 2013 8:55 am
Location: East Coast
Contact:
United States of America

Re: AI mod suggestions.

Post by TommyCD1 »

Well I haven't worked with AI's in a long time, nor have I really played the game in a while, so I'd have to play test some of this stuff you're reporting here and figure out what I can learn.

Such as I honestly don't remember the difference between Level and OdereLevel manifestations, if they even make a difference.

The defensive AI attacking your stray depots and pillboxes, however, sounds like the AI is deciding that your buildings are adequate enough to be classified as an "UndefendedCluster" and therefore is attacking. I've never heard of or seen the AI react defensively when enemy units are within a distance of their base though...
I may not make the best maps, or be the best player, but I put a lot of time, effort, and care into my stuff. That counts for something, right? No.
Image
"Can we order a pizza?"
GameRanger ID: 913974
User avatar
Secg
Half Track L2
Half Track L2
Posts: 200
Joined: Sat Jun 10, 2017 12:28 am
United States of America

An apology & an appreciation

Post by Secg »

First, I apologize for TommyCD1 for posting on the wrong thread. I should've explored the tab more throughly to find the appropriate thread.

Second, I appreciate TommyCD1's observation that most of the time the Defensive scripts will not make the AI move its defensive squads out to Defense. However, when I make the Amount() to become fewer than (say: 2 vehicles) in personality_gbplaceholder_orderers_units.cfg the squad's size (say: 3 vehicles) in the personality_gbplaceholder_orderers_units.cfg; Then there'll be a higher chance (sorry for not testing thoroughly; definitely not 100%) that the AI would move out to attack my stray units or buildings.

Code: Select all

    State("Wait")
    {
      Conditions()
      {
        Condition("Count")
        {
          Amount(2);
          Operator(">");
          Transition()
          {
            GoToState("Find");
          }
        }
      }
    }
ImageImage
User avatar
TommyCD1
Moderator
Moderator
Posts: 1143
Joined: Tue Jun 04, 2013 8:55 am
Location: East Coast
Contact:
United States of America

Re: AI mod suggestions.

Post by TommyCD1 »

Well, it's not really the wrong topic, I've just been meaning to lock that topic for a while now, and my AI's have become so popular that I needed a way to easily distinguish between discussion and updates for others.

But your smaller squad moving out sounds simply like they are just finished sooner.
I may not make the best maps, or be the best player, but I put a lot of time, effort, and care into my stuff. That counts for something, right? No.
Image
"Can we order a pizza?"
GameRanger ID: 913974
User avatar
Secg
Half Track L2
Half Track L2
Posts: 200
Joined: Sat Jun 10, 2017 12:28 am
United States of America

Defensive Sarge codes

Post by Secg »

As always, credits to TommyCD1 for how to make the AI use its Sarge & whatever Hero it has.

These additions to available codes will make the AI use its Sarge to defend his base against enemies who stray within range (how far is unknown idk ).

There are still two problems so far:
  • The Medic assigned to heal Sarge does not follow him properly

    When the player's base is next to an enemy base, there is a very high chance that the enemy Sarge will visit player's base to attack the player's Sarge. When that happens, Don't Panic, just fight him, the enemy Sarge will run back to his base when his Health falls below 199, & plyer's Sarge will still survive.
Extract the default.x file with DRPack or follow these instructions here

After extraction,

Put these lines into mod.cfg

Code: Select all

  
  ExecuteScript("defense.sarge", "personality.default.defense.sarge")
  {
    Op("%.danger", "=", 0.7);
    Op("%.types", "=", "personality.default.recruit.sarge");
    Op("%.base", "=", "base");
    Op("%.tag", "=", "personality.default.tags.sarge");
  }
  ExecuteScript("heal.sarge", "personality.default.sargeheal")
  {
    Op("%.tag", "=", "personality.default.tags.sarge");
  }
These into personality.default.base.cfg

Code: Select all

        // start cranking out some defensive vehicles and a barracks upgrade
        Add("personality.default.sargeheal", 1, 75, 0);
These into personality_default_orderers_units.cfg

Code: Select all

  // Sarge heal
  CreateBase::Orderer("personality.default.sargeheal")
  {
    Manifest("Level")
    {
      Script("heal.sarge");
      Types()
      {
        Add("army.unit.medicjeep");
      }
      CanBuild(1);
      Random(1);
    }
  }
And very importantly, these into personality_default_scripts.cfg

Code: Select all

  // Sarge
  CreateRecruitType("personality.default.recruit.sarge")
  {
    Type("army.unit.sarge", 1);
  }
  
  // Sarge script
  CreateScript("personality.default.defense.sarge")
  {
    InitialState("Recruit");

    CreateVarString("%.types", "");
    CreateVarFloat("%.range", 100.0);
    CreateVarInteger("%.acceptInsufficient", 0);
    CreateVarFloat("%.danger", 0.2);
    CreateVarInteger("%.cluster.target");
    CreateVarString("%.base");
    CreateVarString("%.tag", "");

    State("Recruit")
    {
      Action("Recruit", "TypeBase")
      {
        Config("%.types");
        Location()
        {
          Base("Base", "%.base");
        }
        Range("%.range");
        AcceptInsufficient("%.acceptInsufficient");
        Base("%.base");
      }
      Conditions()
      {
        Condition("ObjectiveCondition")
        {
          Condition("Timer")
          {
            Time(10);  // Wait 10 seconds. If we don't have a sarge then abort.
          }
          Transition()
          {
            GoToState("HaveSarge");
          }
        }
      }
    }

    // Do I have a Sarge?
    State("HaveSarge")
    {
      Settings()
      {
        Setting("Tag")
        {
          Tag("%.tag");
          Append(1);
        }
      }
      Conditions()
      {
        Condition("Count")
        {
          Amount(0);
          Operator(">");
          Transition()
          {
            GoToState("DefendBase");
          }
        }
        Condition("Count")
        {
          Amount(0);
          Operator("<=");
          Transition()
          {
            GoToState("Abort");
          }
        }
      }
    }

    //State("Find")
    //{
      //Action("ApplyRule")
      //{
        //Rule("FindUndefendedCluster");
        //Var("%.cluster.target");
        //DangerRatio("%.danger");
      //}
      //Conditions()
      //{
        //Condition("Count")
        //{
          //Amount(0);
          //Operator("<=");
          //Transition()
          //{
            //GoToState("Abort");
          //}
        //}
        //Condition("HitPoints")
        //{
          //Operator("<");
          //Amount(500);
          //Transition()
          //{
            //GoToState("ReturnToBase");
          //}
        //}
        //Status("Completed")
        //{
          //GoToState("Move");
        //}
        //Status("Failed")
        //{
          //GoToState("DefendBase");
        //}
      //}
    //}

    State("DefendBase")
    {
      Action("ApplyRule")
      {
        Rule("FindProtectBase");
        ArmourClass("structure");
        Var("%.cluster.target");
        Base("%.base");
      }
      Conditions()
      {
        Condition("Count")
        {
          Amount(0);
          Operator("<=");
          Transition()
          {
            GoToState("Abort");
          }
        }
        Condition("HitPoints")
        {
          Operator("<");
          Amount(399);
          Transition()
          {
            GoToState("ReturnToBase");
          }
        }
        Status("Completed")
        {
          GoToState("Move");
        }
        Status("Failed")
        {
          GoToState("Wait");
        }
      }
    }

    State("Move")
    {
      Action("Move")
      {
        Attack(1);
        Location()
        {
          Base("VarCluster", "%.cluster.target");
        }
      }
      Conditions()
      {
        Condition("Count")
        {
          Amount(0);
          Operator("<=");
          Transition()
          {
            GoToState("Abort");
          }
        }
        Condition("HitPoints")
        {
          Operator("<");
          Amount(399);
          Transition()
          {
            GoToState("ReturnToBase");
          }
        }
        Condition("ObjectiveCondition")
        {
          Condition("Timer")
          {
            Time(30);
          }
          Transition()
          {
            GoToState("DefendBase");
          }
        }
        Status("Completed")
        {
          GoToState("DefendBase");
        }
      }
    }

    State("Run")
    {
      Action("Move")
      {
        Attack(0);
        Location()
        {
          Base("Base", "%.base");
        }
      }
      Conditions()
      {
        Condition("Count")
        {
          Amount(0);
          Operator("<=");
          Transition()
          {
            GoToState("Abort");
          }
        }
        Status("Completed")
        {
          GoToState("Wait");
        }
      }
    }

    State("ReturnToBase")
    {
      Action("Move")
      {
        Attack(1);
        Location()
        {
          Base("Base", "%.base");
        }
      }
      Conditions()
      {
        Condition("Count")
        {
          Amount(0);
          Operator("<=");
          Transition()
          {
            GoToState("Abort");
          }
        }
        Condition("HitPoints")
        {
          Operator("<");
          Amount(199);
          Transition()
          {
            GoToState("Run");
          }
        }
        Status("Completed")
        {
          GoToState("Wait");
        }
      }
    }

    State("Wait")
    {
      Conditions()
      {
        Condition("Count")
        {
          Amount(0);
          Operator("<=");
          Transition()
          {
            GoToState("Abort");
          }
        }
        Condition("HitPoints")
        {
          Operator(">=");
          Amount(900);
          Transition()
          {
            GoToState("DefendBase");
          }
        }
      }
    }

    State("Abort")
    {
      Action("Discharge");
      Conditions()
      {
        Status("Completed")
        {
          End();
        }
      }
    }
  }
  
  // Sarge heal
  CreateScript("personality.default.sargeheal")
  {
    InitialState("Start");

    CreateVarString("%.tag", "");

    State("Start")
    {
      Conditions()
      {
        Condition("ObjectiveCondition")
        {
          Condition("Timer")
          {
            Time(180);
          }
          Transition()
          {
            GoToState("Move");
          }
        }
      }
    }

    State("Move")
    {
      Action("FollowTag")
      {
        Attack(1);
        Tag("%.tag");
      }
      Conditions()
      {
        Status("Completed")
        {
          GoToState("Move");
        }
        Status("Failed")
        {
          GoToState("Start");
        }
      }
    }
  }
ImageImage
User avatar
TommyCD1
Moderator
Moderator
Posts: 1143
Joined: Tue Jun 04, 2013 8:55 am
Location: East Coast
Contact:
United States of America

Re: AI mod suggestions.

Post by TommyCD1 »

Yes, the medic will lag behind severely, distracted by others who need healing. There is no way to avoid this.
I may not make the best maps, or be the best player, but I put a lot of time, effort, and care into my stuff. That counts for something, right? No.
Image
"Can we order a pizza?"
GameRanger ID: 913974
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest