AmbientFlyByBombing Script
Benötigt werden zwei Marker: StartMarker "AmbientFlyBySpawn" EndMarker "AmbientFlyByDelete"
Die ClassNames der Flugzeuge. Hier: "vn_b_air_f100d_hbmb","vn_b_air_f4c_hbmb"
Welche Bomben und wieviel geworfen werden kann im bombarray bestimmt werden.
Die Abwurfzeit wird über ein einebautes Delay (hier 15s nach spawn) geregelt
Code
- /*
- by Spiderman, edit by SmartGun
- Description:
- Spawns an ambient air unit, makes it move and deletes it when it reaches destination
- Vehicle will never engage and will be flagged as captive
- Good for simple creation of ambient fly by's
- Editor required:
- StartMarker "AmbientFlyBySpawn"
- EndMarker "AmbientFlyByDelete"
- Script:
- Edit by SmartGun @ 23.02.2021
- - script will now spawn multiple planes of the same type per Flyby
- - debug info added
- - see "Params Script" below
- Trigger activation:
- _null = [] execVM "scripts\AmbientFlyByBombing.sqf";
- */
- if (!isServer) exitWith {};
- while {true} do {
- /*/////////////////////////////
- Params Script Start
- /////////////////////////////*/
- // ClassNames of Planes
- private _plane = selectRandom ["vn_b_air_f100d_hbmb","vn_b_air_f4c_hbmb"];
- private _planes = selectRandom [2,3,4]; // number of planes per flyby
- private _planeDelay = 8 + (random 15); // delay between planes
- private _FlyByDelay = (120 + (random 60)); // time between flybys
- private _debug = false; // true -> show info in systemchat, false -> off
- /*/////////////////////////////
- Params Script End
- /////////////////////////////*/
- if _debug then {
- systemChat format ["FlyBy: %1 plane(s) of Type: '%2' / %3, delay %4s",_planes,_plane,getText (configFile >> "CfgVehicles" >> _plane >> "displayName"),_planeDelay];
- systemChat format ["Next FlyBy in: %1 seconds -> aprox. %2 minutes",_FlyByDelay,round (_FlyByDelay/60)];
- };
- _fnc_FlyBy = {
- params ["_plane"];
- //Spawn the vehicle
- private _startPos = [(getMarkerPos "AmbientFlyByBombingSpawn") select 0,(getMarkerPos "AmbientFlyByBombingSpawn") select 1,0];
- private _extraVec = [_startPos, 0, _plane, civilian] call BIS_fnc_spawnVehicle;
- private _vehicle = _extraVec select 0;
- private _vehicleGroup = _extraVec select 2;
- //The vehicle/group should ignore it's surroundings
- _vehicle setDir ([getMarkerPos "AmbientFlyByBombingSpawn",getMarkerPos "AmbientFlyByBombingDelete"] call BIS_fnc_dirTo);
- _vehicle disableAi "TARGET";
- _vehicle disableAi "AUTOTARGET";
- _vehicle setCaptive true;
- _vehicleGroup allowFleeing 0;
- //_Vehicle setPosASL [position _Vehicle select 0, position _Vehicle select 1, 250]; //Above Sea Level setPosASL
- _Vehicle setPosATL [getPosATL _Vehicle select 0, getPosATL _Vehicle select 1, (getPosATL _Vehicle select 2) + 80]; //Above Terrain Level setPosATL
- //Give Speed
- private _vel = velocity _vehicle;
- private _dir = direction _vehicle;
- private _speed = 300; comment "Added speed";
- _vehicle setVelocity [
- (_vel select 0) + (sin _dir * _speed),
- (_vel select 1) + (cos _dir * _speed),
- (_vel select 2)
- ];
- private _wp = _vehicleGroup addWaypoint [getMarkerPos "AmbientFlyByBombingDelete", 0];
- _wp setWaypointType "MOVE";
- _wp setWaypointBehaviour "CARELESS";
- _wp setWaypointCombatMode "BLUE";
- _wp setWaypointSpeed "NORMAL";
- _wp setWaypointStatements [
- "true",
- "private ['_group', '_vehicle']; _group = group this; _vehicle = vehicle this; { deleteVehicle _x } forEach units _group; deleteVehicle _vehicle; deleteGroup _group;"
- ];
- //Dropping after spawn
- sleep 15;
- private _bombarray = selectRandom ["vn_bomb_500_mk82_he_ammo","vn_bomb_500_mk82_se_ammo","vn_bomb_500_mk82_dc_ammo","vn_bomb_2000_gbu8_he_ammo","vn_bomb_2000_mk84_he_ammo","vn_bomb_750_m117_he_ammo","vn_bomb_750_m117_he_ammo","vn_bomb_2000_gbu8_he_ammo","vn_bomb_500_blu1b_fb_ammo","vn_bomb_750_blu1b_fb_ammo","vn_bomb_100_m47_wp_ammo","BombCluster_01_Ammo_F"];
- private _bombDelay = 0.2 + (random 0.4);
- for "_i" from 1 to 4 do {
- _bomb = _bombarray createVehicle ((getPos _vehicle) vectorAdd [0,0,-30]);
- _bomb setDir getDir _vehicle;
- _bomb setVelocityModelSpace [0,50,0];
- sleep _bombDelay;
- };
- };
- for "_i" from 1 to _planes do { [_plane] spawn _fnc_FlyBy; sleep _planeDelay; };
- sleep _FlyByDelay;
- };