Jump to content
Sign in to follow this  
DSabre

Sab Aviation and Navy Scripts

Recommended Posts

I am by no means a scripter.

Still, I have made or modified a handful of scripts that some may find useful.

 

?interpolation=lanczos-none&output-forma

 

Random Flak Script = Continuous Fire or Barrage Mode

(Barrage will spawn random explosions above the object it is attached too = area barrage. Continuous will search for enemy aircraft and target them while flying around the script object).

Spoiler

Targeted Flak = Continuous Fire/ Barrage  - vs WEST side - change west to east in the code to switch

 


//flak simulation script  - original by *[600]*The Itch
// highly modified by [Dust]Sabre
//
// usage (in the init or on activation line)            flakarea1 = [flakarea1, 0.5, 100, 150, 0] execVM "sab_secretweapons\scripts_missions\randomflak.sqf";
// where flakarea1 is the name of the gamelogic or trigger
// 0.5 is the delay, 100 is a random height modifier and 150 is the radius of explosions, 0 is the mode (0=continuous, 1=barrage)


private ["_near_targets","_aamode","_delay", "_randomElement", "_foundEnemys", "_flak1", "_flaktype", "_unit", "_height", "_radius", "_flakLoc","_flakLocX","_flakLocY","_flakLocZ","_fheading","_exploslocx","_exploslocy","_exploslocz"];

_foundEnemys = false;
_flaktype = "SmallSecondary";
_unit = _This Select 0;
_delay = _This Select 1;
_height = _This Select 2;
_radius = _This Select 3;
_aamode = _This Select 4;

while {alive _unit} do {

	_near_targets = (getPos _unit) nearObjects ["plane",1500];
	// west or east
	{
		if ( side _x == west)  then {_foundEnemys=true; _flakLoc = getPos _x;};
	} 
	foreach _near_targets;
	
	if (_foundEnemys) then 
	{
		_flakLocZ = _flakLoc select 2;
		if (_aamode >0) then {_flakLoc = getPos _unit;};
		_flakLocX = _flakLoc select 0;
		_flakLocY = _flakLoc select 1;
		_flakLocZ = _flakLocZ - random _height;
		_fheading = random 360;

		_exploslocx = _flakLocX + ((random _radius) * (sin(_fheading)));
		_exploslocy = _flakLocY + ((random _radius) * (cos(_fheading)));
		_exploslocz = _flakLocZ + random _height;
		
		_flak1 = _flaktype createVehicle[_exploslocx, _exploslocy, _exploslocz];
		
		sleep _delay;
		_foundEnemys = false;
	};
	sleep 0.2;
};



 
 

 

 

 

 

Flak Skript = Ambient

Spoiler

Flak Area = Ambient - attach to a high flying plane for instance and think about some condition to stop execution of the code

 


//flak simulation script  - original by *[600]*The Itch
// highly modified by [Dust]Sabre
//
// usage (in the init or on activation line)            flakarea1 = [flakarea1, 0.5, 100, 150] execVM "randomflak.sqf";
// where flakarea1 is the name of the gamelogic or trigger
// 0.5 is the delay, 100 is a random height modifier and 150 is the radius of explosions,


private ["_delay", "_randomElement", "_flak1", "_flaktype", "_unit", "_height", "_radius", "_flakLoc","_flakLocX","_flakLocY","_flakLocZ","_fheading","_exploslocx","_exploslocy","_exploslocz"];



_flaktype = "SmallSecondary";
_unit = _This Select 0;
_delay = _This Select 1;
_height = _This Select 2;
_radius = _This Select 3;


while {alive _unit} do {

    
        _flakLoc = getPos _unit;
        _flakLocZ = _flakLoc select 2;
        _flakLocX = _flakLoc select 0;
        _flakLocY = _flakLoc select 1;
        _flakLocZ = _flakLocZ - random _height;
        _fheading = random 360;
        
        _exploslocx = _flakLocX + ((random _radius) * (sin(_fheading)));
        _exploslocy = _flakLocY + ((random _radius) * (cos(_fheading)));
        _exploslocz = _flakLocZ + random _height;
        
        
        _flak1 = _flaktype createVehicle[_exploslocx, _exploslocy, _exploslocz];
        
        sleep _delay;
        _foundEnemys = false;
        
    
    
    sleep 0.2;
};

 

 

 

 

 

?interpolation=lanczos-none&output-forma

 

Steam Script / Ship Exhaust Script (in this form it requires two memory points in the model: exhaust and exhaust2. you can modifiy it to your needs and exchange with coordinate offsets)

Spoiler

Ship Exhaust

 

 


//Ship Exhaust - by [Dust]Sabre
// usage add into your config:    class EventHandlers	{engine="_this execvm 'sab_secretweapons\scripts\shipexhaust.sqf';";};	
	

	params ["_veh","_exhausteffect","_exhausteffect", "_exhaust"];
	_ship = _this select 0;
	if !(local _ship) exitwith {};
	_exhaust = _ship selectionposition "exhaust";

	
	if (_exhaust isEqualTo [0,0,0]) exitWith {};
	
	while {alive _ship} do 
	{	
		if ((isengineon _ship))  then 
			{	
				
				_exhausteffect = "test_EmptyObjectForSmoke" createVehicle position _ship;
				_exhausteffect attachTo [_ship, [0, 0, 0], "exhaust"]; 
				_exhausteffect2 = "test_EmptyObjectForSmoke" createVehicle position _ship;
				_exhausteffect2 attachTo [_ship, [0, 0, 0], "exhaust2"]; 
				sleep 10;
			
				deleteVehicle _exhausteffect;	
				deleteVehicle _exhausteffect2;						
						
			};
			
		sleep 1;
		
		if !(isengineon _ship) exitwith {}; 
	};

	

 

 

 

?interpolation=lanczos-none&output-forma

 

Aircraft Hit Effect Script (this is just the little bits and pieces falling off. I want to redo the fire/random splode script before publishing it)

Spoiler

// ----- Aviation HitEffect script by [Dust]Sabre - free to use, have fun - many thanks to Yax for scripting help -----
// usage add into your config:    class EventHandlers	{dammage ="_this execvm 'sab_secretweapons\scripts\hiteffect.sqf';";};	
private ["_plane","_particles"];
_plane = _this select 0;

if !(local _plane) exitwith {};

if (alive _plane) then {

	 if (player in _plane) then {addCamShake [1, 0.5, 10]; player vehicleChat "Watch your six!";}; 
	_particles = "#particlesource" createVehicleLocal [0,0,0];
	_particles attachTo [_plane,[0,0,0]];
	_particles setParticleCircle [0, [0, 0, 0]];
	_particles setParticleRandom [1, [2, 2, 1], [0.25, 0.25, 0], 0, 0.1, [0, 0, 0, 0], 0, 0];
	_particles setParticleParams [["\A3\data_f\ParticleEffects\Shard\shard4.p3d",1,0,1,0], "", "SpaceObject", 1, 10, [0, 0, 0], [0, 0, -2], 1, 10, 0.1, 0.1, [2, 2], [[1, 1, 1 ,1], [1, 1, 1, 1], [1, 1, 1, 1]], [0, 1], 1, 0, "", "", _plane];
	_particles setDropInterval 0.1;
	sleep 1;
	deleteVehicle _particles;
	
};

sleep 0.5;

 

  • Like 2
  • Thanks 2

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  

×