Author: Devastator_cm
Author Website:

Requirements: No addons required

Version: 2.5

Short description: General idea behind my version is actually similar to Norrin's version. I rewrite the scripts and now it has some new features and working.

Date: 2017-03-04 21:00


Comments: (13)
Rating:



 





Devas Convoy & Vehicle Patrol

by
Devastator_cm


Description:
My first release ever is based on Norrin's convoy script for which I got permission to modify from Norrin.
General idea behind my version is actually similar to Norrin's version. I rewrite the scripts and now it has some new features and working.


Features:
AI convoy and patrol which follows roads and keeps the distance between vehicles
Defending the convoy in case they notice enemies or being attacked by enemies
Intel share related to enemy positions between convoy vehicles.
Attack position selection based on convoy vehicle and enemy type. For example a tank will move closer to enemy armored units to attack instead of moving closer to infantry units. Distance to enemy and amount of enemy in a specific area can influence the decision for attack position.
Restarting the convoy route after danger is eliminated
Units whose vehicle is destroyed, will try to find seat in other vehicles in convoy. In case there isn't any available they will walk to final marker on foot
Dead gunners and drivers will be replaced by AI units who sit at cargo of any vehicle, when enemy threat is eliminated.
In case a vehicle's driver is killed during gun fight, another AI in same vehicle will try to move to gunner position
After an ambush, the groups who sits inside same vehicle will be merged to prevent single unit groups. Only exception is for the vehicles who has guns. For such vehicles there will be two groups; (1) group for the units in cargo, (2) group for the vehicle units (gunner(s), driver, commander)
Leader in merged group will be moved to the unit which has highest rank
Possiblity to have multiple convoys in same mission
Possibility to have patrol behaviour
Possibility to extend the logic by adjusting ConvoyEnd.sqf file. In this file you can add your own custom code or script call. The file is called when convoy reaches final marker
Script can be called from triggers or init.sqf
Keep in mind this script is for AI. So if you put a player in one of the vehicle it might cause issues (or work without issue).


Installation / Usage:
For usage instructions and information of how to use the Devas Convoy & Vehicle Patrol script please refer to the included documentation and/or example mission.

1. Copy the convoy folder into your mission directory
2. Create a convoy of AI vehicles, not grouped. Make sure each vehicle is named in the editor
3. Add markers on the map that you want the convoy to move through
4. Call "convoy\convoyInit.sqf" from your init.sqf to initialize the scripts (this must occour before step 5)
5. Add the code (see below) either to your init.sqf (which will start the convoy right away when mission starts) or to a trigger to start the convoy
6. convoy\ConvoyEnd.sqf is called automatically when convoy reaches the final marker. Any further actions which convoy needs to take can be coded in this file by user.
Check ConvoyEnd.sqf file for further information.

Code:
if (isServer) then 
{
	_handle = [["pos_1","pos_2","pos_3","pos_4"],[v_1,v_2,v_3], 35, 500, 1, "NORMAL", "CARELESS"] spawn DEVAS_ConvoyMove; 
};

The code parameters in the script-call are:
1. An array of moveTo Markers for the convoy eg. ["pos1","pos2","pos3","pos4"]
2. An array that contains the names of the vehicles in the convoy eg. [c1,c2,c3,c4,c5,c6]. This array should not have any " symbol
3. Speed limit for convoy. I tested it with 35. This value can be time to time less due to speed corrections
4. Enemy search range. Enemies in this range will be considered as danger. Minimum value for this parameter is 300.
5. Convoy restart delay in seconds, after an ambush.
6. Convoy ID. It provides the ability to the user to branch the code in ConvoyEnd.sqf based on the given ID in case there are multiple convoys in map
7. Speed mode of convoy. I suggest to use Normal. It should match to speed limit which is given.
8. Behaviour. For a convoy careless is suggested behaviour so it can follow the roads without a problem.

Sample Mission:



Media:



Armaholic.com has its own Youtube channel where we will cover the Community made releases.
Subscribe to the Armaholic.com Youtube channel


Known issues:
I just encountered this in during my last test with a BTR-60P (Project Opfor Mod) that it simply didn't start moving. Reason was the unit in commander seat. After I remove him problem solved. At the moment I don't know why it caused such an issue. I had no issue with RHS BTR with Russian units inside though. In case you encounter such problem you can do a workaround. Do not put any unit in commander seat in mission design and lock the commander seat of the vehicle by adding following into INIT field of the problematic vehicle
this lockturret [[0,0],true];
Thanks to @Duke101 it appears that acex headless client is causing issues. So following variable need to be set by each convoy vehicle before starting the convoy from server
this setVariable ["acex_headless_blacklist", true, true];


Future plans:
I am open to any suggestions.


Credits & Thanks:
Norrin, thanks to you once more for the initial scripts and the idea!


License / Disclaimer:
These scripts are not to be altered or used for commercial or military purposes without the author's prior consent.


Changelog:
v2.5
Fixed: Logic Objects on map can cause aircraft to stuck in combat mode over an area as such objects might be categorized as enemy.
Removed: Restart Delay parameter is removed.
Added: Attack location evaluation based on enemy and convoy vehicle. For example, tank class vehicles will try to come closer to enemy tanks instead of enemy infantry.
Added: During restart phase if another attack happens to convoy, units will start defence again.
Tweaked: Restart phase is optimized. It will require less time to start convoy again.
Tweaked: Enemy aircrafts will not be considered as enemy and will not stop the convoy.

v2.2
Fixed: Workaround applied due to bug in BIS_fnc_EnemyTargets function which does not consider static weapons as enemy

v2.1
Small bug fix which is related to stucked convoy in circular convoy paths.

v2
New parameters are added and they are moved into script call
ConvoyEnd.sqf file added to provide possibility to user to add his/her own code or script calls. This specific file is called when convoy reaches final marker
Multiple convoys are possible
Patrolling is possible (thanks to ConvoyEnd.sqf) by repeating the convoy call inside this file
Units are looking for another vehicle in case their vehicle is destroyer or not able to move
Dead gunner is replaced by other units in vehicle during firefight when there is a possibility (if they are under fire or enemy is danger close this will not happen)
Merging of groups (after ambush) and assigning the unit with highest rank as leader added.

v1
- first release


Forum topic:
- BI forums




Enable javascript to be able to download from Armaholic please!



Tags: Enhace,   Scripts,   Simulation,   Support