Jump to content

[Release] Flyby


f3cuk

Recommended Posts

Just a little event to scare players. Doesn't do anything else but select a random player and create a formation of maximum 5 aircrafts that fly over that player and then fly out of the map.

 

private["_model","_startpos","_endpos","_rand_player"];

_model            = ["MV22","F35B","Su25_CDF","A10","Mi24_D","AV8B","Su25_TK_EP1","L39_TK_EP1","C130J_US_EP1","MQ9PredatorB_US_EP1"] call BIS_fnc_selectRandom;
_startpos        = [[1000.0,2.0],[3500.0,2.0],[5000.0,2.0],[7500.0,2.0],[9712.0,663.067],[12304.0,1175.07],[14736.0,2500.0],[16240.0,5000.0],[16240.0,7500.0],[16240.0,10000.0]] call BIS_fnc_selectRandom;
_rand_player    = playableUnits call BIS_fnc_selectRandom;

if((isPlayer _rand_player) && (alive _rand_player)) then {

    _rand_num        = ceil(random 5);
    _playerpos        = [_rand_player] call FNC_GetPos;
    _number            = 0;

    for "_i" from 1 to _rand_num do {
    
        _number = (_number + 1);

        [_number,_model,_startpos,_playerpos] spawn {

            private["_aircraft","_aigroup","_pilot","_wp1","_wp2","_cor_y","_cor_x"];
            
            _number     = _this select 0;
            _model         = _this select 1;
            _startpos     = _this select 2;
            _playerpos     = _this select 3;            
            _endpos        = [0,16000,200];

            call {
                if(_number == 1) exitWith {
                    _cor_y = 0;
                    _cor_x = 0;
                };

                if(_number == 2) exitWith {
                    _cor_y = -60;
                    _cor_x = -60;
                };

                if(_number == 3) exitWith {
                    _cor_y = -60;
                    _cor_x = 60;
                };

                if(_number == 4) exitWith {
                    _cor_y = -120;
                    _cor_x = -120;
                };

                if(_number == 5) exitWith {
                    _cor_y = -120;
                    _cor_x = 120;
                };
            };

            _aircraft     = createVehicle [_model,[((_startpos select 0) + _cor_y),((_startpos select 1) + _cor_x),200],[],0,"FLY"];
            _aircraft     engineOn true;
            _aircraft     flyInHeight 200;

            _aigroup     = creategroup civilian;

            _pilot         = _aigroup createUnit ["SurvivorW2_DZ",[_aircraft] call FNC_GetPos,[],0,"FORM"];
            _pilot         setCombatMode "BLUE";
            _pilot         moveindriver _aircraft;
            _pilot         assignAsDriver _aircraft;

            _wp1         = _aigroup addWaypoint [[((_playerpos select 0) + _cor_y),((_playerpos select 1) + _cor_x),200],0];
            _wp1         setWaypointType "MOVE";
            _wp1        setWaypointBehaviour "CARELESS";

            _wp2         = _aigroup addWaypoint [[(_endpos select 0),(_endpos select 1),200],0];
            _wp2         setWaypointType "MOVE";
            _wp2         setWaypointBehaviour "CARELESS";

            waitUntil { (_aircraft distance _endpos < 500) };

            deleteVehicle _aircraft;
            deleteGroup _aigroup;
            deleteVehicle _pilot;

        };
    };
};
Link to comment
Share on other sites

  • 3 weeks later...

Very nice script! I made a video so people can see what it looks like. Note that I added the "Flyby Enroute" to the script for testing purposes so I'd know when it was starting.

 

 

If you want to make a random chance for this to be started, do the following:

 

Under this line:

_rand_player    = playableUnits call BIS_fnc_selectRandom;

and above this line:

if((isPlayer _rand_player) && (alive _rand_player)) then {

Add these lines:

_spawnChance	= 50; // Percent chance of spawning a crash number between 0 - 100 
_spawnRoll		= round(random 100);
 
 
if (_spawnRoll <= _spawnChance) then
{

Adjust _spawnChance to whatever percent chance you want it to occur.

 

Change the "private" line at the top to this:

private["_model","_startpos","_endpos","_rand_player","_spawnchance","_spawnroll"];

Under these lines:

				deleteVehicle _aircraft;
				deleteGroup _aigroup;
				deleteVehicle _pilot;

			};
		};
	};

Add another }: so it looks like this:

				deleteVehicle _aircraft;
				deleteGroup _aigroup;
				deleteVehicle _pilot;

			};
		};
	};
};
Link to comment
Share on other sites

Just a quick note on this.

 

Some users have noticed a drop in client FPS as soon as this event spawns. This is the reason why we have decided to take it off our server for now, until we figure out what is causing it (my best bet is that some aircraft models are causing it).

Link to comment
Share on other sites

why RemoteExec log ?)

if in waypointstatements.log :

 

21.12.2014 19:22:48: Daxaka (ip) guid - Condition Restriction #0 ["true", ""] [4:3 group, 1]

21.12.2014 19:22:52: [~DarK_VillaiN~] (ip) guid - Condition Restriction #0 ["true", ""] [6:3 group, 1]
21.12.2014 19:22:55: Dreykon (ip) guid - Condition Restriction #0 ["true", ""] [10:3 group, 1]
21.12.2014 19:23:03: Дунья Фистова (ip) guid - Condition Restriction #0 ["true", ""] [11:3 group, 1]
21.12.2014 19:23:10: Винни Пух (ip) guid - Condition Restriction #0 ["true", ""] [12:5 group, 1]
21.12.2014 19:24:06: Dreykon (ip) guid - Condition Restriction #0 ["true", ""] [16:5 group, 1]
21.12.2014 19:24:10: Cobaka (ip) guid - Condition Restriction #0 ["true", ""] [13:4 group, 1]
Link to comment
Share on other sites

  • 4 weeks later...

 

Just a little event to scare players. Doesn't do anything else but select a random player and create a formation of maximum 5 aircrafts that fly over that player and then fly out of the map.

private["_model","_startpos","_endpos","_rand_player"];

_model            = ["MV22","F35B","Su25_CDF","A10","Mi24_D","AV8B","Su25_TK_EP1","L39_TK_EP1","C130J_US_EP1","MQ9PredatorB_US_EP1"] call BIS_fnc_selectRandom;
_startpos        = [[1000.0,2.0],[3500.0,2.0],[5000.0,2.0],[7500.0,2.0],[9712.0,663.067],[12304.0,1175.07],[14736.0,2500.0],[16240.0,5000.0],[16240.0,7500.0],[16240.0,10000.0]] call BIS_fnc_selectRandom;
_rand_player    = playableUnits call BIS_fnc_selectRandom;

if((isPlayer _rand_player) && (alive _rand_player)) then {

    _rand_num        = ceil(random 5);
    _playerpos        = [_rand_player] call FNC_GetPos;
    _number            = 0;

    for "_i" from 1 to _rand_num do {
    
        _number = (_number + 1);

        [_number,_model,_startpos,_playerpos] spawn {

            private["_aircraft","_aigroup","_pilot","_wp1","_wp2","_cor_y","_cor_x"];
            
            _number     = _this select 0;
            _model         = _this select 1;
            _startpos     = _this select 2;
            _playerpos     = _this select 3;            
            _endpos        = [0,16000,200];

            call {
                if(_number == 1) exitWith {
                    _cor_y = 0;
                    _cor_x = 0;
                };

                if(_number == 2) exitWith {
                    _cor_y = -60;
                    _cor_x = -60;
                };

                if(_number == 3) exitWith {
                    _cor_y = -60;
                    _cor_x = 60;
                };

                if(_number == 4) exitWith {
                    _cor_y = -120;
                    _cor_x = -120;
                };

                if(_number == 5) exitWith {
                    _cor_y = -120;
                    _cor_x = 120;
                };
            };

            _aircraft     = createVehicle [_model,[((_startpos select 0) + _cor_y),((_startpos select 1) + _cor_x),200],[],0,"FLY"];
            _aircraft     engineOn true;
            _aircraft     flyInHeight 200;

            _aigroup     = creategroup civilian;

            _pilot         = _aigroup createUnit ["SurvivorW2_DZ",[_aircraft] call FNC_GetPos,[],0,"FORM"];
            _pilot         setCombatMode "BLUE";
            _pilot         moveindriver _aircraft;
            _pilot         assignAsDriver _aircraft;

            _wp1         = _aigroup addWaypoint [[((_playerpos select 0) + _cor_y),((_playerpos select 1) + _cor_x),200],0];
            _wp1         setWaypointType "MOVE";
            _wp1        setWaypointBehaviour "CARELESS";

            _wp2         = _aigroup addWaypoint [[(_endpos select 0),(_endpos select 1),200],0];
            _wp2         setWaypointType "MOVE";
            _wp2         setWaypointBehaviour "CARELESS";

            waitUntil { (_aircraft distance _endpos < 500) };

            deleteVehicle _aircraft;
            deleteGroup _aigroup;
            deleteVehicle _pilot;

        };
    };
};

The last part of the instructions you put make no sense to me.

You want me to move all of the code, just to make room for one more "};"?

Three of these "};" reach the end of the left side. Was there an open space for you?

            deleteVehicle _aircraft;
            deleteGroup _aigroup;
            deleteVehicle _pilot;

        };
    };
};

This is mine.

Link to comment
Share on other sites

The last part of the instructions you put make no sense to me.

You want me to move all of the code, just to make room for one more "};"?

Three of these "};" reach the end of the left side. Was there an open space for you?

            deleteVehicle _aircraft;
            deleteGroup _aigroup;
            deleteVehicle _pilot;

        };
    };
};

This is mine.

 

 

Does yours work though? :)

Link to comment
Share on other sites

	private["_model","_startpos","_endpos","_rand_player","_spawnchance","_spawnroll"];

	_model            = ["MV22","F35B","Su25_CDF","A10","Mi24_D","AV8B","Su25_TK_EP1","L39_TK_EP1","C130J_US_EP1","MQ9PredatorB_US_EP1"] call BIS_fnc_selectRandom;
	_startpos        = [[1000.0,2.0],[3500.0,2.0],[5000.0,2.0],[7500.0,2.0],[9712.0,663.067],[12304.0,1175.07],[14736.0,2500.0],[16240.0,5000.0],[16240.0,7500.0],[16240.0,10000.0]] call BIS_fnc_selectRandom;
	_rand_player    = playableUnits call BIS_fnc_selectRandom;
	
	_spawnChance	= 50; // Percent chance of spawning a crash number between 0 - 100 
	_spawnRoll		= round(random 100);
 
 
if (_spawnRoll <= _spawnChance) then
{

	if((isPlayer _rand_player) && (alive _rand_player)) then {

		_rand_num        = ceil(random 5);
		_playerpos        = [_rand_player] call FNC_GetPos;
		_number            = 0;

		for "_i" from 1 to _rand_num do {
		
			_number = (_number + 1);

			[_number,_model,_startpos,_playerpos] spawn {

				private["_aircraft","_aigroup","_pilot","_wp1","_wp2","_cor_y","_cor_x"];
				
				_number     = _this select 0;
				_model         = _this select 1;
				_startpos     = _this select 2;
				_playerpos     = _this select 3;            
				_endpos        = [0,16000,200];

				call {
					if(_number == 1) exitWith {
						_cor_y = 0;
						_cor_x = 0;
					};

					if(_number == 2) exitWith {
						_cor_y = -60;
						_cor_x = -60;
					};

					if(_number == 3) exitWith {
						_cor_y = -60;
						_cor_x = 60;
					};

					if(_number == 4) exitWith {
						_cor_y = -120;
						_cor_x = -120;
					};

					if(_number == 5) exitWith {
						_cor_y = -120;
						_cor_x = 120;
					};
				};

				_aircraft     = createVehicle [_model,[((_startpos select 0) + _cor_y),((_startpos select 1) + _cor_x),200],[],0,"FLY"];
				_aircraft     engineOn true;
				_aircraft     flyInHeight 200;

				_aigroup     = creategroup civilian;

				_pilot         = _aigroup createUnit ["SurvivorW2_DZ",[_aircraft] call FNC_GetPos,[],0,"FORM"];
				_pilot         setCombatMode "BLUE";
				_pilot         moveindriver _aircraft;
				_pilot         assignAsDriver _aircraft;

				_wp1         = _aigroup addWaypoint [[((_playerpos select 0) + _cor_y),((_playerpos select 1) + _cor_x),200],0];
				_wp1         setWaypointType "MOVE";
				_wp1        setWaypointBehaviour "CARELESS";

				_wp2         = _aigroup addWaypoint [[(_endpos select 0),(_endpos select 1),200],0];
				_wp2         setWaypointType "MOVE";
				_wp2         setWaypointBehaviour "CARELESS";

				waitUntil { (_aircraft distance _endpos < 500) };

				deleteVehicle _aircraft;
				deleteGroup _aigroup;
				deleteVehicle _pilot;

			};
		};
	};
};
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

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
  • Advertisement
  • Discord

×
×
  • Create New...