Author: alarm9k
Author Website:

Requirements: No addons required

Version: 1.8
Signed: Yes, serverkey included

Short description: Armored vehicles rotate to face the threat and pick priority targets

Date: 2014-10-24 21:38


Comments: (8)
Rating:



 

Smarter tanks

by
alarm9k


Description:
Have you ever been irritated by stupid far from optimal AI controlling the tank and being destroyed by one RPG shot in the rear? Only because it didn't bother to rotate the hull to that AT soldier? Or because it was firing at a harmless rifleman instead of taking care of enemy APC? Well, this script is for you.


Features:
  • Vehicles assess the threat/value of the targets and fire at the most dangerous/valueable target it range. It will prefer AT rifleman over autorifleman, tank over MRAP etc. Threat and value calculations use the type of target, distance and ammo types available (for tanks only). For example: AT rifleman 700m away is a more valuable target for the tank than MRAP-HMG at the same distance, but only if the tank has HE rounds. Otherwise it will prefer to fire AP round at MRAP, as the infantry unit is unreachable with current weapons. But AT rifleman still remains more dangerous than MRAP.
  • Tanks will use appropriate rounds (if available) for different types of targets: HE for infantry and static weapons, HEAT for lightly armored targets (MRAPs, trucks), AP for heavily armored (tanks, APCs etc).
  • Tanks will identify groups of infantry and use HE rounds agains them. A group is 3+ men in 15m radius. By default the tanks will not spend HE rounds on a single infantry unit (unless it's a high-threat AT soldier).
  • If the vehicle is a tracked vehicle (tank, tracked APC etc), it rotates the hull to face the most dangerous target.
  • If the threat is too high (for example an AT soldier at a close range), the moving vehicle will stop immediately, rotate the hull and fire. When the immediate threat is eliminated, it will proceed with the previous move order. This will presumably save the vehicle in situations when a hit is inevitable and the best decision is to stop and take the hit to the frontal armor rather than continue moving and take the hit to the side/rear.

Installation:
Extract into the ArmA 3 Directory, by default this is located in:
32-Bit - C:\Program Files\Steam/Steamapps\Common\ArmA 3\
64-Bit - C:\Program Files (x86)\Steam/Steamapps\Common\ArmA 3\
After extraction it should look like this:
Steam\Steamapps\Common\ArmA 3\@your_mod_folder_name\addons\

You can also use the "Arma 3 Alpha" folder in your "My Documents" folder. Your folder setup could than look like for example this:
mydocuments\Arma3 Alpha\@your_mod_folder_name1\addons\
mydocuments\Arma3 Alpha\@your_mod_folder_name2\addons\
mydocuments\Arma3 Alpha\@your_mod_folder_name2\addons\

When present place the "userconfig" folder into your game install folder, usually:
"C:\Program Files (x86)\Steam\steamapps\common\Arma 3".
You may already have "userconfig" folder from other addons and/or mods in which case it is safe to merge the contents from this archive.

You'll also need to add a Launch Parameter to Steam, in order to do so right-click on ArmA 3 Alpha and click Properties and then Set Launch Options. In the window that opens enter in -mod=@your_mod_folder_name
For using multiple mods you would then do so like this:
-mod=@mod_name;@mod_name2;@mod_name3;@mod_name4;@mod_name5

Note:
You can also use -nosplash to get rid of the splash art and intro videos.


And of course you can also enable and disable community made addons and mods through the in-game Options Expansions menu if you do not want to mess with startup parameters!

When the above information still does not provide you with enough to learn how to install custom addons and mods you can always ask in our Guide On Installing Mods.


Included files:
alarm.pbo


Usage:
Some of the use cases below assume that the vehicle is in the player's group and the player can issue direct commands to the vehicle's crew, which is not always the case. If it's not then some of the options won't be available: for example, changing default round type.

Smart behaviour is activated automatically if the vehicle has an AI crew. This includes the vehicles created with the crew inside, or empty vehicles occupied after the mission start etc. Smart behaviour is activated for all factions and all groups: AI groups, vehicles in the player's group and High Command.
If either gunner, driver or commander is a human player, the smart behaviour is suspended and manual control is assumed. If the human player is replaced by AI at any moment, the smart behaviour is re-enabled.
Vehicle commander's behaviour must be either Stealth, Aware or Combat. To disable 'smart' behaviour set the commander to Relaxed. This is just a sort of 'switch' for dynamically enabling or disabling the smart behaviour during the mission, until I implement a separate action menu.
To disable hull rotation but keep picking priority targets issue a Stop order (Action menu 1-6). The vehicle will go into Waiting state.
To resume full 'smart' behaviour, including hull rotation, issue a Move order at the vehicle's current location: the vehicle will not actually move but will go into Ready state.
If you don't want the tank to halt after encountering an immediate threat, set the commander's behaviour to Stealth. It will continue to execute its move order regardless.
For tanks there is such thing as 'default round type'. Tanks start with AP as the default. Tanks will have default round loaded unless they fire at a different type of target. If you manually give the tank commander to 'Reload HE-T`, the HE round will become default. Having HE as default makes the tanks fire HE rounds at single infantry units (not only groups). So if you expect armored targets around, its a good idea to have AP as default, as the tanks will have AP loaded and won't waste time reloading the round. If, however, you want the tanks to use cannon against every soldier they see, make HE default.
Manually ordering the tank to target an infantry unit (action menu 2-x) will make him use HE round against assigned target, even if it's not a group of infantry.


Notes:
It does not cheat and it uses line of sight calculations and perceived position of the targets. So the tanks will not fire at and rotate to the targets they don't know about.
Only tracked vehicles rotate the hull.
Target assignment works best with MBTs (Slammer, Varsuk) as they switch targets immediately. With APCs and MRAPs there can be a delay before they leave that poor rifleman alone and target an AT soldier.
Real Armor Mod or a similar one is highly recommended.
I haven't found a way so far to override default behaviour in ATTACK (Engaging) mode, so when Engaging the vehicle will not stop, rotate etc.
Currently 'smart' behaviour covers all ground vehicles that have weapons, from all factions, found in game. There is no separate config file to include/exclude particular vehicles/types/factions for now. It will be implemented later though.
The vehicles list is hardcoded for now, which means that addon doesn't cover modded vehicles that have non-standard types and names.


Credits & thanks:
This script could not be made without the help of my wife Natalie. She kindly didn't interfere in exchange for my promise to mention her in the credits.


License:
Do whatever you want with this script. Even claim it your own if you really need to.


Changelog:
v.1.8
- Fixed: commander stuck watching the same direction forever after has been given doTarget order.
- Fixed: 'lazy' target switching. Will now immediately switch to more valueable target.
- Fixed: setup.sqf non starting for vehicles with non-standard names (modded). Should now work for any vehicle that has weapons (list of weapons is still hardcoded though).
- Fixed: small fixes here and there.
- Added: vehicle commander (or gunner, if no commander) will 'scan the horizon' for targets when idle. Commander will use his optics independently of gunner's main turret.

v1.7.1
- includes public key.

v1.7
- Hardcoded unit classes replaced with dynamic threat assessment based on available weapons: both target and our vehicle (a 'sniper' infantry class that has aquired AT launcher will be given threat value as an AT rifleman). Should now work with modded vehicles with non-standard names, as long as they belong to standard base classes (Man, Car, Tank etc) and use standard weapons names.
- Tanks will fire HE rounds at helicopters.
- Added signature.

v1.6
- Fixed multiplayer bugs (locality shifts). Now works properly in multiplayer and on dedicated server.
- Small bugfixes

v1.5
- Improvements to targeting algorithm.
- Tanks load appropriate rounds for different target types.
- Tanks identify groups of infantry and use HE against them.

v1.4
- Distributed in a form of addon now.

v1.3
- Smart behaviour is now determined by the commander's combat mode, not driver's. This way tank's driver can be set to RELAXED (to stick to roads while moving) without disabling hull rotatation and target aquisition.

v1.2
- Fixed: doesn't require human player in faction any more for the script to work.

v1.1
- Added compatibility with High Command.
- Small fixes

v1.0
- Initial release


Forum topic:
- BI forums




Enable javascript to be able to download from Armaholic please!



Tags: Armor,   Tank,   Vehicle