MechWarrior 5: Mercenaries
0 of 0

File information

Last updated

Original upload

Created by


Uploaded by


Virus scan

Safe to use

Tags for this mod

About this mod

Updates the AI of both enemy mechs and your Lancemates AI to perform better in combat. New behaviors and logic to seem more human, and jumpjets enabled. No more circle of death. This combines both the prior EnemyAI and LancemateAI mods into a more efficient less bug prone package.

Permissions and credits
TableTopRulez AI MOD:

THANKS TO VonSeiten for the banner graphic and yrrot for advice on setups and Wpnx330 for help with the new order system for the lancemate mod.

This mod alters the AI for the game to better approximate battletech TT and how human players behave. General structure is also based on Alphastrike sourcebook for mech roles and practices. Mechs with this mod will use JumpJets to get into optimal range or to avoid damage. 

COYOTE MISSIONS: Let my mod overwrite coyote's mod unless you want my setup evasion and to hit charts to potentially give odd results.  If you use EasyAim modification (if my default difficulty is too hard)  make sure it overwrites the AIMod2, that file restores the default game hit percentages.

1.     Unzip the Mod file.
2.     Review the information on mech roles so you understand how they impact the AI
3.     Copy the TTRulezAIMod2 into the MW5Mercs/Modsfolder.
4.     Play the game

If you used formation changer you can use it as long as you do not use my TTRulez_LancemateOrderz optional file.  If you want to change to TTRulez_LancemateOrderz remove formation changer mod first-they use the same files.  Then add the TTRulez_LancemateOrderz mod.  You may need to jump at least one to two systems to avoid a weird keybinding issues.  

TTRulez_LanceMateOrderz (Optional file): New lancemate orders
New lancemate orders allow enchanced control of lancemates. 
PLEASE READ THE MANUAL ON THE FILES PAGE.  Special thanks to Wpnx330 for his help on the menus and to VonSeiten for his new graphics for icons. 

Installation: Unzip the TTRulezAIMod2 into MW5Mercs/ModsFolder. Then do the same with the LancemateOrderz.

1.  Once you have selected a lancemate or the entire group with the standard F1-F4, you then hit F7 to open the Engagement order menu.  This key is not remappable to ensure my mod is usable with any other mods.  Do not keybind another command to F7
2. Select the option you want to change with F1-F5.  
3. Be aware Engage at will/Focus fire and Stay in formation/Loose formation do NOT issue orders they modify the functions for how the attack my target and form on me orders work. So a second order has to be issued.
4. Check the Lance status menu it should show color coding for what you have selected:
--Green means free to engage per the AIs logic (aggressive) and blue means they are set to be more conservative (attack only one target or stay in formation)

Engage at will: When you order "Attack my target" the AI will set your target as the primary, but they will fight independently of the player using enemyAI Logic.  They will rejoin formation when ordered to by "Form on me" or when all visible enemy targets are dead. Please be aware that if they don't see an enemy and you do they rejoin formation despite enemies being in the field.  Remember you share targets when you lock them.

Focus  fire: When you order "Attack my target" the AI will set your target as their target. They may fire at other enemies if out of range from the target but once within range they will only fire at and focus on that target. They will rejoin formation once you order "Form on me" or the assigned target is dead. This is the vanilla game setup (but with my tweaks to behavior when far away) they will be very aggressive and close up on the target so not great for snipers.

Stay in Formation: The AI will use this when in "Form on me" The AI will fire at enemies but will not move to gain LOS or exhibit any new behaviors. They will literally stick to whatever their formation assignment is.  Works great for raid missions or setting up a firing line.  Not so good for areas with obstacles.

Loose formation: The AI will use this when in "Form on me" The AI will fire at enemies and move to maintain LOS to maximize damage output. Aggressive units will range in front of the player, while snipers and missile boats will hang back.  Scouts, strikers, and skirmishers have permission to leave formation and destroy nearby enemy targets particularly turrets and vehicles.

Defend target: Completely new behavior. You select a friendly target with your radar.  Then use this command to assign them as the defend target. Once assigned your lancemate(s) will form on them as an escort. This should work for mechs or vehicles. With non-lancemates the AI will form in 1 of 4 locations based on their speed with fastest units out front and slowest units to the back.  If you assign a lancemate to another lancemate they will form-up only to the rear as a wing.  You can assign up to 3 lancemates to a friendly target or 2 lancemates to another lancemate. You may not assign an enemy mech.

Change formation: 
Self-explanatory. Only available in the group orders. You pick one of the 8 new formations. Works will with stay in formation to form firing lines. Default is Finger four.

Change role: Allows you to change your lancemates roles on the fly. Only available in the individual orders.  So now if you want your sniper to focus on vehicles (VTOL and Tanks) set them to Antiaircraft. Allows players without YAML or MercTech to set new roles for mechs.

Move to location: This logic has the AI move to a location and guard there.  AI will look around, but I removed the patrol system of version 8.  When an enemy is engaged the AI will fight using nearby cover but will stay in the assigned area.

Jumpjets were built for MWO logic in MW5.  I have now restored them to TT values.  First, I set gravity back to 1.0g.  Default game had set at >2g to make them fall at a speed that looks like a human falling.  They seem floatier, but this is realism just like how a plane looks slow when it is going 300kph.  Using the new system the JJs cover a forward distance of 30m/JJ (TT values 1 hex per JJ) and height max of 8m/JJ.  So a 6JJ mech can jump 180m forward and 48mhigh in a 10 second period.  This makes JJ much more effective and defensive.  To compensate for players higher intellect on jumps I have reduced the JJ burn duration of players to 2.5 sec from 3.5 for mechs.  This allows you to get the same jump distance and height but no more super jumps. 
AI mechs lancemate and enemies now torso twist when being fired on.  This is triggered by the firing action of heavy weapons to avoid center torso autocannon and PPC damage and spreads laser damage.  The system will try to place the firing enemy onto a shoulder to catch the shot on the arm and move the arm to protect the torso and head.  The AI will preferentially present the left side since most mechs have main weapons on the right.  They will not twist if the enemy is in the rear arc.


The entire basis of this mod is to use roles as defined in "Alpha-strike" instead of the light/notlight/LRM system created by PGI. Roles are set at the beginning of play using the gameplay tag assigned roles from PGI for the mechs variant (PNT-2R) or the assigned roles from the mechlab with MercTech or YAML or by using the lancemate change role command.  If you are a mod builder making new variants, please remember to assign them the role you want them to fill on their UnitCard (preferably from "Alpha-strike" source material and/or Sarna).  In version 9 all mechs can use any behavior based on enemy number, distance, target and self damage, and current roles success or failure, however, they still have preferred behaviors from alphastrike.  Target preferences are determined by role and listed below:

Scout: Light fast mechs that generally focus on vehicles, turrets, and other light mechs. When none are available, they make slashing hit
and run or pass attacks at heavier mechs.

Striker: Fast light or medium mechs with minimal armor but heavy close-range weapons like SRMs that prefer to attack slow heavy enemies. They prefer to flank the target then rush in from the side or back and unload their payload then try to finish off the opponent as quickly as possible. Secondary role destroying fast light enemies if no heavy enemies are present.

Skirmisher: Light and Medium mechs with good speed or JJ with distance weapons, whose primary role is to remove light fast mechs from the battlefield to
protect the heavies and usually have at least one long range weapon. If no light mechs are present they will fight heavier enemies by maintaining range and cover (skirmishing), hit and run slashing attacks.

Juggernaut: Slow heavy/assault mechs with heavy weaponry who prefer other heavy enemies.  They aren’t much good at dodging so they wade in trying to wipe out the enemy and depending on firesupport/brawlers to keep opponents busy while they get close enough to devastate them.

Brawler: NOT what most people think from MWO (that is juggernaut). Brawlers are slower mechs with good armor and good long range weapons  they maintain a ranged fight against opponents usually at medium ranges, but will change range based on their opponents loadout (if the target is a sniper they will get closer).

Sniper/Firesupport: Slower long range mechs that prefer other slower heavier targets.  These mechs follow near heavier brawlers or juggernauts and once close to the enemy they deploy to high ground and cover the other closer opponents who keep their enemies busy.  If there are no mechs to support they try to maintain range and use cover.

Missileboat: LRM dependent mechs prefer slow heavy mechs or vehicles. These mechs move close to slower brawlers or juggernauts providing support but further back than Sniper/Firesupport.  If no mech to support they try to maintain range.

Antiaircraft: AC5 or 2 equipped mechs designed to destroy VTOL/ Tanks. They will preferentially target these unit types. Secondarily they
will function as Firesupport.

MercTech: Allow lancemate selection of roles in MechLab MercTech V3 (BETA) at MechWarrior 5: Mercenaries Nexus
    MercTechRequires compatibility mod:   MW5 ModCompatibility Pack at MechWarrior 5: 
YAML: Allows lancemate rolesetup through the quirk system Yet Another Mechlab at MechWarrior 5: Mercenaries Nexus

Biggest change to this mod is the new targeting system. It is the most complex thing I have built but I created a new radar system, building tracker, and entire target selection logic that is based off roles.  This should make the AI behave more realistically. The old aggro system and focus firing the player are gone.
  • Damage aggro: The AI now tracks how much damage it has taken from each enemy.  The personal damage it receives is the biggest component of it target selection. Old aggro system (which each enemy stored how much damage it did regardless of target) is divided by 3.5-5 depending on mech role, this reduces focus firing the player and makes them protect themselves but consider a high output damage enemy over a less active opponent. Also now counts shots to their back as double. Making them turn quickly on any
  • one shooting them in the back.
  • Distance: Proximity has a big impact.  Enemies directly in their face will demand attention.
  • Leads target: If a lancemate or in enemy lancewill give some preference for leads target depending on role (firesupport prefers this).
  • Same target: Have a slight preference to keep their own target. Limits too aggressive switching.
  • Prefer units targeted by allies (focus fire)
  • Prefer units near death to finish them off
  • Role dependent factors adds points but isn't the only reason they target a unit: 
  • Scouts prefer infantry and vehicles or if none available fast light mechs
  • Skirmishers prefer prefer fast light targets
  • Strikers prefer slow heavier slow opponents
  • Brawlers prefer heavier slow opponents
  • Juggernauts prefer assualt units
  • Firesupport prefer heavier units
  • Missile support prefers Vehicles or if none available slower mech
  • Anti-aircraft prefers VTOL, then vehicles, then slow mechs

This doesn’t apply to coop players. But lancemate’s and enemies in lances now share their combat targets. This reduces
missile lock breaks and makes missile mechs much more effective. It also means mechs don’t stand around dawdling while their companions are attacked. To make this seem less artificial there is a variable delay between checks to simulate being told and reacting. Now scout mechs and missile mechs have a special bond and missile mechs are more likely to target scout mech targets and scouts will communicate their target with missilemechs.

Visual detection changes: In the PGI version the enemy can detect you at 700m and tell you are an enemy at 500m. This is a bit visually off. I tested and have set the ranges to 1300m and 700m which is where I can tell the paint job of an enemy and see them clearly in the distance without zoom.  I did narrow their FOV so you may avoid detection still. Weather conditions alter identification range (700m clear, 600m night, 500m bad weather), ECM shortens this further to 400m regardless of weather and BAP removes weather and nighttime effects and extends range to 800m and cancels ECM effect.

LANCEMATE AI SKILL LEVEL BOOST: Lancemate’s accuracy sucked in default game. PGI had nerfed AI ability to hit targets at at a distance. You should notice improved lancemate damage output especially with PPC and long range weapons. 

Move to location: The AI will now Move to the location and set it as a guard location. If no enemies are nearby they will look around but no longer patrol. They will maintain space from allies to avoid friendly fire. If engaged by enemies they will move to maintain LOS and ideally take the high ground but will not wander farther than 250m from this location.

Follow me: The AI no longer run off leaving you behind.  They will stay in formation until you are engaged with enemies. Once the enemy is within 500m they will deploy according to their role. Juggernaut and strikers will deploy in front of you, while Brawlers and fire support deploy to your side. Missile boats deploy
behind you on high ground to maintain LOS. All will remain in close proximity and not wander off. 
  • Scouts and strikers will deploy against enemies if they come within 250m of the lead player.
  • Skirmishers will deploy against enemy light mechs and heavies (skirmish) if within 500m of the lead player. They will rejoin if they wander more than 500m from the player.
  • Lancemates will now jump down from cliffs to follow the player.
Attack my target:  The lancemates will attack the target.  If the target is outside their optimal range (250-500m depending on loadout) they will advance to optimal range shooting at targets of opportunity along the way (other mechs or vehicles) once in range they will focus on their target for the remainder of this command. Once the target is destroyed they will rejoin formation. 
  • Scout: Vehicles/Turrets will rush and attack them.  Fast enemies will engage in a circle fight using JJ to turn on the target. For slow enemies will HitAndRun where they attack get distance and circle back around.
  • Skirmisher: Rush vehicles/turrets. Fast enemies will circle fight. For slow opponents if they are fast (>90kph) will Hit and Run. If they are slow (<90kph) will engage in ranged combat flanking the target and retreat if taking heavy damage.
  • Striker: Rush non-mech enemies or circle fight.  For slow opponents will flank the enemy (deploy their side relative to lead making them focus on lead or self. Turning their back to one of the two.  After flanking they get in close.
  • Juggernaut: If not taking damage rush the target.  If taking damage and >250m away will use cover to approach. Once <250m will aggressively attack at short range.
  • Brawler: Attacks using the default PGI behavior for ranged mechs. So close circle fight but at a distance.
  • Ambusher: Will move in and out of cover shooting the target and minimizing time they take damage. Works best in cities.
  • Antiaircraft/Missileboat/Sniper/Firesupport: Marchon vehicles to kill quickly. If mechs they deploy to high ground near the player and will provide support fire.  If in bad condition they will change their role to fight at range in and out of cover.

LANCEMATE POSITIONING: They will use JJ to stay with the player and avoid being left behind. This allows you to bring support to shoot at enemies but move quickly between target areas and destroy the objective without losing friendlies who get left behind.  When you jump they jump to maintain position.

Enemyskill level: Enemy mechs now have TT values for hitting targets at ranges and are more deadly.  PGI nerfed their targeting so you could take on an army. You need to plan and use more skill now.  If this is too hard the new difficulty slider by PGI may help (it does not conflict).
NearDeathbehavior: To compensate for the skill level change the AI now reacts when its center torso structure (not armor) is <50% and total health is low.  They have several options with percentages that vary based on their faction:
--No change: 20-30% of the time they just keep fighting
--Defensive: They will use cover and try to move in and out of cover to reduce damage risk.
--Retreat: They will try to retreat from the fight and save their mech (it is a family heirloom). Once far enough away and out of player LOS they will disappear.
  • PLEASEDO NOT COMPLAIN THE AI IS BROKEN IF A MECH IS TRYING TO RUN AWAY—either kill them or let them go, in a real fight you should focus on the objective not to get kill points.  If you do chase them I have a timer that kills them now regardless.
--Heroic charge: Self-explanatory. They forget all other logic and get in close to duke it out.
--Panic: They lose their cool and eject even though not destroyed.
--Suicidal rush: They charge the enemy at full speed, slamming into them for damage and then eject their core for more damage…this is rare but watch out.

EnemyLance behavior:
  Complete overhaul. The old system was causing stutters and too costly.  This system is all new in version 9.  Dynamically units register with a director, when enough units are available if has a good lead will attach formation locations which then look for additional firesupport units.  In addition light mechs now have a system for preferring ganging up on an enemy heavy mech.  They will not exclusively do this and only do it when not outnumbered by fast mechs.

Enemies track how much damage they have taken in 10 seconds and based on their max structure and armor will seek cover if at risk.  This chance is based on role so Juggernauts get cover less than scouts.

NEW AI BRAIN: The AI now considers numbers on both sides and fast vs slow mechs as well as current damage and damage ouput to target and from target.  Will generally use roles but may use any behavior.  Should see more varied  responses.

NEW DETECTION SYTEM:  In the PGIgame the AI would automatically assign the player as a target if no other target was perceived.  While effective this was a bit artificial and meant players got first volleys often.  In warzone the AI will be provided the players location simulating the nature of this engagement. In raid and other missions, interdiction lances will get a random location near the player but will not actually have the player as a target. They will investigate this area and if they spot the player engage.  This gives you the potential to dodge these units on this mission type.  Periodically they will get updates on your location so if you get bogged down they will likely catch up. However, this and new visual cones increases stealth opportunities.  For infiltration missions the AI has a pause and an audio alert. You have several seconds before they come to your area to relocate. Hiding doesn't work since they move to your area.

Enemies are divided into Weapon mechs, Melee mechs, NonMelee mechs, and Regular mechs: Melee mechs are those listed on sarna as being hand to hand focused mech builds with specially designed fist. This includes : Archer, Atlas, Awesome, Banshee, Blackknight, Charger, Dragon, Hunchback, Shadowhawk.  NonMelee mechs are those with no arms: Balckjack, Catapult, Champion, Cicada, Flea, Jagermech, Jenner, KingCrab, Locust, Raven, Rifleman, Stalker, Urbanmech. New to version 9 they now are even more aggressive if they have weapons.  

System: The AI doesn't run amok trying to do melee. Mechs are still ranged platforms. They will evaluate melee if close enough and check their speed and target speed and if they think they can catch the target they will attack. The chance of this is higher for weapon and melee mechs.  For version 9 added direction and standstill check which improves understanding of ability to catch a faster unit. 

Weapon mechs: These mechs have a 75% chance to engage in melee with more aggressive ranges
Melee mechs: These mechs have a 50% chance to engage in melee when an enemy gets too close
Regular mechs: These mechs have a 10% chance to melee
NonMelee mechs: These mechs will not try to melee

This mod is a complete rebuild of the enemy AI behavior trees (all of them) along with a new brain system that allows more behaviors based on situation, so there may be bugs still. 
1. Fixed a major error where I was looping through all mech unit cards every time a mech loaded instead of just once. Now fixed. Major improvement in stutter on new mechs loading.
2. Spaced out logics to reduce stutter on mechs loading
3. Several efficiency fixes in logics.
4. Future proofed targeting to detect and fix logic if units change targets
5. Found error where the AI wouldn't change its targeting logic if the player changed his lancemates roles
6. Reworked melee so the AI is more aggressive and fixed some issues with smoothness of melee also added weapon detection thanks to Magnum
7. Built a new low cost system where fighting units register and allows a sense for AI of unit types and being outnumbered to allow judgement on fights.  You should now see the AI stay closer together or use cover more when outnumbered and flank or use other logics that spread out when less enemies (you may see them get behind you and divert your attention).  
8. New registration system assigns ideal wolfpack targets. Once assigned and enough light mechs the AI lights will have a preferred heavy target. They should focus as a group on this unit, however, they will not do this if being targeted and heavily damaged by another unit. 
9. When enough units will add formations to the heaviest slow unit and work like a lance.  Replaced the old lance system which rarely occurred and was costly.
10. Finally figured out why sometimes mechs would just stand there.  For some reason some were spawning far away and not attaching my new targeting radar. I changed my bootup system with checks to make sure everything is loaded correctly and if not to then boot them up.  Should now be fixed.

Fix for sometimes loading the AI before the Mission Director resulting in stuck mechs

COMMAND MECHS (See below):
--Phoenix hawk

1. ECM and BAP changes: Thorough review of ECM and BAP, as prior system was simplistic. Now ECM mode switching is detected and effects AI identification range (range at which they know to shoot a target that isn't firing back).  The new system compares the potential target and the AI mechs ECM modes and use of BAP ot determine if they are able to be added as a target.  This has the effect of making ECM mechs harder to identify unless very close.
--BAP also is now more useful and not only adds to detection range for mechs but can also counter ECM to a lesser extent (less than ECM in counter).
--Now ECM and BAP interaction effect target sharing (see below)

2. Target sharing: Overhauled system so ECM makes it harder for an ECM mech to be shared with other AI units--making them harder to target. This is counteracted by BAP or another ECM.  This should make light and medium mechs with ECM more survivable.  
--In addition, I added a new feature to make BAP, command mechs, and scouts be more useful.  Every 10 seconds these mechs now get a radar feedback of active enemy units in the area.  If within radar range [BAP (600m), Command mech (350m), Scout mech (450m)] the unit will share all these targets with the player radar and fellow lancemates.  This allows the player more opportunities to have missile lock on distant targets without direct LOS or AI Lancemate locking the target themselves (should make missileboats with scout mechs more viable. 
--If the target has ECM this range is reduced to 100m but may be counteracted by BAP to 350m. 
--Please note I cannot make the AI units fire in this system with missiles. The targeting system for AI requires LOS and is PGI only (no editing)
--Please note to prevent gaming the system the scout effect only works for medium and light units. You cannot set the role of an assault to scout and get the radar effect.

3. Put in further redundancies on the formation logic for enemies to avoid any fringe crashes
4. Fixed the remaining sections of the AI logic where they were using PGI old combat logic to all use my logic now.  This should avoid some situations where players described my AI ganging up on the player or jumping oddly.  
5. Updated the faction and Panic logic.  Increased AI chances of maintaining current fighting and not running away.  Labels on ranking system by faction updated for friendly units in addition to hostile units.  
6. Made new system for AI (enemy not lancemate) pilot skill adjustments (firing frequency based on skill level) that runs off their AI skill level or if that fails weapon level.  
7.  Reviewed infiltration.  Seemed to generally be working like I wanted but it is hard. I made a few tweaks to give the player more chance to find cover and fixed the system so medium atmospheric interference now counts the same as night, making it more likely to evade targets.
8. Adjusted the audio alert for sensor sweep detected so instead of checking if the enemy AI is in combat, it checks if any enemy units are in combat.  This should reduce it only to the initial sensor detection and reduce the number of times a player will hear that audio.
9.  Created new HUD (did not alter the HUD) widget to display which lancemate by name has been cored and at risk of death (no center torso armor and remaining internal structure below 50%).  If the pilots name fails to retrieve it will display the mechs name. This only runs once per pilot and only last for 2 seconds.  I am trying to make it easier to tell if your lancemates are in trouble. 
10. Realized an error in the PickCombatTarget logic, where they were not actually picking up on the leads target if the lead was a human pilot. 
11. Added focus fire back into the game.  The game now gets and stores the focusing setup of the pilot behavior config.  When my focus fire logic runs to add aggro points to a target the pilot setting now adjust the number of points applied.  This makes it so rookie pilots are much less likely to focus fire than advanced pilots.  I will be updating this for the lancemates in the future. For now all lancemates prioritize focus fire since their configs are all set to high for this.

1. Lancemates logic has not been updated. Will be reevaluating for the next version.  I am considering a popup window for choosing options with move to location and formation/role choices with a new command to free up slots for additional commands.
2. Reviewing infiltration system to see if should be tweaked
3. Will review update system audio and maybe add/replace with visual cues.