Jump to content

Friendly AI

From WarhammerWorkshop
Image of Squad mates on Decapitation. Sniper and Assault pictured

Squad Mates[edit | edit source]

In Space Marine 2's Operations Game Mode you have the option to play with 3 other players through a mission, or run a mission solo. When you run a mission solo you are given squad mates in the form of AI. They can be any of the 6 classes in game, and they have their own predefined weapons and armor. In vanilla, while useful, these squad members are bland and cannot be edited at all. But by editing their files, they become heavily customizable. Before continuing, you should read: Squad Mates

What Files Contribute to Squad Mate Customization?[edit | edit source]

There are a lot of files that will allow you to customize your squad mates, and there are multiple different methods for customization. These files can control weapon loadouts, armor, and color of each Squad Mate.

Character_Customization_Library.sso[edit | edit source]

This file among other things, contains one of the simplest ways to edit the armor of AI squad mates. This file is located in: "client_pc\root\paks\client\default\default_other.pak\ssl\body\customization."

This is how character_customization_library.sso defines what goes into the first armor slot.
This is the armor the bot will use

Predefined Armor Presets[edit | edit source]

The reason AI squad mates look bland and without helmets in vanilla is because that is the first predefined armor slot. (see right) character_customization_library.sso is the file that defines all of these predefined armor slots for every class. (see left) Each preset can be edited to show different armor parts including DLC and Community Event Armor, and even armor parts of other classes.

Squad mates using edited armors on Decapitation

Every preset is split up into 10 entries: HELMET, BACKPACK, CHEST, LEFT_PAULDRON, RIGHT_PAULDRON, LEFT_GAUNTLET, RIGHT_GAUNTLET, LEFT_GREAVE, RIGHT_GREAVE, and VANITY. Changing these entries will edit how the predefined armor slot will look. And changing PREDEFINED_PRESET_1 will change how the AI squad mates look in game. (see right) To find the names of armor pieces look at the other presets for a class, or scroll down to the "bodySections" section for each class. To know what they look like, have the game open in another window and look at the armor with the corresponding name. Example: "chest_soldier_common_01" will be the first common (grey) chest plate option on Tactical.

Dark Angels chapter presets

Global_Armor_Color_Pattern_Library.sso[edit | edit source]

This file defines colors, decals, and the colors of decals for every chapter preset in the game. By changing the defined colors and decals of a preset you can create custom chapter preset to use in your mods. This file is located in "client_pc\root\paks\client\default\default_other.pak\ssl\body\customization."

Predefined Chapter Presets[edit | edit source]

A predefined Chapter Preset typically looks like the image on the right for the Dark Angels preset. There will be slight differences between presets. Some define the color of decals, some will specify shoulder pauldron markings by class, all of these can be copied and pasted into one preset for maximum customization.

Custom Preset replacing the default Ultramarines preset.

The AI Squad mates are programmed to always be Ultramarines. But the Ultramarine colors can be changed. I'm going to sneak in a quick tutorial here. If you look at the Ultramarines section at the very top of this file, you will notice it does not have color definitions. To change the color definitions that don't exist we have to steal them from another Chapter Preset. Copy the "mainColoring" section from the Dark Angels preset, and paste it right above the "decals" section in the Ultramarines preset.

You can now edit the Primary, Secondary, and Tertiary colors of the Ultramarines preset, and any colors you set it to will appear on your squad mates while playing solo. A list of available colors can be found in "armor_color_library". Changing the colors of a predefined color preset will replace it with your colors, so changing the colors of the Ultramarines preset means you will no longer have an "Ultramarines" preset.

Custom preset being applied to bots in game.

Coloring Specific Body Parts[edit | edit source]

As you can see in the Dark Angels preset there is a "bodySectionsColoring" section. Inside of this section it says "CHEST" with color definitions below it. You can think of this as using the UI in game to add a color rule for a body part, just doing it through text. So "mainColoring" is the "General Rules" for your custom pattern, and "bodySectionsColoring" is the "Custom Rules" for your custom pattern. You can copy and paste this section and change the "CHEST" to HELMET, HELMET_LENSES, BACKPACK, LEFT_PAULDRON, RIGHT_PAULDRON, LEFT_GAUNTLET, RIGHT_GAUNTLET, LEFT_GREAVE, or RIGHT_GREAVE. Then edit the colors to whatever you would like. When adding HELMET_LENSE colors, you only need a primary slot and where it says "_type =" in the colors section, change "CustomizationBodyColoringInfo" to "CustomizationBodyColoringInfoLenses" for proper light emissions from the color. The Bulwark Shield is the only VANITY item that can be colored.

Changes you make to color presets will be applied to ALL squad mates, you cannot color Squad Mates separately using this method.

Making Bots Look like Your Classes.[edit | edit source]

The Above method works great for simplicity applied across all Classes in an operation. But there is an easier method that makes editing the AI Squad Mates as easy as customizing your own classes.

Every PVE class has its own client file named "npc_bot_marine_CLASSNAME_client.cls". These files can be found in "client_pc\root\paks\client\default\default_other.pak\ssl\characters\bots." Within the client files for each class, very close to the top is a line called "prop_character_customization_state_local". This line can be changed to "prop_character_customization_state_authority".

Once this line is changed, you can customize a class in game in the armory, and when you go into an Operation solo, your squad mates will look exactly like your character, with your amor, colors, and decals. If you have not customized your character's colors or armor yet, a bot will spawn using the armor from PREDEFINED_PRESET_1 and will Spawn looking like an Ultramarine.

The weapons you pick in the armory will not be what the bots use. To change Bot Loadouts read the section below this.

WARNING: Changing this line will stop console players and people playing on a vanilla version of the game, or a modded version that do NOT have this changed in their files, from joining your lobby. They will get hung on "Joining Server" and never load.

Weapon_Bot_Loadout_Templates_Library.sso[edit | edit source]

AI squad mates get their weapons predefined by Class, and then Difficulty, in weapon_bot_loadout_templates_library.sso. This file is located in "server_pc\root\paks\server\default\default_other.pak\ssl\main\user\weapon_loadouts\bot_templates"

Soldier Weapon Loadouts by difficulty.

Defining Weapons[edit | edit source]

Each difficulty section has a primarySkill, secondarySkill, and meleeSkill. These "Skills" define the type of weapon each class will use when they are a Bot. Changing the entries for these 3 spaces will change the type of weapon that the Bot will use in a mission. The equipmentSkill space is for grenades. Bots can be given any grenade, but do NOT know how to use Melta Bombs, they will place them, but will not detonate them. You can find a list of available weapon names in firearm_library_pve.sso. A weapon does not have to be one that is on the class in the vanilla version of the game. You can give the Bulwark a Heavy Bolter using this file.

Underneath weapon skills are the variables that define the version of the weapon. primaryVersion corresponds to primarySkill, secondaryVersion to secondarySkill, and meleeVersion to meleeSkill. These versions are the versions you can select in the Armory.

01 = Common (Grey), 02 = Master Crafted (Green), 03 = Artificer (Purple), 04 = Relic (Gold)

You can get even more specific with "0#_x". So if you wanted the 3rd Relic variant you would fill in the space as "04_b" because 04 is the first variant. For a list of weapon Variants you can chose from see firearm_modificators_library.sso. When you set a weapon to a specific version, the skin applied to that version will be equipped, and values associated with that version will also be applied to the weapon.

Weapons and weapon versions do not have to be the same on every difficulty so you can make your Heavy bot use a Heavy Bolter on the first 3 difficulties, and a Multi-Melta on the last 3 difficulties.

Expanding Arsenals[edit | edit source]

You will notice that some characters do not have a primary or a melee slot. In cases like this if you would like to have a squad mate like the Bulwark have a primary weapon, you need to add a primarySkill and primaryVersion, and then define the weapon and version. A character having a skill slot does not have to remain consistent on all difficulty levels. Your bulwark can have no primarySkill on the first 3 difficulties, and have a primarySkill on the last 3 difficulties.

Bots with Relic/DLC weapons on Decapitation, Sniper and Vanguard Pictured.

Giving AI Squad Mates Perks[edit | edit source]

As of the 7.0 Update any perks with the "perkApplicationAttachToPlayers" tag will cause Operations to break when loaded. Reliably this is every Team Perk, but always double check in perk_server_factory.sso for the tag.

NPC_Bot_Marine_Base_Server.cls[edit | edit source]

This file contains a section that controls applied perks across all classes for AI squad mates. By default they have no real class perks and only have the shown "Bot Buff Perks", that make them stronger so they are more useful to the player. This file is located in: "server_pc\root\paks\server\default\default_other.pak\ssl\characters\bots."

The section of this file that controls perks is called "perk_holder_server". It is in this section you can add perks for the bots to use. Perks MUST have a comma and a new line after every entry except the last. Keep in mind that any perks you apply here, will be applied on ALL AI squad mates when applicable. A list of available perks can be found in perk_server_factory.sso.

It is important to know that the perks in the image above are required for certain abilities to work on bots, such as when you place a banner down as bulwark, without those default perks listed, armor and contested health will not be regained for bots while in the banner area.

Applying Perks to bots Individually[edit | edit source]

The Above method applies Perks to all bots regardless of whether or not they should have that perk. This is a different method.

Every PVE class has its own server file named "npc_bot_marine_CLASSNAME_server.cls". These files can be found in "server_pc\root\paks\serverdefault\default_other.pak\ssl\characters\bots." These files should look relatively empty, but notably are missing the perk_holder_server section that was present in npc_bot_marine_base_server. So to apply perks to the bot, we need to steal that section from npc_bot_marine_base_server. Copy and paste it anywhere after a purple closed squiggle bracket in these files. You can now apply perks the same way as you did in marine_base. You can apply perks to this section that do not belong to the class as well.

Adding the perk_holder_server section to the individual class server files, will overwrite anything in the perk_holder_server section of npc_bot_marine_base_server. So perks applied through that file will no longer be applied to the class unless reapplied in the perk_holder_server section you added to the Class server file.

Remember that the perks in the perk_holder_server section in npc_bot_marine_base_server by default are required for certain abilities to work on bots, such as when you place a banner down as Bulwark. Without those default perks listed, armor and contested health will not be regained for bots while in the banner area.

Other Friendly AI[edit | edit source]

Other Friendly AI can be spawned through the ESD Manager and the Factions and Compositions Library. Things Like Imperial Guard, Space Marines, and Dreadnoughts can be spawned in to assist the player using these files. But if their packTypes are set to AGGRO instead of IDLE they will attack the player.

Imperial Guard[edit | edit source]

Imperial Guard spawn in some missions by default, but they can be added to all Operations, and have their squad numbers increased using the ESD Manager or the ESD Factions and Compositions Library. They can have various stats like Health, Damage Sensitivity, and Speed edited in their server file located in "server_pc\root\paks\server\default\default_other.pak\ssl\characters\imperium". This file is called npc_guardsman_server.cls. You could also use this file to give them space marine weapons if you wanted. A full list of weapons can be found in firearm_library_pve.sso.

They can have their size and TPL (model) edited in their client file located in "client_pc\root\paks\client\default\default_other.pak\ssl\characters\imperium". This file is called npc_guardsman_client.cls. You could also use this file to give them a boss bar if you wanted for some reason.

Space Marines[edit | edit source]

Spawning Space Marines in Operations is a little more complicated but editing them is almost the same. Server and Client files exist for a Tactical Marine, an Assault Marine, a Deathwatch Space Marine, these units all link back to npc_imperial_marine_server.cls on the server side, and editing this file should change the stats for the rest of them. Things like Damage Sensitivity and Speed. The file should be located in "server_pc\root\paks\server\default\default_other.pak\ssl\characters\imperium\impmarine".

The Models of each of these can be changed in their respective client files located in "client_pc\root\paks\server\default\default_other.pak\ssl\characters\imperium\impmarine".

Dreadnoughts[edit | edit source]

Dreadnoughts can be spawned through the ESD Manager and the ESD Factions and Compositions Library. They can have their stats like speed, damage sensitivity, and weapon they are using inside the npc_dreadnought_server.cls file located in "server_pc\root\paks\server\default\default_other.pak\ssl\characters\imperium\dreadnought". A full list of weapons can be found in firearm_library_pve.sso.

Inside the npc_dreadnought_client.cls file you can edit their Model and size. This file is located in "client_pc\root\paks\server\default\default_other.pak\ssl\characters\imperium\dreadnought"

How can I spawn these characters in my Operations[edit | edit source]

Some characters are set up for most operations like Guardsmen and Dreadnoughts, and getting them to spawn is as simple as replacing an archetypeUid with their own. But in some cases characters are not set up on missions, and need to be set up manually. A tutorial will be made sometime soon on how to do that.

This Page is incomplete but the Tech Priest(s) who scribed it has exhausted their memory banks on this subject. If you have more information please feel free to complete the page.


Behavior Trees[edit | edit source]

Behavior trees are located in the various subfolders within "server_pc\root\paks\server\default\default_other.pak\ssl\characters\".

During combat, Allied bots and NPC Marines both use the combat loop ssl\characters\imperiump\impmarine\imperial_marine_combat_loop.sso and its siblings imperial_marine_special_group.sso and imperial_marine_ultimate_group.sso

For traversal/following/rubberbanding only the allied NPC Marine bots use that behavior in bot_behaviour_tree.sso. The other Marine AI use a much simpler "base" behavior tree tree.