Jump to content
Sign in to follow this  
macnova1

Mission Issues with helicopters and taskdefend

Recommended Posts

Hi sorry to bother everyone, I have been working on this mission for weeks trying all kinds of different script, right now I have a oil rig made and spawning, with 2 helos spawning and landing and blowing up cos they come in way hot, i would like them to land drop troops off then their engines turn off as they will be part reward for completing the mission on an exile server , also at one point i had the static guns being used with BIS_fnc_taskDefend now its not working so any help there would be great too, here is what i have

any help would be great (i am using a streamline server to host the server if that helps)


    
_missionRigGuns = [


["rhsgref_ins_zsu234", [8735.68, 25196, 67.9931]],
["rhsgref_ins_ZU23", [8192.2, 25305.7, 27.6065]],
["rhsgref_ins_ZU23", [8015.43, 24929.2, 34.6462]],
["rhsgref_ins_ZU23", [8441.75, 25010.9, 109.287]],
["rhsgref_ins_zsu234",[8460.99, 25028.6, 107.33]],
["rhsgref_ins_ZU23", [8692.93, 24850.9, 25.6884]],
["rhsgref_ins_ZU23", [8778.6, 25182.4, 68.1689]],
["rhsgref_ins_ZU23", [8789.81, 25181.3, 67.9752]],
["rhsgref_ins_ZU23", [8799.1, 25180.3, 67.4169]],
["rhsgref_ins_ZU23", [8718.96, 25177.7, 73.8134]],
["rhsgref_ins_zsu234", [8735.68, 25196, 67.9931]]

];


_group1 = createGroup EAST;

{
    _vehicle = createVehicle [(_x select 0),(_x select 1),[],0,"NONE"];
    createVehicleCrew _vehicle;
    _vehicle setVectorUp surfaceNormal position _vehicle;
    {
        
    _x addMPEventHandler 
        ["MPKilled",
            {

                private ["_killer","_currentRespect","_amountEarned","_newRespect","_killSummary","_newKillerFrags"];

                _killed = _this select 0;
                _killer = _this select 2;

                _killingPlayer = _killer call ExileServer_util_getFragKiller;

                Event_ALLAI_SimulatedUnits = Event_ALLAI_SimulatedUnits - [_killed]; 

                _currentRespect = _killingPlayer getVariable ["ExileScore", 0];
                _amountEarned = 600;
                _newRespect = _currentRespect + _amountEarned;

                _killingPlayer setVariable ["ExileScore", _newRespect];
                //_killSummary = [];
                //_killSummary pushBack ["ENEMY FRAGGED", _amountEarned];
                //[_killingPlayer, "showFragRequest", [_killSummary]] call ExileServer_system_network_send_to;
                
                _newKillerFrags = _killingPlayer getVariable ["ExileKills", 0];
                _newKillerFrags = _newKillerFrags + 1;
                _killingPlayer setVariable ["ExileKills", _newKillerFrags];
                format["addAccountKill:%1", getPlayerUID _killingPlayer] call ExileServer_system_database_query_fireAndForget;

                format["setAccountScore:%1:%2", _newRespect, getPlayerUID _killingPlayer] call ExileServer_system_database_query_fireAndForget;
                _killingPlayer call ExileServer_object_player_sendStatsUpdate;

            }
        ];
    } forEach crew _vehicle;
    [_group1, _vehicle] call BIS_fnc_taskDefend;
    
    
    _vehicle addMPEventHandler 
    ["MPKilled",
        {

            private ["_killer","_currentRespect","_amountEarned","_newRespect","_killSummary","_newKillerFrags"];

            _killed = _this select 0;
            _killer = _this select 2;

            _killingPlayer = _killer call ExileServer_util_getFragKiller;

            Event_ALLAI_SimulatedUnits = Event_ALLAI_SimulatedUnits - [_killed]; 

            _currentRespect = _killingPlayer getVariable ["ExileScore", 0];
            _amountEarned = 10000;
            _newRespect = _currentRespect + _amountEarned;

            _killingPlayer setVariable ["ExileScore", _newRespect];
            _killSummary = [];
            _killSummary pushBack ["VEHICLE DESTROYED", _amountEarned];
            [_killingPlayer, "showFragRequest", [_killSummary]] call ExileServer_system_network_send_to;
                
            //_newKillerFrags = _killingPlayer getVariable ["ExileKills", 0];
            //_newKillerFrags = _newKillerFrags + 1;
            //_killingPlayer setVariable ["ExileKills", _newKillerFrags];
            //format["addAccountKill:%1", getPlayerUID _killingPlayer] call ExileServer_system_database_query_fireAndForget;

            format["setAccountScore:%1:%2", _newRespect, getPlayerUID _killingPlayer] call ExileServer_system_database_query_fireAndForget;
            _killingPlayer call ExileServer_object_player_sendStatsUpdate;

        }
    ];
} forEach _missionVehicles;

    // Options.
// _groupType = (configFile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_ReconPatrol"); // CONFIG - CfgGroups entry of preset group
_groupType = ["O_Soldier_SL_F", "O_Soldier_LAT_F", "O_soldier_AR_F", "O_Soldier_LAT_F", "O_soldier_AR_F", "O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_SL_F", "O_Soldier_LAT_F", "O_soldier_AR_F", "O_Soldier_LAT_F", "O_soldier_AR_F", "O_Soldier_F","O_Soldier_F","O_Soldier_F"]; // ARRAY - List of classnames to spawn for reinforcements. Option instead of above.
_groupType2 = ["O_Soldier_SL_F", "O_Soldier_LAT_F", "O_soldier_AR_F", "O_Soldier_LAT_F", "O_soldier_AR_F", "O_Soldier_F","O_Soldier_F","O_Soldier_F"];


_landPos = getMarkerPos "HELI3";  // Where you want them to land.
_spawnPos = getMarkerPos "Heli1";  // Where they spawnfrom.

_landPos2 = getMarkerPos "HELI4";  // Where you want them to land.
_spawnPos2 = getMarkerPos "Heli2";  // Where they spawnfrom.


// Spawn invis helipad to land on.
_helipad = createVehicle ["Land_HeliPadEmpty_F", _landPos, [], 0, "NONE"];
// Spawn invis helipad to land on.
_helipad2 = createVehicle ["Land_HeliPadEmpty_F", _landPos2, [], 0, "NONE"];

// Spawn helicopter and crew.
_helisv = [_spawnPos, 180, "B_Heli_Transport_03_F", EAST] call BIS_fnc_spawnVehicle;  
_heli = _helisv select 0;
_heliCrew = _helisv select 1;
_heliGroup = _helisv select 2;


// Spawn helicopter and crew.
_helisv2 = [_spawnPos2, 180, "O_Heli_Attack_02_black_F", EAST] call BIS_fnc_spawnVehicle;  
_heli2 = _helisv2 select 0;
_heliCrew2 = _helisv2 select 1;
_heliGroup2 = _helisv2 select 2;

// Spawn reinforcements and get them in the helicopter.
_units = [_spawnPos, EAST, _groupType] call BIS_fnc_spawnGroup;
{_x assignAsCargo _heli; _x moveInCargo _heli;} forEach units _units; 

   // Spawn reinforcements and get them in the helicopter.
_units2 = [_spawnPos2, EAST, _groupType2] call BIS_fnc_spawnGroup;
{_x assignAsCargo _heli2; _x moveInCargo _heli2;} forEach units _units2; 

// Stuffs
{_x allowFleeing 0} forEach units _units,_units2;

// Waypoint to the location    
_wp1 = _heliGroup addWaypoint [_landPos, 0];  
_wp1 setWaypointSpeed "LIMITED";  
_wp1 setWaypointType "UNLOAD";
_wp1 setWaypointStatements ["true", "(vehicle this) LAND 'GET OUT';"]; 


_wp2 = _heliGroup2 addWaypoint [_landPos2, 0];  
_wp2 setWaypointSpeed "LIMITED";  
_wp2 setWaypointType "UNLOAD";
_wp2 setWaypointStatements ["true", "(vehicle this) LAND 'GET OUT';"]; 

// Get out!
_units leaveVehicle _heli;
//sleep 5;

// Get out!
_units2 leaveVehicle _heli2;
//sleep 5;

// Wait till we're out.
waitUntil{sleep 1; {_x in _heli} count units _units == 0};
sleep 5;

// Wait till we're out.
waitUntil{sleep 1; {_x in _heli2} count units _units2 == 0};
sleep 5;

// Release heli from being landed and clean up.
_heli flyInHeight 0;
_heli engineOn false; 
deleteVehicle _helipad;

// Release heli from being landed and clean up.
_heli2 engineOn false;
_heli2 flyInHeight0;

deleteVehicle _helipad;

    
    
    
    
OffshoreMissionCount = 1;


}
else {
    diag_log "Offshore Mission is already spawned";
};

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×