Jump to content

Side Mission Convoy Supply


Recommended Posts

Help me with Side Mission Convoy Supply Please.

When Complete this Side Mission.  Other Side mission Don't Spawn Loop

Here This .Sqf What Wrong?

 

Quote

/*
Author:

    superogira
    
Last modified:

    1/06/2016
    
Description:

    Send Supply to Camp

____________________________________*/

private ["_flatPos","_accepted","_position","_carDir","_fuzzyPos","_flatPos2","_accepted2","_position2"];

//-------------------- FIND POSITION FOR OBJECTIVE
sleep 15;

    _flatPos = [0,0,0];
    _accepted = false;
    while {!_accepted} do {
        _position = [] call BIS_fnc_randomPos;
        _flatPos = _position isFlatEmpty[12, 1, 0.3, 10, 0, false];

        while {(count _flatPos) < 2} do {
            _position = [] call BIS_fnc_randomPos;
            _flatPos = _position isFlatEmpty[12, 1, 0.3, 10, 0, false];
        };

        if ((_flatPos distance (getMarkerPos currentAO)) > 1500) then {
            _accepted = true;
        };
    };
//-------------------- SPAWN OBJECTIVE
    waitUntil {_accepted};
    _carDir = random 360;
//    supplycar = ["B_Truck_01_ammo_F","B_Truck_01_box_F","B_Truck_01_fuel_F","B_Truck_01_medical_F","B_Truck_01_Repair_F","CUP_B_Ural_Reammo_CDF","CUP_B_Ural_Refuel_CDF","CUP_B_Ural_Repair_CDF","B_G_Van_01_fuel_F"] call BIS_fnc_selectRandom createVehicle _flatPos;
    supplycar = ["B_Truck_01_ammo_F","B_Truck_01_box_F","B_Truck_01_fuel_F","B_Truck_01_medical_F","B_Truck_01_Repair_F","B_G_Van_01_fuel_F"] call BIS_fnc_selectRandom createVehicle _flatPos;
    supplycar lock 0;
    supplycar setVectorUp [0,0,1];
    supplycar setDir _carDir;
    alive supplycar;
    
    _carDir = random 360;
    //protectcar = ["CUP_B_UAZ_AGS30_CDF","CUP_B_UAZ_MG_CDF","CUP_B_Dingo_GL_CZ_Wdl","CUP_B_Dingo_CZ_Wdl","CUP_B_LR_Special_CZ_W","CUP_B_BAF_Coyote_GMG_W","CUP_B_BAF_Coyote_L2A1_W","CUP_B_LR_Special_GMG_GB_W","CUP_B_LR_Special_M2_GB_W","CUP_B_HMMWV_M2_USMC","CUP_B_HMMWV_M1114_USMC","CUP_B_HMMWV_MK19_USMC","CUP_B_RG31_M2_OD_USMC","CUP_B_RG31_Mk19_OD_USMC"] call BIS_fnc_selectRandom createVehicle _flatPos;
    protectcar = ["B_G_Offroad_01_armed_F","B_APC_Wheeled_01_cannon_F","B_MRAP_01_gmg_F","B_MRAP_01_hmg_F","B_LSV_01_armed_F"] call BIS_fnc_selectRandom createVehicle _flatPos;
    protectcar lock 0;
    protectcar setVectorUp [0,0,1];
    protectcar setDir _carDir;

    _carDir = random 360;
//    protectcar = ["CUP_B_UAZ_AGS30_CDF","CUP_B_UAZ_MG_CDF","CUP_B_Dingo_GL_CZ_Wdl","CUP_B_Dingo_CZ_Wdl","CUP_B_LR_Special_CZ_W","CUP_B_BAF_Coyote_GMG_W","CUP_B_BAF_Coyote_L2A1_W","CUP_B_LR_Special_GMG_GB_W","CUP_B_LR_Special_M2_GB_W","CUP_B_HMMWV_M2_USMC","CUP_B_HMMWV_M1114_USMC","CUP_B_HMMWV_MK19_USMC","CUP_B_RG31_M2_OD_USMC","CUP_B_RG31_Mk19_OD_USMC"] call BIS_fnc_selectRandom createVehicle _flatPos;
    protectcar = ["B_G_Offroad_01_armed_F","B_APC_Wheeled_01_cannon_F","B_MRAP_01_gmg_F","B_MRAP_01_hmg_F","B_LSV_01_armed_F"] call BIS_fnc_selectRandom createVehicle _flatPos;
    protectcar lock 0;
    protectcar setVectorUp [0,0,1];
    protectcar setDir _carDir;
//-------------------- SPAWN BRIEFING

    _flatPos2 = [0,0,0];
    _accepted2 = false;
    while {!_accepted2} do {
        _position2 = [[[_flatPos, 3000]],["water"]] call BIS_fnc_randomPos;
        _flatPos2 = _position2 isFlatEmpty[10, 1, 0.3, 10, 0, false];

        while {(count _flatPos2) < 2} do {
            _position2 = [[[_flatPos, 3000]],["water"]] call BIS_fnc_randomPos;
            _flatPos2 = _position2 isFlatEmpty[10, 1, 0.3, 10, 0, false];
        };

        if ((_flatPos2 distance _flatPos) > 2000 && (_flatPos2 distance (getMarkerPos currentAO)) > 1500) then {
            _accepted2 = true;
        };
    };
    waitUntil {_accepted2};
    
    campobject1 = "Land_CampingChair_V2_F" createVehicle [(_flatPos2 select 0) + (random 20),(_flatPos2 select 1) + (random 20)];
    _campobjectDir = random 360;
    campobject1 setDir _campobjectDir;
    campobject2 = "Land_CampingTable_F" createVehicle [(_flatPos2 select 0) + (random 20),(_flatPos2 select 1) + (random 20)];
    _campobjectDir = random 360;
    campobject2 setDir _campobjectDir;
    campobject3 = "Land_ChairPlastic_F" createVehicle [(_flatPos2 select 0) + (random 20),(_flatPos2 select 1) + (random 20)];
    _campobjectDir = random 360;
    campobject3 setDir _campobjectDir;
    campobject4 = "Land_CampingChair_V1_F" createVehicle [(_flatPos2 select 0) + (random 20),(_flatPos2 select 1) + (random 20)];
    _campobjectDir = random 360;
    campobject4 setDir _campobjectDir;
    campobject5 = "Campfire_burning_F" createVehicle [(_flatPos2 select 0) + (random 20),(_flatPos2 select 1) + (random 20)];
    _campobjectDir = random 360;
    campobject5 setDir _campobjectDir;
    campobject6 = "Land_TentDome_F" createVehicle [(_flatPos2 select 0) + (random 20),(_flatPos2 select 1) + (random 20)];
    _campobjectDir = random 360;
    campobject6 setDir _campobjectDir;
    campobject7 = "Land_TentA_F" createVehicle [(_flatPos2 select 0) + (random 20),(_flatPos2 select 1) + (random 20)];
    _campobjectDir = random 360;
    campobject7 setDir _campobjectDir;
    campobject8 = "CamoNet_BLUFOR_F" createVehicle [(_flatPos2 select 0) + (random 20),(_flatPos2 select 1) + (random 20)];
    _campobjectDir = random 360;
    campobject8 setDir _campobjectDir;
    carcamp = ["B_Truck_01_ammo_F","B_Truck_01_box_F","B_Truck_01_fuel_F","B_Truck_01_medical_F","B_Truck_01_Repair_F"] call BIS_fnc_selectRandom createVehicle [(_flatPos2 select 0) + (random 30),(_flatPos2 select 1) + (random 30)];
    //"CUP_B_Ural_Reammo_CDF","CUP_B_Ural_Refuel_CDF","CUP_B_Ural_Repair_CDF","B_G_Van_01_fuel_F"] call BIS_fnc_selectRandom createVehicle [(_flatPos2 select 0) + (random 30),(_flatPos2 select 1) + (random 30)];
    carcamp setVectorUp [0,0,1];
    _supplycarDir = random 360;
    carcamp setDir _supplycarDir;
//    _campArray = [_flatPos2] call QS_fnc_smcamp;
    _campArray = [grpNull];
    _campgroup = createGroup west; 
    _campman1 = "B_Soldier_SL_F" createUnit [[(_flatPos2 select 0) + (random 50),(_flatPos2 select 1) + (random 50)],_campgroup];
    _campman2 = "B_HeavyGunner_F" createUnit [[(_flatPos2 select 0) + (random 50),(_flatPos2 select 1) + (random 50)],_campgroup]; 
    _campman3 = "B_ghillie_lsh_F" createUnit [[(_flatPos2 select 0) + (random 50),(_flatPos2 select 1) + (random 50)],_campgroup];
    _campman4 = "B_Recon_Sharpshooter_F" createUnit [[(_flatPos2 select 0) + (random 50),(_flatPos2 select 1) + (random 50)],_campgroup];
    _campman5 = "B_recon_M_F" createUnit [[(_flatPos2 select 0) + (random 50),(_flatPos2 select 1) + (random 50)],_campgroup];
    _campman6 = "B_soldier_AT_F" createUnit [[(_flatPos2 select 0) + (random 50),(_flatPos2 select 1) + (random 50)],_campgroup];
    [_campgroup,_flatPos2] call BIS_fnc_taskDefend;
    
    _campArray = _campArray + [_campgroup];
    
    "object" setMarkerPos _flatPos;
    "object" setMarkerText "Supply";
    "areatargetmarker" setMarkerPos _flatPos2;
    "areatarget" setMarkerPos _flatPos2;
    sideMarkerText = "Send Supply to Camp";
    "areatargetmarker" setMarkerText "Side Mission: Send supply to Camp.";
    _briefing = "<img size='17' image='media\images\notificons\supply.jpg'/><br/><t align='center'><t size='2.2'>New Side Mission</t><br/><t size='1.5' color='#00B2EE'>Send supply to Camp</t><br/>____________________<br/>Delivery supply to camp</t>";
    [_briefing] remoteExec ["AW_fnc_globalHint",0,false];
    ["NewSideMission", "Send Supply to Camp"] remoteExec ["AW_fnc_globalNotification",0,false];
    sideMarkerText = "Send Supply to Camp";
//-------------------- [ CORE LOOPS ]
    sideMissionUp = true;
    SM_SUCCESS = false;
    SM_FAIL = false;
    distance1 = true;

while {distance1} do {
    if ((supplycar distance _flatPos2) < 2000) then {distance1 = false; enemy1 = true;};
    sleep 0.5;
    if (!alive supplycar) exitWith {
    sideMissionUp = false;
    supplycarfail = "Send supply failed!!!";
    hqSideChat = supplycarfail;
    [hqSideChat] remoteExec ["AW_fnc_globalSideChat",0,false];
    { _x setMarkerPos [-5500,-5500,-5500]; } forEach ["areatargetmarker", "areatarget","object"];
    sleep 5;
    [] spawn QS_fnc_SMhintFAIL;
    sleep 120;
    {[_x] spawn QS_fnc_SMdelete;} forEach [_campArray];
    { deleteVehicle _x } forEach [supplycar,campobject1,campobject2,campobject3,campobject4,campobject5,campobject6,campobject7,campobject8,carcamp];
    };
    sleep 0.5;
    "object" setMarkerPos (getpos supplycar);
    sleep 0.5;
};
waitUntil {(supplycar distance _flatPos2) < (2000 - random 500)};
if (!alive supplycar) exitWith {
    sideMissionUp = false;
    supplycarfail = "Send supply failed!!!";
    hqSideChat = supplycarfail;
    [hqSideChat] remoteExec ["AW_fnc_globalSideChat",0,false];
    { _x setMarkerPos [-5500,-5500,-5500]; } forEach ["areatargetmarker", "areatarget","object"];
    sleep 5;
    [] spawn QS_fnc_SMhintFAIL;
    sleep 120;
    {[_x] spawn QS_fnc_SMdelete;} forEach [_campArray];
    { deleteVehicle _x } forEach [supplycar,campobject1,campobject2,campobject3,campobject4,campobject5,campobject6,campobject7,campobject8,carcamp];
};

sleep 0.5;
"object" setMarkerPos (getpos supplycar);
_enemiesArray = [supplycar] call QS_fnc_smsupply;
while {enemy1} do {
    publicVariable "sidepatrolGroup"; sidepatrolGroup move getpos supplycar;
    sleep 0.5;
//    publicVariable "sidemrapGroup"; sidemrapGroup move getpos supplycar;
//    sleep 1;
    publicVariable "sidevehGroup"; sidevehGroup move getpos supplycar;
    sleep 0.5;
    if ((supplycar distance _flatPos2) < 1000) then {enemy1 = false;};
    sleep 0.5;
    if (!alive supplycar) exitWith {
    sideMissionUp = false;
    supplycarfail = "Send supply failed!!!";
    hqSideChat = supplycarfail;
    [hqSideChat] remoteExec ["AW_fnc_globalSideChat",0,false];
    { _x setMarkerPos [-5500,-5500,-5500]; } forEach ["areatargetmarker", "areatarget","object"];
    sleep 5;
    [] spawn QS_fnc_SMhintFAIL;
    sleep 120;
    {[_x] spawn QS_fnc_SMdelete;} forEach [_enemiesArray,_campArray];
    { deleteVehicle _x } forEach [supplycar,campobject1,campobject2,campobject3,campobject4,campobject5,campobject6,campobject7,campobject8,carcamp];
    };
    sleep 0.5;
    "object" setMarkerPos (getpos supplycar);
    sleep 0.5;
};

waitUntil {(supplycar distance _flatPos2) < (1000 - random 500)};
sleep 0.5;
if (!alive supplycar) exitWith {
    sideMissionUp = false;
    supplycarfail = "Send supply failed!!!";
    hqSideChat = supplycarfail;
    [hqSideChat] remoteExec ["AW_fnc_globalSideChat",0,false];
    { _x setMarkerPos [-5500,-5500,-5500]; } forEach ["areatargetmarker", "areatarget","object"];
    sleep 5;
    [] spawn QS_fnc_SMhintFAIL;
    sleep 120;
    {[_x] spawn QS_fnc_SMdelete;} forEach [_enemiesArray,_campArray];
    { deleteVehicle _x } forEach [supplycar,campobject1,campobject2,campobject3,campobject4,campobject5,campobject6,campobject7,campobject8,carcamp];
};

sleep 0.5;
"object" setMarkerPos (getpos supplycar);
_enemiesArray2 = [supplycar] call QS_fnc_smsupply2;
enemy2 = true;
while {enemy2} do {
    publicVariable "sidepatrolGroup"; sidepatrolGroup move getpos supplycar;
    sleep 0.5;
//    publicVariable "sidemrapGroup"; sidemrapGroup move getpos supplycar;
//    sleep 0.5;
    publicVariable "sidevehGroup"; sidevehGroup move getpos supplycar;
    sleep 0.5;
    publicVariable "sidepatrolGroup2"; sidepatrolGroup2 move getpos supplycar;
    sleep 0.5;
//    publicVariable "sidemrapGroup2"; sidemrapGroup move getpos supplycar;
//    sleep 0.5;
    publicVariable "sidevehGroup2"; sidevehGroup2 move getpos supplycar;
    sleep 0.5;
    if ((supplycar distance _flatPos2) < 25) then {enemy2 = false;};
    sleep 0.5;
    if (!alive supplycar) exitWith {
    supplycarfail = "Send supply failed!!!";
    hqSideChat = supplycarfail;
    [hqSideChat] remoteExec ["AW_fnc_globalSideChat",0,false];
    sideMissionUp = false;
    { _x setMarkerPos [-5500,-5500,-5500]; } forEach ["areatargetmarker", "areatarget","object"];
    sleep 5;
    [] spawn QS_fnc_SMhintFAIL;
    sleep 120;
    {[_x] spawn QS_fnc_SMdelete;} forEach [_enemiesArray,_enemiesArray2,_campArray];
    { deleteVehicle _x } forEach [supplycar,campobject1,campobject2,campobject3,campobject4,campobject5,campobject6,campobject7,campobject8,carcamp];
    };
    sleep 0.5;
    "object" setMarkerPos (getpos supplycar);
    sleep 0.5;
};

while {sideMissionUp} do {
    publicVariable "sidepatrolGroup"; sidepatrolGroup move getpos supplycar;
    sleep 0.5;
//    publicVariable "sidemrapGroup"; sidemrapGroup move getpos supplycar;
//    sleep 0.5;
    publicVariable "sidevehGroup"; sidevehGroup move getpos supplycar;
    sleep 0.5;
    publicVariable "sidepatrolGroup2"; sidepatrolGroup2 move getpos supplycar;
    sleep 0.5;
//    publicVariable "sidemrapGroup2"; sidemrapGroup move getpos supplycar;
//    sleep 0.5;
    publicVariable "sidevehGroup2"; sidevehGroup2 move getpos supplycar;
    sleep 0.5;
    
    if ((supplycar distance _flatPos2) < 25) then {SM_SUCCESS = true;};
    sleep 0.5;
    if (SM_SUCCESS) exitWith {
        supplycarsuccess = "Send Supply success!";
        hqSideChat = supplycarsuccess;
        [hqSideChat] remoteExec ["AW_fnc_globalSideChat",0,false];
        ["CompletedSub", "Send Supply success."] remoteExec ["AW_fnc_globalNotification",0,false];
        sleep 5;
        [] spawn QS_fnc_SMhintSUCCESS;
        sideMissionUp = false;
        { _x setMarkerPos [-5500,-5500,-5500]; } forEach ["areatargetmarker", "areatarget","object"];
        sleep 120;
        //[_enemiesArray,_enemiesArray2] spawn QS_fnc_SMdelete;
        {[_x] spawn QS_fnc_SMdelete;} forEach [_enemiesArray,_enemiesArray2,_campArray];
        { deleteVehicle _x } forEach [supplycar,campobject1,campobject2,campobject3,campobject4,campobject5,campobject6,campobject7,campobject8,carcamp];
        //{ deleteVehicle _x } forEach [supplycar];
    };
    sleep 1;
};

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Forum Statistics

    11.1k
    Total Topics
    66.4k
    Total Posts
×
×
  • Create New...