Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Casio91Fin

Helicopter landing (TR) or rope

Recommended Posts

hey.
How would I get the helicopter to check if location x is a safe place to land and there are no obstacles, but if no suitable place to land can be found, then I could use [AI_Team] call SHK_Fastrope_fnc_AIs to remove the infantry from the helicopter.

here is a sample manuscript:
 

Quote
Spoiler


_BlacklistArray = [BlackListArea_1, BlackListArea_2, BlackListArea_3];
                        _DropZone1 = [SectorAlpha, 1, 800, 20, 0, 0.65, 0, _BlacklistArray] call BIS_fnc_findSafePos;
                        _HelipadTR = createVehicle ["Land_HelipadEmpty_F", _DropZone1, [], 0, "NONE"];
                        _SpawnHeliPos = [SectorAlpha, 2500, 3000, 30, 0, 1, 0, _BlacklistArray] call BIS_fnc_findSafePos;
                        _dir = [_SpawnHeliPos, _DropZone1] call BIS_fnc_dirTo;
                        _Helicopter = [_SpawnHeliPos, _dir, _KuljeHelikop select floor (random count _KuljeHelikop), _Side] call BIS_fnc_spawnVehicle;
                        _Heli = _Helicopter select 0;
                        _Helicrew = _Helicopter select 1;
                        _HeliGroup = _Helicopter select 2;
                        _Heli setVehicleLock "LOCKEDPLAYER";
                        _Heli flyInHeightASL [35 + (random 20), 25 + (random 10), 15 + (random 5)]; //standardAltitude / combatAltitude / stealthAltitude
                        clearItemCargoGlobal _Heli;
                        clearWeaponCargoGlobal _Heli;
                        clearMagazineCargoGlobal _Heli;
                        clearBackpackCargoGlobal _Heli;
                        _Heli lockInventory true;
                        _speed = (getNumber (configFile>>"cfgvehicles">>(typeOf _Heli)>>"maxspeed")) /2;
                        _Heli limitSpeed _speed;
                        _cargoLimit = getNumber (configFile >> "CfgVehicles" >> typeOf _Heli >> "transportSoldier"); 
                        _turretLimit = "getNumber (_x / 'dontCreateAI') == 1" configClasses (configfile >> "CfgVehicles" >> typeOf _Heli >> "Turrets");
                        _cargoLimit = _cargoLimit + (count _turretLimit) - 2;
                        {
                            _x allowFleeing 0;
                            _x setUnitAbility 1;
                            _x setSkill 1;
                            _x setUnloadInCombat [false, false];
                            _x disableAI "AUTOTARGET";
                            _x disableAI "MINEDETECTION";
                            _x enableAI "SUPPRESSION";
                            _x addEventHandler ["Explosion",
                            {
            	                params ["_unit", "_damage"];
                                if (_damage < 0.01) exitWith {};
                                _unit awake true;
                                _unit awake false;
                            }];
                        } forEach units _HeliGroup;
                        if (_cargoLimit > 9) then 
                        {
                            for "_i" from 1 to 2 do
                            {
                                private ["_Team_Leader", "_New_Soldier"];
                                New_AI_Team = createGroup [_Side, true];
                                _Team_Leader = New_AI_Team createUnit [_JoukJo select floor (random count _JoukJo), _SpawnHeliPos, [], 0, "NONE"];
                                _Team_Leader allowFleeing 0;
                                _Team_Leader disableAI "MINEDETECTION";
                                for "_j" from 1 to (_cargoLimit / 2) do
                                {
                                    _New_Soldier = New_AI_Team createUnit [_JalkavakiSo select floor (random count _JalkavakiSo), _SpawnHeliPos, [], 0 ,"NONE"];
                                    _New_Soldier allowFleeing 0;
                                    _New_Soldier disableAI "MINEDETECTION";
                                };
                                New_AI_Team deleteGroupWhenEmpty true;
                                {
                                    //When unit gets killed it goes into ragdoll state for a short while.
                                    _x addEventHandler ["Explosion",
                                    {
            	                        params ["_unit", "_damage"];
                                        if (_damage < 0.01) exitWith {};
                                        _unit awake true;
                                        _unit awake false;
                                    }];
                                } forEach units New_AI_Team;
                                {_x assignAsCargo _Heli; _x moveInCargo _Heli;} forEach units New_AI_Team;
                                _wpIf = New_AI_Team addWaypoint [SectorAlpha, 10];
                                _wpIf setWaypointType "SAD";
                                _wpIf setWaypointBehaviour "AWARE";
                                _wpIf setWaypointCombatMode "YELLOW";
                                _wpIf setWaypointStatements ["true", ""];
                        
                                _wpIf2 = New_AI_Team addWaypoint [SectorAlpha, 0];
                                _wpIf2 setWaypointType "CYCLE";
                                _wpIf2 setWaypointStatements ["true", ""];
                                _wpIf2 setWaypointTimeout [15,20,25];
                                _TotalSpawned = _TotalSpawned + 1;
                            };
                        } 
                        else 
                        {
                            for "_i" from 1 to 1 do
                            {
                                private ["_Team_Leader", "_New_Soldier"];
                                New_AI_Team = createGroup [_Side, true];
                                _Team_Leader = New_AI_Team createUnit [_JoukJo select floor (random count _JoukJo), _SpawnHeliPos, [], 0, "NONE"];
                                _Team_Leader allowFleeing 0;
                                _Team_Leader disableAI "MINEDETECTION";
                                for "_j" from 1 to _cargoLimit do
                                {
                                    _New_Soldier = New_AI_Team createUnit [_JalkavakiSo select floor (random count _JalkavakiSo), _SpawnHeliPos, [], 0 ,"NONE"];
                                    _New_Soldier allowFleeing 0;
                                    _New_Soldier disableAI "MINEDETECTION";
                                };
                                New_AI_Team deleteGroupWhenEmpty true;
                                {
                                    //When unit gets killed it goes into ragdoll state for a short while.
                                    _x addEventHandler ["Explosion",
                                    {
            	                        params ["_unit", "_damage"];
                                        if (_damage < 0.01) exitWith {};
                                        _unit awake true;
                                        _unit awake false;
                                    }];
                                } forEach units New_AI_Team;
                                {_x assignAsCargo _Heli; _x moveInCargo _Heli;} forEach units New_AI_Team;
                                _wpIf = New_AI_Team addWaypoint [SectorAlpha, 10];
                                _wpIf setWaypointType "SAD";
                                _wpIf setWaypointBehaviour "AWARE";
                                _wpIf setWaypointCombatMode "YELLOW";
                                _wpIf setWaypointStatements ["true", ""];
                        
                                _wpIf2 = New_AI_Team addWaypoint [SectorAlpha, 0];
                                _wpIf2 setWaypointType "CYCLE";
                                _wpIf2 setWaypointStatements ["true", ""];
                                _wpIf2 setWaypointTimeout [15,20,25];
                                _TotalSpawned = _TotalSpawned + 1;
                            };
                        };                          
                        _wp1 = _HeliGroup addWaypoint [_DropZone1, 10];
                        _wp1 setWaypointSpeed "NORMAL";
                        _wp1 setWaypointType "TR UNLOAD";
                        _wp1 setWaypointBehaviour "COMBAT";
                        _wp1 setWaypointCombatMode "YELLOW";
                        _wp1 setWaypointStatements ["true", "(vehicle this) LAND 'GET IN'; New_AI_Team leaveVehicle _Heli; waitUntil {({!(alive _x) || _x in _heli} count (units New_AI_Team)) == 0}; {_x setCombatMode 'RED'; _x setBehaviour 'AWARE';} forEach units New_AI_Team;"];
                        _wp1 setWaypointTimeout [15,20,25];

                        _wp2 = _HeliGroup addWaypoint [_SpawnHeliPos, 0];
                        _wp2 setWaypointSpeed "FULL";
                        _wp2 setWaypointBehaviour "STEALTH";
                        _wp2 setWaypointCombatMode "YELLOW";
                        _wp2 setWaypointType "MOVE";
                        _wp2 setWaypointStatements ["true", "{deleteVehicle _x} forEach crew (vehicle this) + [vehicle this];"];

 

 

 

Edited by Casio91Fin

Share this post


Link to post
Share on other sites

×