Jump to content
Sign in to follow this  
eggbeast

support option - illuminate area

Recommended Posts

Hi I'm trying to build a support option to illuminate an area with a barrage of flares. has anyone done this already?

the script i'm using is an expansion of the smokescreen script that i know works well:

	 case 20: // Illumination
{
_allobj = ["F_40mm_White","F_40mm_Green","F_40mm_Red","F_40mm_Yellow"];
_max = (count _allobj)-1;
	_i = 0;
	while {_i < 30} do 
	{
		_k = createVehicle [(_allobj select round random _max),[(position _base select 0), (position _base select 1),50], [], _size, "NONE"];
		_i = _i + 1;
		sleep (random 20);
	};		
};

_base is defined as the location ofthe map click marker and it works for all other support functions

ammo types to consider:

M203 40mm flares: "F_40mm_White","F_40mm_Green","F_40mm_Red","F_40mm_Yellow"

Arty flares: ARTY_Sh_105_ILLUM, ARTY_Sh_82_ILLUM, ARTY_Sh_122_ILLUM

The thing is when i run this script with arty shells it works

_k = createVehicle ["Sh_122_HE",[(position _base select 0), (position _base select 1),50], [], _size, "NONE"];

and with smoke it works

_k = createVehicle ["SmokeShell",[(position _base select 0), (position _base select 1),50], [], _size, "NONE"];

but none of the flares ignite... is there a trick to this that I'm missing?

Share this post


Link to post
Share on other sites

Dunno if this works but try it:

_flare_types = ["F_40mm_White","F_40mm_Green","F_40mm_Red","F_40mm_yellow"];

_flare_type = count _flare_types;

while {_i < 30} do

{

_theflare = _flare_types select random _flare_type;

_flare = _theflare createVehicle [getPos _base selec 0, getPos _base select 1, 50];

_i = _i + 1;

sleep (random 20);

};

Share this post


Link to post
Share on other sites

i'll try this alternative create and position scripting but i'm wondering more about the type of ammo and the init of it and height etc. as the script works fine for other ammo like smoke and HE shells

Share this post


Link to post
Share on other sites

this worked perfectly - thanks JWC - you're a good man.

	 case 20: // Illumination
{
_flare_types = ["F_40mm_White","F_40mm_Green","F_40mm_Red","F_40mm _yellow"];
_flare_max = (count _flare_types)-1;
_theflare = _flare_types select (round random _flare_max);
while {_i < 30} do
	{
		_rand_flare = random 100;
		_flare = _theflare createVehicle [(getPos _base select 0)+(_rand_flare-50), (getPos _base select 1)+(_rand_flare-50), 180];
		_i = _i + 1;
		sleep 20+((_rand_flare+10)/10);
	}; 
};

Share this post


Link to post
Share on other sites

You might want to reconsider stuff after watching this:

Here is what I do in Domino arty script to create range and lateral spread illumination, that's truly

illumination.

First lets create the positional arrays (easier for multiplayer I guess) Only server has to do it:

switch (ari_type) do {
case "flare": {
	_number_shells = 18;
       _height = 450; //realistic value is 600, but even with plenty lights that looks bad
	_type = "ARTY_Flare_Medium";
       _radius = 350;
       _arix = getPos AriTarget select 0;
       _ariy = getPos AriTarget select 1;
       call compile format ["_ang = (_arix - (getPos %1 select 0)) atan2 (_ariy - (getPos %1 select 1));", _arti_operator];
       if(abs _ang != _ang) then {angle = _ang + 360};
       _posf = [_arix + _radius * sin(_ang), _ariy + _radius * cos(_ang)]; //in front range
       _posb = [_arix - _radius * sin(_ang), _ariy - _radius * cos(_ang)]; //behind range
       _posl = [_arix + _radius * sin(_ang-90), _ariy + _radius * cos(_ang-90)]; //left lateral
       _posr = [_arix + _radius * sin(_ang+90), _ariy + _radius * cos(_ang+90)]; //right lateral
};
case "he": {
	_number_shells = 6;
	_height = 500;
	_type = (if (d_enemy_side == "EAST") then {"ARTY_Sh_105_HE"} else {"ARTY_Sh_122_HE"});
};
case "smoke": {
	_number_shells = 2;
	_height = 0;
	_type = "ARTY_SmokeShellWhite";
};
... ...

Now, do all your chatter stuff (remember to start this process on clients) and delay flight time, then we create the actual shells (I've included smoke and ACE viewblocks in case you use ACE).

switch (ari_type) do {
	case "flare": {
		sleep 1;
		_strenght = 6; //Use this until we get flares with proper arty brightness.
		for "_i" from 0 to (_number_shells-1) do {
			for "_j" from 0 to (_strenght-1) do {
				_dummy = _type createVehicle [(_wp_array select _i) select 0, (_wp_array select _i) select 1, ((_wp_array select _i) select 2)-_j/100];
				[nil,nil,nil,nil,nil,_dummy] spawn ace_sys_flares_fnc_slowdescent;
				sleep 0.002;
			};
			["ari1sound",2,_dummy,_wp_array select _i] call XSendNetStartScriptClient;
			if (((_i+1) % 4 == 0) && (_i > 1)) then {
				sleep 18 + (ceil random 5)
			} else {
				sleep 0.5 + random 1.5
			};
		};
	};
	case "he": {
		for "_i" from 0 to (_number_shells - 1) do {
			_shell = _type createVehicle (_wp_array select _i);
//				_shell setVelocity [0,0,-444];
			sleep 1.923 + (random 2);
			["ari1sound",1,_shell,AriTarget] call XSendNetStartScriptClient;
		};
	};
	case "smoke": {
		for "_i" from 0 to (_number_shells - 1) do {
			//Since smoke stops producing after impact, lets make it burn for a while by creating new puffs at intervals.
			["ari1sound",0,nil,AriTarget] call XSendNetStartScriptClient;
			_xo = ceil random 10;
			sleep 1.923 + (_xo / 10);
			[_i, _wp_array, _type] spawn {
				_type = _this select 2;
				for "_j" from 0 to 4 do {
					_shell = _type createVehicle ((_this select 1) select (_this select 0));
					[(_this select 1) select (_this select 0)] spawn {
						_oldpos = _this select 0;
						for "_i" from 0 to 19 do { //gives about 200m of smoke at these high wind conditions
							_fact = _i * 0.84; //set to match wind drift of arty smoke particles.
							_pos = [(_oldpos select 0) + _fact*(wind select 0), (_oldpos select 1) + _fact*(wind select 1),0];
							[_pos] spawn {
								sleep 5;
								_viewblock = "ACE_Viewblock_Inv10x10" createVehicle (_this select 0);
								sleep 5;
								deleteVehicle _viewblock;
							};
							sleep 2.123; //suits the current high winds rather good.
						};
					};
					sleep 7.678;
				};
			};
		};
	};
... ...

The following is executed on clients, adding trail effects to HE shells and smoke, glare, and an extra lightpoint (you might not want this) to illumination flares:

	case "ari1sound": {
		if (ari_type == "he") then {sleep 5}; //give some time to pickup some falling speed, as setVelocity fails in multiplayer
		if (typeName (_this select 3) == "ARRAY") then {
			_soundsource = "HeliHEmpty" createVehicleLocal (_this select 3);
			_soundsource say (["Ari1","Ari2","Ari3","Ari4","Ari5","Ari6"] select (floor random 6));
			[_soundsource] spawn {sleep 5; deleteVehicle (_this select 0)};
		} else {
			(_this select 3) say (["Ari1","Ari2","Ari3","Ari4","Ari5","Ari6"] select (floor random 6));
		};
		sleep 1.234;
		switch (_this select 1) do {
			private ["_sm","_sp","_li","_to_delete"];
			case 1: { //HE trail
				sleep 0.5;
				_trail = "#particlesource" createVehicleLocal getpos (_this select 2);
					_trail setParticleRandom [0.0, [0.3, 0.3, 0.3], [0.4, 0.4, 0.4], 1, 0.2, [0, 0, 0, 0], 0, 0];
					_trail setDropInterval 0.001;
					_trail setParticleParams [
					["\ca\Data\ParticleEffects\Universal\Universal.p3d", 16, 12, 8],
					"", "Billboard", 1, 0.7,
					[0,0,0.0], [0,0,0], 
					1, 1, 0.8, 0.5, 
					[0.5, 0.5, 0.5], 
					[[0.8, 0.8, 0.8, 0.0],[0.9,0.9,0.9,0.25],[1.0, 1.0, 1.0, 0.0]], [1.125], 0.1, 0.1, "", "", (_this select 2), 0];
				_trail attachTo [(_this select 2), [0,0,0]];
				_trail;
			};
			case 2: { //Flare smoke, ref http://www.youtube.com/watch?v=Wgz2bBj14qI
				_to_delete = [];
				_sm = "#particlesource" createVehicleLocal getpos (_this select 2);
				_sm setParticleRandom [0.5, [0, 0, 0], [0, 0, 0], 0, 0.3, [0, 0, 0, 0], 0, 0, 360];
				_sm setParticleParams [["\ca\Data\ParticleEffects\Universal\Universal", 16, 12, 8,0],
					"", "Billboard", 1, 30, [0, 0, 0],
					[0,0,0], 1, 1, 0.80, 0.5, [1.3,4],
					[[0.9,0.9,0.9,0.6], [1,1,1,0.3], [1,1,1,0]],[1],0.1,0.1,"","",_this select 2];	
				_sm setdropinterval 0.02;

				_sp = "#particlesource" createVehicleLocal getpos (_this select 2);
				_sp setParticleRandom [0.03, [0, 0, 0], [0, 0, 0], 0, 0.2, [0, 0, 0, 0], 0, 0, 360];
				_sp setParticleParams [["\ca\Data\ParticleEffects\Universal\Universal", 16, 13, 2,0],
					"", "Billboard", 1, 0.1, [0, 0, 0],
					[0,0,0], 1, 1, 0.80, 0.5, [1.5,0],
					[[1,1,1,-4], [1,1,1,-4], [1,1,1,-2],[1,1,1,0]],[1000],0.1,0.1,"","",_this select 2,360];	
				_sp setdropinterval 0.001;

// Looks awesome when already within zone, but coming in looks awful
				_li = "#lightpoint" createVehicleLocal getpos (_this select 2);
				_li setLightBrightness 3.4;
				_li setLightAmbient[0.8, 0.6, 0.2];
				_li setLightColor[1, 0.5, 0.2];
				_li lightAttachObject [_this select 2, [0,0,0]];
				_to_delete = _to_delete + [_sm, _sp, _li];
				[_to_delete] spawn {
					sleep 45; //Match whatever timetolive the actual flare has
					{deleteVehicle _x} forEach (_this select 0);
				};
			};
		};
	};

If you want to see how it looks like (remember the viewblock stuff is invisible), you can find an example mission here.

Share this post


Link to post
Share on other sites

wow thanksfor sharingthiswork - it looks peachy - ill check it out

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  

×