Important Questions

Have modding questions or discovered something new? Post here.
User avatar
{RaheeXF}
Map Maker
Map Maker
Posts: 171
Joined: Tue Jun 15, 2021 6:45 am
Virgin Islands (USA)

Bulldozer and Mine-layer

Post by {RaheeXF} »

Hey!

How do I command a (AI) bulldozer to construct pillboxes, guard towers and barbed wire posts at a specific place (X,Y,Z)?
Also, is it possible to tell an AI's mine-layer to place mines at random places?

Thanks in advance. :COFE:
*RaheeXF*
User avatar
TommyCD1
Moderator
Moderator
Posts: 1152
Joined: Tue Jun 04, 2013 8:55 am
Location: East Coast
Contact:
United States of America

Re: Important Questions

Post by TommyCD1 »

You can try to use trial and error to get an AI player to build in a general location you want by tweaking the placement rule's desired angle and distance values. However you cannot force a computer to build in a specific cell.

You can give an orderer of mines to an AI in the same manner you give it towers or any other building, and assuming it also tell it to use / build a minelayer, it will build mines as expected. However, they will still have to rely on a placement, which cannot be "randomized" or otherwise influenced very much.

Realistically, the AI is not very smart, especially when it comes to base building, and it should only be told to do so when it is absolutely necessary, such as in a multiplayer environment. If you are making a single player mission, then I would recommend simply giving it towers and mines manually through studio.
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
{RaheeXF}
Map Maker
Map Maker
Posts: 171
Joined: Tue Jun 15, 2021 6:45 am
Virgin Islands (USA)

Re: Important Questions

Post by {RaheeXF} »

I will give the AI towers and mines manually but I want the AI to re-build the stuff when player destroys them so the mission becomes interesting and cool. Meh. Thanks.
*RaheeXF*
User avatar
TommyCD1
Moderator
Moderator
Posts: 1152
Joined: Tue Jun 04, 2013 8:55 am
Location: East Coast
Contact:
United States of America

Re: Important Questions

Post by TommyCD1 »

Of course, assigning mines to base orderers like towers will make them be rebuilt when destroyed. It's just that getting a specific tower or mine into a specific single spot on the map is unfeasible. Especially given that when the building is lost and must be remade, the AI will prefer not to reuse the previous location anyway, instead opting to slightly reposition it. This can be observed in real time: try playing multiplayer and repeatedly destroying a computer player's towers. They will continue to rebuild them in slightly different spots each time, given the tower reached completion that is.
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
{RaheeXF}
Map Maker
Map Maker
Posts: 171
Joined: Tue Jun 15, 2021 6:45 am
Virgin Islands (USA)

Re: Important Questions

Post by {RaheeXF} »

I have some few questions... I'd be happy if you answer...

1. I was editing the Default Multiplayer AI. When I was testing it, I realized it makes the specific units and stays in base until the player detects or finds the enemy base. If the enemy base is far away, sarge of AI does not attack or try to find the base.

2. When they start to attack, if a unit dies, all the units head back to base and then recruit that one dead unit then attack again... It's super annoying...

3.If the AI is being attacked, it ignores the building Orders and keeps making units until the battle stops. (For example: It stops building AA guns just because a battle is going on)

4. Is there any way to tell the AI to start building instead of waiting for dump-trucks to gather resources?
*RaheeXF*
User avatar
TommyCD1
Moderator
Moderator
Posts: 1152
Joined: Tue Jun 04, 2013 8:55 am
Location: East Coast
Contact:
United States of America

Re: Important Questions

Post by TommyCD1 »

  1. I am unsure what you are asking.

    If you want your computer player to be more aggressive in its enemy locating, you can try to adjust the squads' %.dangerRatio variable. The danger ratio is a multiplier to the squads overall "score". That is, it calculates its score based on its offense and defense, then locates a cluster of enemies which as a lower score than it. Therefor, increasing this multiplier makes it more "powerful" meaning it is more willing to engage stronger enemies.

    However, if you are asking how to get an AI to use its Sarge, then you must first recruit Sarge. Take a look at the squad_move_typebasetotrail.cfg script file from the base.x archive:

    Code: Select all

      State("Recruit")
      {
        Action("Recruit", "TypeBase")
        {
          Config("%.types");
          Base("%.base");
          AcceptInsufficient("%.acceptInsufficient");
        }
        Conditions()
        {
          Status("Completed")
          {
            GoToState("Move");
          }
        }
      }
    It uses a state which recruits a recruit type from a base. The recruit type is the squad of units the script asks for, such as seen in campaign missions:

    Code: Select all

    CreateRecruitType("caravan")
    {
      Type("army.unit.bulldozer", 1);
      Type("army.unit.grunt", 6);
    }
    Therefor, what you could do is to create a recruit type in your persona file to reference, then recruit the Sarge from the base into a script. From there, you can use him as you would any other squad.
  2. This is most likely due to the script's "HitPoints" condition.

    Code: Select all

            Condition("HitPoints")
            {
              Operator("<");
              Percentage(90%);
              Transition()
              {
                GoToState("HeavyFire");
              }
            }
    I am unfamiliar with the scripting, but it seems that when the squad's total health pool reaches below 90%, then the squad will transition to the "HeavyFire" state.

    Code: Select all

        State("HeavyFire")
        {
          Conditions()
          {
            Condition("Threat")
            {
              Amount(10%);
              Operator(">");
              Transition()
              {
                GoToState("SeekShelter");
              }
            }
            Condition("ObjectiveCondition")
            {
              Condition("Timer")
              {
                Time(30);
              }
              Transition()
              {
                GoToState("Wait");
              }
            }
          }
        }
    This code tests if the current "Threat level" is greater than 10%, in which case it tells the units to run away to a sheltered area.
    Again, I am not too sure of how this code operates. For example, I am completely unsure what the "threat" is or how it is calculated. You could try removing all "HitPoints" conditionals from the script, so the squad no longer considers its healthiness.
  3. I do not understand the cause of this either. I think it may have something to do with orderer priority? Perhaps the units have a higher priority than the late game towers, such as AA Guns. Therefor it does not want to purchase them until it is sure it can complete the higher priority orderers, including the infantry.
  4. Not that I am aware of. The only instance of an AI buying something it does not have enough to afford is if you are actively destroying a building it is trying to build, in which case the Bulldozer will immediately restart construction. If your AI does not have enough resources, then it needs better resource management. Unfortunately this is the nature of writing multiplayer AI. If you cannot get it to make enough dump trucks or enough depots, you may have to sacrifice some offensive power and settle for smaller or less expensive units.
I would suggest taking a look at some of the scripts in the base.x archive to see how they operate. They can provide helpful ideas both in utilizing or recruiting units. You can see how they are used in the mission scripting as well. The default scripts are located in the ai/scripts/ folder of the archive.
I would also recommend taking a look at the Dark Reign 2 source code for AI files, as they could be helpful in determining how the script may behave. Everything in the coregame_ai folder is relevant, but some specific files to look at include:
  • coregame_ai/strategic_script.cpp
  • coregame_ai/strategic_location.cpp
  • coregame_ai/strategic_script_recruiter.cpp
  • coregame_ai/strategic_rule.cpp
  • coregame_ai/strategic_script_state_actions.cpp
  • coregame_ai/strategic_script_state_conditions.cpp
  • coregame_ai/strategic_script_state_settings.cpp
  • coregame_ai/strategic_script_state_transitions.cpp
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
{RaheeXF}
Map Maker
Map Maker
Posts: 171
Joined: Tue Jun 15, 2021 6:45 am
Virgin Islands (USA)

Re: Important Questions

Post by {RaheeXF} »

Thank you very much! By the way, I have one more question. Is there any way to command the AI to find the enemy bases (In Multiplayer) and use the radio operator to air-strike the opponent's base?
*RaheeXF*
User avatar
TommyCD1
Moderator
Moderator
Posts: 1152
Joined: Tue Jun 04, 2013 8:55 am
Location: East Coast
Contact:
United States of America

Re: Important Questions

Post by TommyCD1 »

No. The only way to have a computer use an airstrike is to manually drop it on a region. Regions cannot be arbitrarily created during gameplay, and so such an ability must be hard coded into the map itself.
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 0 guests