Jump to content

[Outdated] AI Convoys 1061+


Runewulv

Recommended Posts

The original author deleted his drop box account. I am posting these files and not claiming any credit whatsoever. Only thing I've done is added the necessary code to keep the bodies from cleaning up immediately, and I edited the vehicle/convoy arrays/and weapons.

The Convoys work really well in 1061A. The only downside I've found is that the combo multiplier does not actually multiply the gold reward any more. I am not code savvy enough to make this work. So instead I made it so that there is no single bar of gold award and instead will give either a 10oz gold or a briefcase. My server uses default currency, please edit for coins accordingly.

Installation:

Unzip the rar below, place the folder inside the root of your mission folder.

Go to init.sqf and paste this     execVM "andre_convoy\andre_convoy.sqf";     like below:

Spoiler

if (isServer) then {
    call compile preprocessFileLineNumbers "\z\addons\dayz_server\system\dynamic_vehicle.sqf";
    call compile preprocessFileLineNumbers "\z\addons\dayz_server\system\server_monitor.sqf";
    execVM "andre_convoy\andre_convoy.sqf";
    //Must be global spawned, so players don't fall through buildings (might be best to spilt these to important, not important)
    if (dayz_POIs && (toLower worldName == "chernarus")) then { execVM "\z\addons\dayz_code\system\mission\chernarus\poi\init.sqf"; };
execVM "\z\addons\dayz_server\traders\chernarus11.sqf"; //Add trader agents
        //Get the server to setup what waterholes are going to be infected and then broadcast to everyone.
    if (dayz_infectiousWaterholes && (toLower worldName == "chernarus")) then {execVM "\z\addons\dayz_code\system\mission\chernarus\infectiousWaterholes\init.sqf";};
    
    // Lootable objects from CfgTownGeneratorDefault.hpp
    if (dayz_townGenerator) then { execVM "\z\addons\dayz_code\system\mission\chernarus\MainLootableObjects.sqf"; };
};

All done.

https://github.com/dreamforceinc/andre_convoy

Link to comment
Share on other sites

  • 3 weeks later...
  • 4 months later...
  • 2 weeks later...

Hi there,

I installed this script but it doesn't spawn. I am getting the following error in the RPT on restart. Can anyone tell me how to fix this?

23:59:32 Error in expression <],
["FNFAL_DZ","20Rnd_762x51_FNFAL"],
];
waitUntil {sleep 2;!isNil >
23:59:32   Error position: <];
waitUntil {sleep 2;!isNil >
23:59:32   Error Missing [
23:59:32 File mpmissions\__cur_mp.chernarus\scripts\andre_convoy\andre_convoy.sqf, line 157
23:59:32 Error in expression <],
["FNFAL_DZ","20Rnd_762x51_FNFAL"],
];
waitUntil {sleep 2;!isNil >
23:59:32   Error position: <];
waitUntil {sleep 2;!isNil >
23:59:32   Error Missing [
23:59:32 File mpmissions\__cur_mp.chernarus\scripts\andre_convoy\andre_convoy.sqf, line 157

Thanks for your help!

Link to comment
Share on other sites

48 minutes ago, JasonTM said:

I noticed that this mod has Overwatch weapons in the _donn_weapons array. If you are running an Epoch server then remove the Overwatch weapons.

Thanks for the reply,

I did remove the Overwatch weapons but maybe I missed one.

Also, I noticed in the config file where the error is pointing it has a comma after ["FNFAL_DZ","20Rnd_762x51_FNFAL"] before the close brackets. None of the other arrays have that. Could that be my problem? 

//AI WEAPONS & AMMO
    _donn_weapons = [
        ["Mk48_DZ","100Rnd_762x51_M240"],
        ["M249_DZ","200Rnd_556x45_M249"],
        ["G36C_DZ","30Rnd_556x45_Stanag"],
        ["G36C_camo_DZ","30Rnd_556x45_Stanag"],
        ["G36A_camo_DZ","30Rnd_556x45_Stanag"],
        ["G36K_camo_DZ","30Rnd_556x45_Stanag"],
        ["AK74_DZ","30Rnd_762x39_AK47"],
        ["AKS74U_DZ","30Rnd_545x39_AK"],
        ["bizon_silenced","64Rnd_9x19_SD_Bizon"],
        ["DMR_DZ","20Rnd_762x51_DMR"],
        ["RPK_74","75Rnd_545x39_RPK"],
        ["M24_DZ","5Rnd_762x51_M24"],
        ["M24_des_EP1","5Rnd_762x51_M24"],
        ["FNFAL_DZ","20Rnd_762x51_FNFAL"],
        
        
    ];

Link to comment
Share on other sites

The Epoch array should look like this:

_donn_weapons = [
		["Mk48_DZ","100Rnd_762x51_M240"],
		["M249_DZ","200Rnd_556x45_M249"],
		["G36C_DZ","30Rnd_556x45_Stanag"],
		["G36C_camo_DZ","30Rnd_556x45_Stanag"],
		["G36A_camo_DZ","30Rnd_556x45_Stanag"],
		["G36K_camo_DZ","30Rnd_556x45_Stanag"],
		["AK74_DZ","30Rnd_762x39_AK47"],
		["AKS74U_DZ","30Rnd_545x39_AK"],
		["bizon_silenced","64Rnd_9x19_SD_Bizon"],
		["DMR_DZ","20Rnd_762x51_DMR"],
		["RPK_74","75Rnd_545x39_RPK"],
		["M24_DZ","5Rnd_762x51_M24"],
		["M24_des_EP1","5Rnd_762x51_M24"],
		["FNFAL_DZ","20Rnd_762x51_FNFAL"]
		
	];

Every nested array should have a comma behind it except the last one.

Link to comment
Share on other sites

On 2/15/2018 at 4:59 PM, JasonTM said:

The Epoch array should look like this:


_donn_weapons = [
		["Mk48_DZ","100Rnd_762x51_M240"],
		["M249_DZ","200Rnd_556x45_M249"],
		["G36C_DZ","30Rnd_556x45_Stanag"],
		["G36C_camo_DZ","30Rnd_556x45_Stanag"],
		["G36A_camo_DZ","30Rnd_556x45_Stanag"],
		["G36K_camo_DZ","30Rnd_556x45_Stanag"],
		["AK74_DZ","30Rnd_762x39_AK47"],
		["AKS74U_DZ","30Rnd_545x39_AK"],
		["bizon_silenced","64Rnd_9x19_SD_Bizon"],
		["DMR_DZ","20Rnd_762x51_DMR"],
		["RPK_74","75Rnd_545x39_RPK"],
		["M24_DZ","5Rnd_762x51_M24"],
		["M24_des_EP1","5Rnd_762x51_M24"],
		["FNFAL_DZ","20Rnd_762x51_FNFAL"]
		
	];

Every nested array should have a comma behind it except the last one.

Thank you JasonTM, I removed the comma after ["FNFAL_DZ","20rd_762x51_FNFAL"] and the script spawns. Now I am having a problem where the bots don't die and they don't attack. I see that WagnerMello was having the same problem above. I don't think I missed a step in the install. It was pretty simple! Anyone have any idea what may be the problem?

I'm also getting multiple errors in my RPT:

16:15:09 Error in expression < > 0) then {
[_ammos,_motor,"add"] call donn_cascar_tuAmmo;
_motor setVariable [>
16:15:09   Error position: <donn_cascar_tuAmmo;
_motor setVariable [>
16:15:09   Error Undefined variable in expression: donn_cascar_tuammo
16:15:09 File mpmissions\__cur_mp.chernarus\scripts\andre_convoy\andre_convoy.sqf, line 395
16:15:09 Error in expression <ot1,ceil (_crewCount/_lootCutter)] call donn_selectLoot);
_gunnerPos = 0;
for >
16:15:09   Error position: <donn_selectLoot);
_gunnerPos = 0;
for >
16:15:09   Error Undefined variable in expression: donn_selectloot
16:15:09 File mpmissions\__cur_mp.chernarus\scripts\andre_convoy\andre_convoy.sqf, line 410
16:15:14 Warning: looped for animation: ca\anims\characters\data\anim\sdr\mov\erc\stp\non\non\amovpercmstpsnonwnondnon_amovpercmstpsraswpstdnon_end.rtm differs (looped now 0)! MoveName: amovpercmstpsnonwnondnon_amovpercmstpsraswpstdnon_end
16:15:17 Error in expression < > 0) then {
[_ammos,_motor,"add"] call donn_cascar_tuAmmo;
_motor setVariable [>
16:15:17   Error position: <donn_cascar_tuAmmo;
_motor setVariable [>
16:15:17   Error Undefined variable in expression: donn_cascar_tuammo
16:15:17 File mpmissions\__cur_mp.chernarus\scripts\andre_convoy\andre_convoy.sqf, line 395
16:15:17 Error in expression <ot1,ceil (_crewCount/_lootCutter)] call donn_selectLoot);
_gunnerPos = 0;
for >
16:15:17   Error position: <donn_selectLoot);
_gunnerPos = 0;
for >
16:15:17   Error Undefined variable in expression: donn_selectloot
16:15:17 File mpmissions\__cur_mp.chernarus\scripts\andre_convoy\andre_convoy.sqf, line 410
16:15:21 UnExpected call of CreateVehicle for 'Logic', pos(0.000000.2,1.447691.2,0.000000.2). Vehicles with brain cannot be created using 'createVehicle'!
16:15:26 Error in expression <;
[_spawn select 0,_rosa_group,_speed,donn_wps] call donn_makeroute;
sleep _>
16:15:26   Error position: <donn_wps] call donn_makeroute;
sleep _>
16:15:26   Error Undefined variable in expression: donn_wps
16:15:26 File mpmissions\__cur_mp.chernarus\scripts\andre_convoy\andre_convoy.sqf, line 526

Thanks!

Link to comment
Share on other sites

On 2/17/2018 at 4:37 AM, victorks said:

So, I'm about to give up on this one. I added the line in the quote above but the AI still don't shoot and you still can't kill them and they still don't move.

RPT says this:

20:00:07 "[CASCA CONVOY] Initialized Spawn! 1"
20:00:07 Error in expression < from 1 to _mags do {
_unit addMagazine _magazine;
};
_unit addweapon _weapon;
_>
20:00:07   Error position: <_magazine;
};
_unit addweapon _weapon;
_>
20:00:07   Error Undefined variable in expression: _magazine
20:00:07 File z\addons\dayz_server\WAI\compile\spawn_group.sqf, line 141
20:00:07 Error in expression <ot1,ceil (_crewCount/_lootCutter)] call donn_selectLoot);


_gunnerPos = 0;
for >
20:00:07   Error position: <donn_selectLoot);


_gunnerPos = 0;
for >
20:00:07   Error Undefined variable in expression: donn_selectloot
20:00:07 File mpmissions\__cur_mp.chernarus\scripts\andre_convoy\andre_convoy.sqf, line 410
20:00:07 Error in expression < from 1 to _mags do {
_unit addMagazine _magazine;
Link to comment
Share on other sites

  • 2 weeks later...
17 hours ago, Vendetta5555 said:

What can you say about this

Скриншот 2018-03-02 09_26_14.jpg

try to put this in your andre_convoy.sqf

Spoiler

//===========================================
//THIS VERSION IS FOR ARMA 2: ANDRE CONVOYS
//===========================================
//By Donnovan from Brazil
//===========================================

if (isServer) then {
    //=======================
    //BASIC KONFIGURATION 1!
    //=======================

    //Vehicles: Its ok to repeate the same car with different configuration.
    donn_carsConvy = [
        //(0) Vehicle Unarmored Armed low Capacity
        ["HMMWV_Armored",2,["100Rnd_762x51_M240"]],
        //(1) Vehicle Unarmored Unarmed Mediun Capacity
        ["LadaLM",3,[]],
        //(2) Vehicle Unarmed Armored High Capacity
        ["Tractor",0,[]],
        //(3) Vehicle Unarmed Armored High Capacity
        ["ZSU_INS",0,["2000Rnd_23mm_AZP85"]],
        //(4) Vehicle Trash High Capacity
        ["Ural_UN_EP1",5,[]],
        //(5) Civil Truck Ultra High Capacity
        ["BMP2_CDF",2,["2000Rnd_762x54_PKT"]],
        //(6) Vehicle Trash High Capacity
        ["M1128_MGS_EP1",0,["12Rnd_105mm_HESH"]],
        //(7) Vehicle Trash High Capacity
        ["BRDM2_INS",3,["100Rnd_762x54_PK"]],
        //(8) Vehicle Armored  Mediun Capacity
        ["HMMWV_M1151_M2_CZ_DES_EP1_DZ",2,["100Rnd_127x99_M2"]],
        //(9) Vehicle Armored  Mediun Capacity
        ["T55_TK_EP1",0,[]],
        //(10) Vehicle Armored  Mediun Capacity
        ["GAZ_Vodnik_DZ",4,["100Rnd_762x54_PK"]],
        //(11) Vehicle Armored  Mediun Capacity
        ["ArmoredSUV_PMC_DZ",2,["2000Rnd_762x51_M134"]],
        //(12) Vehicle Armored  Mediun Capacity
        ["S1203_ambulance_EP1",2,[]],
        //(13) Vehicle Armored  Mediun Capacity
        ["GAZ_Vodnik_MedEvac",3,[]]
    ];

    //Soldier of the Convoys (all the soldiers are the same)
    //donn_soldierSkin = ["UN_CDF_Soldier_EP1","UN_CDF_Soldier_EP1"];
    donn_soldierSkin = ["UN_CDF_Soldier_Guard_EP1_DZ","UN_CDF_Soldier_EP1_DZ"];

    //=======================
    //BASIC KONFIGURATION 2!
    //=======================

    //CONVOY CONFIGURATION
    
    //Time between each consecutive spawn
    _timeBetweenSpawns = 1000;

    //Cars in each convoy (refere to donn_carsConvy)
    _convoyFormation = [
    //Shit convoys
        [1,1,12,1,1],
        [2,2,2,2,2],
        [0,4,4,4,0],
        [0,10,0],
        [7,13,7],
        [8,13,13,8],
        [7,1,12,7],
        [10,13,13,10],
        [0,4,0],
        [8,4,4,8],
        [7,4,4,4,7],
        [0,10,0],
        [1,8,8,1],
    //Good convoys
        [0,1,12,1,0],
        [8,13,13,6],
        [4,3,4],
        [11,11,8],
        [5,12,12,5],
        [9,2,9]
    ];
    
    //Crew Skill (driver, cargors and turreters)
    _generalSkill = 0.3;    //All skills, except ain skill, for all AI
    _driverManAin = 0.2;    //Ain of the driver, from 0 to 1
    _cargoMansAin = 0.2;    //Ain of the cargo ocupants, from 0 to 1
    _turretMansAin = 0.2;    //Ain ot the turret operators, from 0 to 1
    
    //SMART BOMBER MAN CONFIG - Percentage of bomberman AI in car disembarks: 0 is 0% and 1 is 100%
    //Those bombermans will fight and run to the player in the first oportunity
    //0.25 means 1 smart bomber each 4 vehicle disembark (1/0.25 = 4)
    donn_fighterBomberManPerc = 0.01;
    donn_fighterBomberIndicator = false; //indicates the fighter bombers with a small sphere above their heads        
        
    //SMART BOMBER MAN CONFIG - Percentage of bomberman AI in car disembarks: 0 is 0% and 1 is 100%
    //Those bomberman will not fight and search for a player to explode right after disembark
    //0.2 means 1 runner bomber each 5 vehicle disembark (1/0.2 = 5)
    donn_runnerBomberManPerc = 0.1;
    donn_runnerBomberIndicator = false; //indicates the runner bombers with a small sphere above their heads
    
    //ICONS SETTINGS
    _showMapIcons = true;                    //Show spawn, convoy and AI icons on map?
    _showMapIconsOnlyWhenNotInWar = true;    //Hide convoy icons when they enter in war, so the fight is not spoted.
    _showCrewNumber = false;                    //Show crew number on the vehicle icon on map? (runner bombers don't count as vehicle crew)
    
    //SPECIAL REWARDS
    //Special kill (main char kill or combo kill) reward in gold or coins? Use false to gold / true to coins.
    _useCoinsReward = false;
    //Special Reward Array: _xxxxxRewards = [kill reward,son of general kill reward,extra for each combo kill];
    donn_coinRewards = [650,4000,650];
    donn_goldRewards = [["ItemSilverBar",0],["ItemGoldBar10oz",1],["ItemGoldBar",1]];

    //HUMANITY GAIN
    //How much humnity to gain for each AI kill?
    donn_humanityGainForKill = 400;
    //Bellow this value you is in the Bandit Way so donn_humanityGainForKill will subtract to your humanity
    //Above this value you is in the Hero Way so donn_humanityGainForKill will add to your humanity
    donn_humanityZeroScale = 0;
    
    //OTHER SETTINGS
    donn_aiCarVulnerable = true;         //false or 0 is INVUNERABLE true or 1 is VULNERABLE
    _donn_delete_body_time = 1800;    //Time in seconds to delete a dead AI body    
    _lootCutter = 2;                //Number of loot piles in veh are divided by this number (minimum of 1 loot pile)
    
    //====================
    //MAP CONFIGURATION
    //====================

    //VEHICLES SPAWN: [[vehicle spawn position],[nothing],spawn angle,spawn radius]
    
    //CHERNARUS SPAWNS
    _spawns = [
        [[2000,10907,0.2],[],100,15],
        [[7730,4798,0.2],[],22,15],
        [[7195,9700,0.2],[],0,15]
    ];

    //=====================
    //EXTRA KONFIGURATION!
    //=====================

    //LOOT IN VEHICLE
    _loot1 = [
        [["addWeaponCargoGlobal","Mk48_DZ",[1,1,2]],["addMagazineCargoGlobal","100Rnd_762x51_M240",[1,2,3]]],    //Maried Loot
        [["addWeaponCargoGlobal","M249_DZ",[1,1,2]],["addMagazineCargoGlobal","200Rnd_556x45_M249",[1,2,3]]],    //Maried Loot
        [["addWeaponCargoGlobal","M4SPR_DZE",[1,1,2]],["addMagazineCargoGlobal","30Rnd_556x45_Stanag",[2,3,4]]],        //Maried Loot
        [["addWeaponCargoGlobal","DMR_DZ",[1,1,2]],["addMagazineCargoGlobal","20Rnd_762x51_DMR",[3,4,5]]],        //Maried Loot
        [["addWeaponCargoGlobal","AK74_DZ",[1,1,2]],["addMagazineCargoGlobal","30Rnd_762x39_AK47",[2,3,4]]],    //Maried Loot
        [["addWeaponCargoGlobal","M136",[1,1,2]],["addMagazineCargoGlobal","M136",[2,3,4]]],    //Maried Loot
        [["addWeaponCargoGlobal","NVGoggles_DZE",[2,3,4]]],
        [["addWeaponCargoGlobal","ItemEtool",[3,4,5]]],
        [["addWeaponCargoGlobal","Binocular_Vector",[2,3,4]]],
        [["addMagazineCargoGlobal","full_cinder_wall_kit",[3,6,9]]],
        [["addMagazineCargoGlobal","CinderBlocks",[6,10,12]]],
        [["addMagazineCargoGlobal","metal_floor_kit",[2,3,4]]],
        [["addMagazineCargoGlobal","MortarBucket",[8,12,16]]],
        [["addMagazineCargoGlobal","ItemTankTrap",[4,6,8]]],
        [["addMagazineCargoGlobal","ItemWire",[4,6,8]]],
        [["addMagazineCargoGlobal","PartVRotor",[2,3,5]]],
        [["addMagazineCargoGlobal","metal_panel_kit",[1,2,3]]],
        [["addMagazineCargoGlobal","cinder_door_kit",[1,3,5]]],
        [["addMagazineCargoGlobal","ItemSandbagExLarge5X",[2,5,8]]],
        [["addMagazineCargoGlobal","plot_pole_kit",[1,2,3]]],
        [["addMagazineCargoGlobal","ItemWoodWallGarageDoorLocked",[1,2,3]]],
        [["addMagazineCargoGlobal","ItemWoodWall",[8,6,4]]],
        [["addMagazineCargoGlobal","ItemBloodBag",[4,5,6]]],
        [["addMagazineCargoGlobal","HandGrenade_West",[3,5,7]]],
        [["addMagazineCargoGlobal","PipeBomb",[1,2,3]]],
        [["addMagazineCargoGlobal","ItemCrowbar",[2,5,7]]],
        [["addMagazineCargoGlobal","ItemSledgeHead",[1,2,3]]],
        [["addMagazineCargoGlobal","ItemSledgeHandle",[1,2,3]]],
        [["addMagazineCargoGlobal","sandbag_nest_kit",[1,1,2]]],
        [["addMagazineCargoGlobal","m240_nest_kit",[1,1,1]]],
        [["addMagazineCargoGlobal","forest_large_net_kit",[1,1,2]]],
        [["addMagazineCargoGlobal","forest_net_kit",[1,1,2]]],
        [["addMagazineCargoGlobal","desert_large_net_kit",[1,1,2]]],
        [["addMagazineCargoGlobal","desert_net_kit",[1,1,2]]],    
        [["addMagazineCargoGlobal","ItemPole",[1,3,5]]],        
        [["addMagazineCargoGlobal","ItemComboLock",[1,1,2]]],
        [["addMagazineCargoGlobal","ItemBriefcase100oz",[1,1,1]]],
        [["addMagazineCargoGlobal","ItemHotwireKit",[1,1,1]]],
        [["addMagazineCargoGlobal","ItemBriefcase100oz",[1,2,2]]],
        [["addMagazineCargoGlobal","ItemCitrine",[1,1,1]]]
        
    ];
    
    //AI WEAPONS & AMMO
    _donn_weapons = [
        ["Mk48_CCO_DZ","100Rnd_762x51_M240"],
        ["M249_DZ","200Rnd_556x45_M249"],
        ["M4SPR_DZE","30Rnd_556x45_Stanag"],
        ["G36A_Camo_DZ","30Rnd_556x45_Stanag"],
        ["G36K_Camo_DZ","30Rnd_556x45_Stanag"],
        ["G36K_Camo_DZ","30Rnd_556x45_Stanag"],
        ["AKM_DZ","30Rnd_762x39_AK47"],
        ["AK74_Kobra_DZ","30Rnd_545x39_AK"],
        ["Bizon_SD_DZ","64Rnd_9x19_SD_Bizon"],
        ["DMR_DZ","20Rnd_762x51_DMR"],
        ["RPK74_DZ","75Rnd_545x39_RPK"],
        ["M14_DZ","20Rnd_762x51_DMR"],
        ["RPG7V","OG7"],        
        ["M8_SAW","100Rnd_556x45_BetaCMag"],
        ["M136","M136"]
    ];
    
    //=========================
    //END OF KONFIGURATION
    //=========================
    
    //==============================================================================================================
    //==============================================================================================================
    //==============================================================================================================
    //==============================================================================================================
    
    //Avoid Vehicles to Explode when Entering it
    waitUntil {uisleep 2;!isNil "DZE_safeVehicle"};
    _cascaVehicles = [];
    {
        _car = _x select 0;
        if !(_car in _cascaVehicles) then {
            _cascaVehicles = _cascaVehicles + [_car];
        };
    } forEach donn_carsConvy;
    DZE_safeVehicle = DZE_safeVehicle + _cascaVehicles;    

    //Generate Functions
    call compile preprocessFileLineNumbers "andre_convoy\andre_convoy_functions.sqf";
    
    //Set Type of Kill Reward (Coins or Gold)
    if (_useCoinsReward) then {donn_cleanUnit = donn_cleanUnitCoins;} else {donn_cleanUnit = donn_cleanUnitGold;};
    
    //Find Waypoints: Automatic find street waypoints
    donn_wps = [1200] call donn_find_intersections;
    
    //Show Spawn Icons on Map / refuel Vehicles / Show convoy icons on map 
    donn_motor = [];
    donn_units_motor = [];
    donn_units_delete = [];
    if (_showMapIcons) then {
        [_spawns,_showCrewNumber,_donn_delete_body_time] spawn {
                //Convoy Icons on Map Iniciate variables
                _showCrewNumber = _this select 1;
                _donn_delete_body_time = _this select 2;
                _add = [];
                _remove = [];
                _update = [];
                _donn_units_motor_icon_old = [];
                //Add Icon Function
                _addIcon = {
                    _iName = _this select 0;
                    _iPos = _this select 1;
                    _iColor = _this select 2;
                    _iText = _this select 3;
                    _mark = createMarker [_iName, _iPos];
                    _mark setMarkerColor _iColor;
                    _mark setMarkerShape "Icon";
                    _mark setMarkerType "mil_dot";
                    _mark setMarkerText _iText;
                };
            
            //Spawn icons on map iniciate variables
            _spawns = _this select 0;
            _donn_casca_icons = [];
            {_donn_casca_icons = _donn_casca_icons + [[_x select 0,"Convoy Spawn " + str (_forEachIndex + 1)]];} forEach _spawns;
            
            //While: Spawn icons / Convoy Icons / Refuel
            _uisleep_a = 0;
            _uisleep_b = 0;
            _uisleep_c = 0;
            while {true} do {
                //Spawn Icons Add
//                if (_uisleep_a == 0) then {
//                    {
//
//                        _mark = createMarker ["Donn_Spawn_" + str _forEachIndex, _x select 0];
//                        _mark setMarkerShape "Icon";
//                        _mark setMarkerText (_x select 1);
//                        _mark setMarkerType "mil_dot";
//                        _mark setMarkerColor "ColorPink";
//                    } forEach _donn_casca_icons;
//                };

                //Refual Vehicles each 100 seconds and delete dead AI body
                if (_uisleep_b >= 100) then {
                    _uisleep_b = 0;
                    
                    //Refuel
                    {_x setFuel 1;} forEach donn_motor;

                    //Delete AI dead body
                    {
                        _unit =  _x select 0;
                        _dieTime = _x select 1;
                        if (!isNull _unit) then {
                            _unit setVariable ["DZMS_deathTime",(diag_tickTime + _donn_delete_body_time)];
                            if (time - _dieTime > _donn_delete_body_time) then {
                                _unit call donn_AI_deleteBody;
                            };
                        };
                    } forEach donn_units_delete;
                };
                
                //Convoy Icons
                {
                    deleteMarker vehicleVarName _x;
                } forEach _remove;
                {
                    _color = "";
                    if (_x isKindOf "LandVehicle") then {
                        if (_x getVariable ["donn_tu",false]) then {_color = "ColorRed";} else {_color = "ColorBlue";};
                    } else {
                        _color = "ColorYellow";
                    };
                    _array = [vehicleVarName _x,position _x,_color,""];
                    _array call _addIcon;
                } forEach _add;
                {
                    _posXY = position _x;
                    _marker = vehicleVarName _x;
                    _marker setMarkerPos (getPosATL _x);
                    if (_x isKindOf "LandVehicle") then {
                        if (_showCrewNumber) then {_marker setMarkerText str ({alive _x} count crew _x)+" UN Convoy";};
                    };

                } forEach _update;
                _donn_units_motor_icon = [];
                _vehIcon = [];
                {
                    if !((group _x) getVariable ["donn_inWar",false]) then {
                        _veh = vehicle _x;
                        _assigned = assignedVehicle _x;
                        if (_veh != _x) then {
                            if !(_veh in _vehIcon) then {
                                _vehIcon = _vehIcon + [_veh];
                                _donn_units_motor_icon = _donn_units_motor_icon + [_veh];
                            };
                        } else {
                            _donn_units_motor_icon = _donn_units_motor_icon + [_x];
                        };
                        if !(_assigned in _vehIcon) then {
                            _vehIcon = _vehIcon + [_assigned];
                            _donn_units_motor_icon = _donn_units_motor_icon + [_assigned];
                        };
                    };
                    
                } forEach donn_units_motor;
                if (_uisleep_c >= 20) then {
                    _add = _donn_units_motor_icon;
                    _remove = _donn_units_motor_icon_old;
                    _donn_units_motor_icon_old = _donn_units_motor_icon;
                    _uisleep_c = 0;
                } else {
                    _add = _donn_units_motor_icon - _donn_units_motor_icon_old;
                    _remove = _donn_units_motor_icon_old - _donn_units_motor_icon;
                    _update = _donn_units_motor_icon - _add;
                    _donn_units_motor_icon_old = _donn_units_motor_icon;
                };
                
                //uisleep Divisor of all
                _uisleepTime = 4.0;
                Sleep _uisleepTime;
                _uisleep_a = _uisleep_a + _uisleepTime;
                _uisleep_b = _uisleep_b + _uisleepTime;
                _uisleep_c = _uisleep_c + _uisleepTime;
            
                //Spawn Icons Remove
                if (_uisleep_a == 15) then {
                    _uisleep_a = 0;
                    {deleteMarker ("Donn_Spawn_" + str _forEachIndex);} forEach _donn_casca_icons;
                };
            };
        };
    } else {
        //Refual Vehicles each 100 seconds and Check for AI body delete
        _donn_delete_body_time spawn {
            while {true} do {
                _donn_delete_body_time = _this;
                
                //Refuel
                {_x setFuel 1;} forEach donn_motor;
            
                //Delete AI dead body
                {
                    _unit =  _x select 0;
                    _dieTime = _x select 1;
                    if (!isNull _unit) then {
                        if (time - _dieTime > _donn_delete_body_time) then {
                            _unit call donn_AI_deleteBody;
                        };
                    };
                } forEach donn_units_delete;
                uiSleep 100;
            };
        };
    };
    
    donn_godModeMult = 0;
    if (donn_aiCarVulnerable) then {donn_godModeMult = 1;};
    
    //Safe Sleep
    uisleep 10;
    
    //Spawn Casca Units/Cars
    for "_cs" from 1 to (count _convoyFormation) do {
        diag_log ("[CASCA UN VEHICLE CONVOY] Initialized Spawn! " + str _cs);
        
        //Inicialization
//        _spawn = _spawns select ((_cs + ((count _spawns)-1)) mod (count _spawns));
        _spawn = _spawns call BIS_fnc_selectRandom;
        diag_log format["[CASCA UN VEHICLE CONVOY]: Spawn Cords  %1", _spawn];
        _origin = _spawn select 0;
        _rad = _spawn select 3;
        _rosa_group = createGroup EAST;
//        _convoy = _convoyFormation select (_cs-1);
        _convoy = _convoyFormation call BIS_fnc_selectRandom;
        _behaviorSafe = "AWARE";
        _speed = "NORMAL";
        _qtd = count _convoy;
        _cars = [];
        {
            _cars = _cars + [donn_carsConvy select _x];
        } forEach _convoy;
        for "_n" from 1 to _qtd do {
            private ["_firstDriver"];
            
            //Spawn Car
            _car = _cars select (_n - 1);
            _motor = createVehicle [_car select 0,_origin,[],_rad,"NONE"];
            _motor allowDamage donn_aiCarVulnerable;
            _motor setVehicleVarName ("CASCA_CAR_" + str _cs + "_" + str _n);
            _motorID = str(round(random 999999));
            _motor setVariable ["ObjectID",_motorID,true];
            _motor setVariable ["ObjectUID",_motorID,true];
            //PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_motor];
            _motor setVariable ["car_group",_rosa_group,false];
            _motor call fnc_veh_ResetEH;
            _motor addEventHandler ["HandleDamage",{_this call donn_casca_veh_HD;(_this select 2)*donn_godModeMult}];
            _motor setDir (_spawn select 2);
            _motor setFuel 1;
            donn_motor = donn_motor + [_motor];
            _motor setvariable ["aiveh",1,true]; 
            _motor addEventHandler ["GetIn",{_this call donn_casca_getIn;}];
            _motor addEventHandler ["GetOut",{_this call donn_casca_getOut;}];
            PVDZE_veh_Init = _motor;
            publicVariable "PVDZE_veh_Init";
            
            //Add Vehicle Ammo
            _ammos = _car select 2;
            if (count _ammos > 0) then {
                [_ammos,_motor,"add"] call donn_cascar_tuAmmo;
                _motor setVariable ["donn_tu",true,true];
            };
            
            //count Crew
            _driverCount = 1;
            _turreterCount = count _ammos;
            _cargorsCount = _car select 1;
            _crewCount = _driverCount + _turreterCount + _cargorsCount;
            
            //Put Loot in the Car
            clearWeaponCargoGlobal _motor;
            clearMagazineCargoGlobal _motor;
            {
                {call compile format ["_motor %1 ['%2',%3];",_x select 0,_x select 1,_x select 2 select ((_qtd - 1) min 2)];} forEach _x;
            } forEach ([_loot1,ceil (_crewCount/_lootCutter)] call donn_selectLoot);
            
            //Spawn Soldiers
            _gunnerPos = 0;
            for "_y" from 1 to _crewCount do {
                
                //Create Soldier
                _skin = donn_soldierSkin call BIS_fnc_selectRandom;
                _unit = _rosa_group createUnit [_skin,[50,50,50],[],50,"PRIVATE"];
                _unit setVehicleVarName ("CASCA_AI_" + str _cs + "_" + str _n + "_" + str _y);                
                [_unit] joinSilent _rosa_group;
                _unit addEventHandler ["Killed",{_this call donn_cleanUnit;}];
                _unit addEventHandler ["HandleDamage",{_this call donn_casca_unit_HD}];
                donn_units_motor = donn_units_motor + [_unit];
                _unit disableAi "TARGET";
                _unit disableAi "AUTOTARGET";
                
                //Give Soldier Weapon and Ammo
                removeAllWeapons _unit;
                {_unit removeMagazine _x} forEach magazines _unit;
                _weap_mag = _donn_weapons call BIS_fnc_selectRandom;
                _weapon = _weap_mag select 0;
                _magazine = _weap_mag select 1;
                _unit addWeapon _weapon;
                _unit selectWeapon _weapon;
                for "_pa" from 1 to (ceil (1 + random 2)) do {
                    _unit addMagazine _magazine;
                };
                
                //Put AI in the car
                if (_y == 1) then {
                    //Driver
                    _unit assignAsDriver _motor;
                    _unit moveInDriver _motor;
                    _unit setSkill _generalSkill;
                    _unit setSkill ["aimingAccuracy",_driverManAin];
                };
                if (_y > 1 && _y <= 1 + _turreterCount) then {
                    //Turreters
                    _unit assignAsGunner _motor;
                    //_unit moveInTurret [_motor,[_gunnerPos]];
                    _unit moveInTurret [_motor,[0]];                    
                    _unit setSkill _generalSkill;
                    _unit setSkill ["aimingAccuracy",_turretMansAin];
                    _gunnerPos = _gunnerPos + 1;
                 };
                if (_y > 1 + _turreterCount) then {
                    //Cargors
                    _unit assignAsCargo _motor;
                    _unit moveInCargo _motor;
                    _unit setSkill _generalSkill;
                    _unit setSkill ["aimingAccuracy",_cargoMansAin];
                };
            };
            _rosa_group setCombatMode "RED";
            _rosa_group setBehaviour _behaviorSafe;
            _rosa_group setVariable ["donn_pshot",false,false];
            _rosa_group setVariable ["donn_inWar",false,false];
            {_x allowFleeing 0} forEach units _rosa_group;        
            {[_x] allowGetIn true;uisleep 0.2;} forEach units _rosa_group;
            {[_x] orderGetIn true;uisleep 0.2;} forEach units _rosa_group;
        };
        
        //Make Units leave or Embark car
        [_rosa_group,_behaviorSafe] spawn {
            _rosa_group = _this select 0;
            _behaviorSafe = _this select 1;
            _noHurtTime = 0;
            _tm = 1;
            _targetOff = true;
            while {!isNil "_rosa_group"} do {
                _newHurt = _rosa_group getVariable ["donn_pshot",false];
                if (isNil "_newHurt") then {_newHurt = false;};
                if (_newHurt) then {
                    _noHurtTime = 0;
                    _rosa_group setVariable ["donn_pshot",false,false];
                    if (_targetOff) then {
                        _targetOff = false;
                        _rosa_group setVariable ["donn_inWar",true,false];
                        {_x enableAi "TARGET";uisleep 0.025;} forEach units _rosa_group;
                        {_x enableAi "AUTOTARGET";uisleep 0.025;} forEach units _rosa_group;
                        uisleep 0.5;
                        _rosa_group setBehaviour "COMBAT";
                        _rosa_group setCombatMode "RED";
                        uisleep 0.5;
                        _turreters = [];
                        {if ((assignedVehicleRole _x) select 0 == "Turret") then {_turreters = _turreters + [_x];};} forEach units _rosa_group;
                        _leaveToFight = (units _rosa_group) - _turreters;
                        {[_x] orderGetIn false;uisleep 0.05;} forEach _leaveToFight;
                        {[_x] allowGetIn false;uisleep 0.05;} forEach _leaveToFight;
                        _tm = 15;
                    };
                } else {
                    _noHurtTime = _noHurtTime + _tm;
                    if (_noHurtTime > 120) then {
                        _noDangerFell = true;
                        {if (_rosa_group knowsAbout _x > 0) exitWith {_noDangerFell = false;};} forEach playableUnits;
                        if (_noDangerFell) then {
                            _targetOff = true;
                            _rosa_group setVariable ["donn_inWar",false,false];
                            {_x disableAi "TARGET";} forEach units _rosa_group;
                            {_x disableAi "AUTOTARGET";} forEach units _rosa_group;
                            uisleep 1;
                            _rosa_group setBehaviour _behaviorSafe;
                            _rosa_group setCombatMode "RED";
                            uisleep 2;
                            {[_x] allowGetIn true;uisleep 0.2;} forEach units _rosa_group;
                            {[_x] orderGetIn true;uisleep 0.2;} forEach units _rosa_group;
                            _tm = 1;
                        };
                    };
                };
                uisleep _tm;
            };
        };
        
        //Make Convoy Route
        [_spawn select 0,_rosa_group,_speed,donn_wps] call donn_makeroute;
    
        //Sleep Before Next Spawn
        uisleep _timeBetweenSpawns;
    };
};


 

 

Link to comment
Share on other sites

 

and in your andre_convoy_functions.sqf put this
Spoiler

//Find Roads Intersections (can be separated by water)
donn_find_intersections = {
    _minDist = _this select 0;
    _roads = [0,0,0] nearRoads 50000;
    _donn_wps = [];
    {
        _road = _x;
        if (count roadsConnectedTo _x > 2) then {
            _alone = true;
            {
                if (_road distance _x < _minDist) exitWith {
                    _alone = false;
                };
            } forEach _donn_wps;
            if (_alone) then {
                _donn_wps = _donn_wps + [position _x];
            };
        };
    } forEach _roads;
    _donn_wps
};

//AI handle damage Event Handler    
donn_casca_unit_HD = {
    _hurtedOne = _this select 0;
    _partDamage = _this select 1;
    _damage = _this select 2;
    _ofender = _this select 3;
    _process = false;
    if (isPlayer _ofender) then {_process = true;} else {if (_ofender isKindOf "LandVehicle" || _ofender isKindOf "Air" || _ofender isKindOf "Ship") then {_process = true;};};
    if (_process) then {
        _dist = _ofender distance _hurtedOne; //MANY
        _groupShoted = group _hurtedOne; //MANY
        _groupShoted setVariable ["donn_pshot",true,false]; //MANY
        if (_dist < 300) then {_groupShoted reveal [_this select 3,4];}; //MANY
        //Bomber part
        if (_hurtedOne getVariable ["donn_bomb",false]) then {
            if (_partDamage == "body" && _damage > 1) then {
                _uPos = position _hurtedOne;
                "HelicopterExploSmall" createVehicle _uPos;
                _unit setPos [0,0,0];
                _damnage = 100;
            };
        };
    } else {
        if (_hurtedOne != _ofender) then {_damage = 0;};
    };
    _damage
};

//BomberMan handle damage
donn_casca_unit_HD_bomber = {
    _hurtedOne = _this select 0;
    _partDamage = _this select 1;
    _damage = _this select 2;
    _ofender = _this select 3;
    _process = false;
    if (isPlayer _ofender) then {_process = true;} else {if (_ofender isKindOf "LandVehicle" || _ofender isKindOf "Air" || _ofender isKindOf "Ship") then {_process = true;};};
    if (_process) then {
        if (_partDamage == "body" && _damage > 1) then {
            _uPos = position _hurtedOne;
            "HelicopterExploSmall" createVehicle _uPos;
            _hurtedOne setPos [0,0,0];
            deleteVehicle _hurtedOne;
        };
    } else {
        if (_hurtedOne != _ofender) then {_damage = 0;};
    };
    _damage
};

//Vehicle Handle Damage
donn_casca_veh_HD = {
    _motor = _this select 0;
    _dist = (_this select 3) distance _motor;
    _groupShoted = _motor getVariable ["car_group",GrpNull];
    _inWar = _groupShoted getVariable ["donn_inWar",false];
    if (!_inWar) then {
        _crew = crew _motor;
        if (count _crew > 0) then {
            _groupShoted setVariable ["donn_pshot",true,false];
            if (_dist < 120) then {_groupShoted reveal [_this select 3,4];};
        };
    };
    if (_inWar) then {_groupShoted setVariable ["donn_pshot",true,false];    if (_dist < 120) then {_groupShoted reveal [_this select 3,4];};};
};

//Clean AI on death and re-assign a new driver and set rewards (coins)
donn_combo_kill_player = [];
donn_combo_kill_time = [];
donn_combo_kill_lvl = [];
donn_cleanUnitCoins = {
    _unit = _this select 0;
    _player = _this select 1;
    _motor = assignedVehicle _unit;
    _role = assignedVehicleRole _unit;
    _unit removeAllEventHandlers "handleDamage";
    _unit setVariable ["DZMS_deathTime",(diag_tickTime + _donn_delete_body_time)];
    if (_role select 0 == "Driver") then {_unit call donn_roll_driver;};
    if (random 100 > 60) then {
        {_unit removeWeapon _x;} forEach weapons _unit;
        {_unit removeMagazine _x;} forEach magazines _unit;
    };
    donn_units_motor = donn_units_motor - [_unit];
    _gain = donn_coinRewards select 0;
    _extraGain = 0;
    _genSonTxt = "";
    if (random 100 > 90) then {
        _gain = donn_coinRewards select 1;
        _genSonTxt = "You killed the general son! ";
    };
    _index = donn_combo_kill_player find _player;
    _comboTxt = "";
    if (_index != -1) then {
        _newTime = time;
        _lastTime = donn_combo_kill_time select _index;
        donn_combo_kill_time set [_index,_newTime];
        if (_newTime - _lastTime <= 15) then {
            _currLvl = donn_combo_kill_lvl select _index;
            _newLvl = _currLvl + 1;
            donn_combo_kill_lvl set [_index,_newLvl];
            _extraGain = _newLvl * (donn_coinRewards select 2);
            _comboTxt = ("Combo kill level " + str _newLvl + "!");
        } else {
            donn_combo_kill_lvl set [_index,0];
        };
    } else {
        donn_combo_kill_player set [count donn_combo_kill_player,_player];
        donn_combo_kill_time set [count donn_combo_kill_time,time];
        donn_combo_kill_lvl set [count donn_combo_kill_lvl,0];
    };
    donn_units_delete = donn_units_delete + [[_unit,time]];
    //Money gain
    _unit setVariable ["cashMoney",_gain,true];
    if (_extraGain > 0) then {_result = [_player,_extraGain] call SC_fnc_addCoins;};
    _txt = _genSonTxt + _comboTxt;
    if (_txt != "") then {_nil = [nil,_player,"loc",rTITLETEXT,_txt,"PLAIN DOWN",4] call RE;};
    //Humanity Gain / Loss
    _humanity = _player getVariable ["humanity",0];
    _humGain = donn_humanityGainForKill;
    _humGainDir = 1;if (_humanity < donn_humanityZeroScale) then {_humGainDir = -1;};
    _humGain = _humGain * _humGainDir;
    _player setVariable ["humanity",(_humanity + _humGain),true];
};

//Clean AI on death and re-assign a new driver and set rewards (gold)
donn_cleanUnitGold = {
    _unit = _this select 0;
    _player = _this select 1;
    _motor = assignedVehicle _unit;
    _role = assignedVehicleRole _unit;
    _unit removeAllEventHandlers "handleDamage";
    if (_role select 0 == "Driver") then {_unit call donn_roll_driver;};
    if (random 100 > 60) then {
        {_unit removeWeapon _x;} forEach weapons _unit;
        {_unit removeMagazine _x;} forEach magazines _unit;
    };
    donn_units_motor = donn_units_motor - [_unit];
    _gain = donn_goldRewards select 0;
    _extraGain = [donn_goldRewards select 2 select 0,0];
    _genSonTxt = "";
    if (random 100 > 90) then {
        _gain = donn_goldRewards select 1;
        _genSonTxt = "You killed the general son! ";
    };
    _index = donn_combo_kill_player find _player;
    _comboTxt = "";
    if (_index != -1) then {
        _newTime = time;
        _lastTime = donn_combo_kill_time select _index;
        donn_combo_kill_time set [_index,_newTime];
        if (_newTime - _lastTime <= 15) then {
            _currLvl = donn_combo_kill_lvl select _index;
            _newLvl = _currLvl + 1;
            donn_combo_kill_lvl set [_index,_newLvl];
            _extraGain = [donn_goldRewards select 2 select 0,(donn_goldRewards select 2 select 1) * _newLvl];
            _comboTxt = ("Combo kill level " + str _newLvl + "!");
        } else {
            donn_combo_kill_lvl set [_index,0];
        };
    } else {
        donn_combo_kill_player set [count donn_combo_kill_player,_player];
        donn_combo_kill_time set [count donn_combo_kill_time,time];
        donn_combo_kill_lvl set [count donn_combo_kill_lvl,0];
    };
    donn_units_delete = donn_units_delete + [[_unit,time]];
    //_unit setVariable ["DZMS_deathTime",(diag_tickTime + _donn_delete_body_time)];
    //Money gain
    for "_i" from 1 to (_gain select 1) do {_unit addMagazine (_gain select 0);};
    if (_extraGain select 1 > 0) then {for "_i" from 1 to (_extraGain select 1) do {_unit addMagazine (_extraGain select 0);};};
    _txt = _genSonTxt + _comboTxt;
    if (_txt != "") then {_nil = [nil,_player,"loc",rTITLETEXT,_txt,"PLAIN DOWN",4] call RE;};
    //Humanity Gain / Loss
    _humanity = _player getVariable ["humanity",0];
    _humGain = donn_humanityGainForKill;
    _humGainDir = 1;if (_humanity < donn_humanityZeroScale) then {_humGainDir = -1;};
    _humGain = _humGain * _humGainDir;
    _player setVariable ["humanity",(_humanity + _humGain),true];
};

//Delete a AI dead body
donn_AI_deleteBody = {
    _unit = _this;
    _unit removeAllEventHandlers "handleDamage";
    _unit removeAllEventHandlers "fired";
    _unit removeAllEventHandlers "firedNear";
    _unit removeAllEventHandlers "killed";
    _unit removeAllEventHandlers "local";
    _unit removeAllMPEventHandlers "mpkilled";
    _unit removeAllMPEventHandlers "mphit";
    _unit removeAllMPEventHandlers "mprespawn";
    clearVehicleInit _unit;
    deleteVehicle _unit;    
};

//Loot Selection Function
donn_selectLoot = {
    _lootsOriginal = _this select 0;
    _qtd = _this select 1;
    _loots = +_lootsOriginal;
    _qtd = _qtd min 8;
    _return = [];
    for "_x" from 0 to (_qtd - 1) do {
        _rnd = (ceil (random (count _loots))) - 1;
        _rnd = _rnd max 0;
        _return = _return + [_loots select _rnd];
        _loots set [_rnd,"delme"];
        _loots = _loots - ["delme"];
        if (count _loots == 0) then {_loots = +_lootsOriginal;};
    };
    _return
};

//Add or Remove Turret Ammo - Function
donn_cascar_tuAmmo = {
    _ammos = _this select 0;
    _motor = _this select 1;
    _action = _this select 2;
    if (_action == "add") then {
        {
            _ammo = _x;
            for "_a" from 1 to 3 do {
                _motor addMagazineTurret [_ammo,[_forEachIndex]];
            };
        } forEach _ammos;
    };
    if (_action == "remove") then {
        {
            _motor removeMagazinesTurret [_x,[_forEachIndex]];
        } forEach _ammos;
    };
};

//Select a new driver
donn_roll_driver = {
    _unit = _this;
    _assignedVehDrv = assignedVehicle _unit;
    _unitsGrp = units group _unit;
    _newDriver = ObjNull;
    {
        if (alive _x) then {
            if (assignedVehicle _x == _assignedVehDrv) then {
                if (isNull _newDriver) then {
                    _newDriver = _x;
                } else {
                    if ((assignedVehicleRole _newDriver) select 0 == "Turret") then {
                        _newDriver = _x;
                    };
                };
            };
        };
    } forEach (_unitsGrp - [_unit]);
    if (!isNull _newDriver) then {
        unassignVehicle _unit;
        _newDriver assignAsDriver _assignedVehDrv;
        if ((group _newDriver) getVariable "donn_inWar") then {
            if ((assignedVehicleRole _newDriver) select 0 == "Turret") then {
                [_newDriver] orderGetIn false;
                [_newDriver] allowGetIn false;
                _newDriver setSkill 1;
            };
        };        
    };
};

//Protect Vehicles from players until all crew is off
donn_casca_getIn = {
    _motor = _this select 0;
    _unit = _this select 2;
    if (isPlayer _unit) then {
        _carGroup = _motor getVariable ["car_group",GrpNull];
        _allOff = true;
        {if (alive _x && assignedVehicle _x == _motor) then {_allOff = false;};} forEach units _carGroup;
        if (!_allOff) then {_unit action ['getOut', _motor];};
        if (_allOff) then {
            _motor setFuel 0.5;
            _motor removeAllEventHandlers "handleDamage";
            _motor removeAllEventHandlers "Killed";
            _motor removeAllEventHandlers "getIn";
            _motor removeAllEventHandlers "getOut";
            _motor addeventhandler ["handleDamage",{_this call fnc_veh_handleDam}];
            _motor addeventhandler ["killed",{_this call fnc_veh_handleKilled}];
            _motor setvariable ["aiveh",0,true]; 
            PVDZE_veh_Init = _motor;
            publicVariable "PVDZE_veh_Init";
            _nil = [nil,_unit,"loc",rTITLETEXT,"\n\nThis vehicle will disappear on server restart!","PLAIN DOWN",5] call RE;
            _motor addEventHandler ["getIn",{
                _unit = _this select 2;
                _nil = [nil,_unit,"loc",rTITLETEXT,"\n\nThis vehicle will disappear on server restart!","PLAIN DOWN",5] call RE;
            }];
        };
    };
};

//Make bomber man on disembark
donn_disembarkCount = 0;
donn_casca_getOut = {
    _unit = _this select 2;
    _inWar = (group _unit) getVariable ["donn_inWar",false];
    if (!isPlayer _unit && _inWar) then {
        donn_disembarkCount = donn_disembarkCount + 1;
        if (donn_disembarkCount mod (round (1/(donn_fighterBomberManPerc max 0.001))) == 0) then {
            if ((assignedVehicleRole _unit) select 0 != "Turret") then {
                _sphere = objNull;
                if (donn_fighterBomberIndicator) then {
                    _sphere = createVehicle ["Sign_sphere25cm_EP1",[0,0,0],[],0,"CAN_COLLIDE"];
                    _sphere attachTo [_unit,[0,0,2.25]];
                };
                _unit setVariable ["donn_bomb",true,false];
                [objNull,_unit,_sphere] execFSM "andre_convoy\andre_convoy_bomberFighter.fsm";
            } else {
                donn_disembarkCount = donn_disembarkCount - 1;
            };
        };
        if (donn_disembarkCount mod (round (1/(donn_runnerBomberManPerc max 0.001))) == 0) then {
            _agentPos = position assignedVehicle _unit;
            _agent = createAgent ["TK_INS_Soldier_AAT_EP1",_agentPos,[],0,"NONE"];
            _agent removeAllEventHandlers "handleDamage";
            _agent addEventHandler ["handleDamage",{_this call donn_casca_unit_HD_bomber}];
            _sphere = objNull;
            if (donn_runnerBomberIndicator) then {
                _sphere = createVehicle ["Sign_sphere25cm_EP1",[0,0,0],[],0,"CAN_COLLIDE"];
                _sphere attachTo [_agent,[0,0,2.25]];
            };                
            [objNull,_agent,group _unit,_sphere] execFSM "andre_convoy\andre_convoy_bomberRunner.fsm";    
        };
    };
};

//Route Maker
donn_makeroute = {
    _origin = _this select 0;
    _rosa_group = _this select 1;
    _speed = _this select 2;
    _posBefore = _origin;
    _posNow = _origin;
    _wp = _rosa_group addWaypoint [_posNow,0,0];
    _wp setWaypointCompletionRadius 15;
    _wp setWaypointType "MOVE";
    _wp setWaypointSpeed _speed;
    _posNext = [0,0,0];
    for "_c" from 1 to 5 do {
        _distToBefore = 0;
        _distToNext = 0;
        _found = false;
        for "_x" from 1 to 200 do {
            _posNext = donn_wps call BIS_fnc_selectRandom;
            _distToNext = _posNow distance _posNext;
            _distToBefore = _posNext distance _posBefore;
            _otherIsland = false;
            if (_distToNext > 2500 && _distToNext < 5000 && _distToBefore > 2000) then {
                _found = true;
                _distUnits = _distToNext/20;
                _dltX = ((_posNext select 0) - (_posNow select 0))/_distUnits;
                _dltY = ((_posNext select 1) - (_posNow select 1))/_distUnits;
                for "_i" from 1 to _distUnits do {
                    _travelPos = [(_posNow select 0)+_i*_dltX,(_posNow select 1)+_i*_dltX]; 
                    if (surfaceIsWater _travelPos) exitWith {_found = false;};
                };
            };
            if (_found) exitWith {};
            uisleep 0.001;
        };
        if (!_found) then {_posNext = donn_wps call BIS_fnc_selectRandom;};
        _wp = _rosa_group addWaypoint [_posNext,0,_c];
        _wp setWaypointCompletionRadius 15;
        _wp setWaypointType "MOVE";
        _wp setWaypointSpeed _speed;
        _posNow = _posNext;
    };
    _wp = _rosa_group addWaypoint [_origin,0,6];
    _wp setWaypointCompletionRadius 15;
    _wp setWaypointType "CYCLE";
    _wp setWaypointSpeed _speed;
};

This should fix the bug of the bots in the water

Link to comment
Share on other sites

  • 4 weeks later...
  • 1 month later...

I can see these errors sometimes when  patrols spawn:

Spoiler

15:49:08 Error in expression <ect 1;

_loots = +_lootsOriginal;

_qtd = _qtd min 8;

_return = [];

for "_x" from >

15:49:08   Error position: <_qtd min 8;

_return = [];

for "_x" from >

15:49:08   Error Undefined variable in expression: _qtd

15:49:08 File z\addons\dayz_server\andre_convoy\andre_convoy_functions.sqf, line 225

15:49:08 Error in expression <elect (_n - 1);

_motor = createVehicle [_car select 0,_origin,[],_rad,"NONE"];

_>

15:49:08   Error position: <_car select 0,_origin,[],_rad,"NONE"];

_>

15:49:08   Error Undefined variable in expression: _car

15:49:08 File z\addons\dayz_server\andre_convoy\andre_convoy.sqf, line 375

Any idea viktorks whats causing it?

 

Edit:

Found why, Had the coords without the last number (number 40 at the example) eg: [[10553.8, 5373, 0.1],[],6,40],

Link to comment
Share on other sites

  • 9 months later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Discord

×
×
  • Create New...