Jump to content

Recommended Posts

Hi,

 

I'm creating a covered mission.

I'm trying to create a script in which if some member of my group shoots, alert the enemy against and if it shoots my team too:

 

obj1 addEventHandler ["Killed",
{
	
	_unit = (_this select 0);
	_unitName = name _unit;
	_groupmember = nameofgroup _unit
	_unitSide = side _unit;
		
	_Killer = (_this select 1);
	_KillerName = name _Killer;
	_KillerSide = side _Killer;
	
	if (_unitSide == _KillerSide) then {
			hint "Este era un miembro del equipo";
		
	} else {
		_killer setCaptive 0;
	};
	
	
}];

 
 _restofunits = (units _group - [_leader]);


player addEventHandler ["Fired",
{
	
	 select 0 
	_unit = (_this select 0);
	_groupmember = nameofgroup _unit
	_weaponName = (_this select 1);
	
	if (_weaponName) then {
		_unit setCaptive 0;
	};
			
}];

but I do not know exactly how to do it with a group.

Can somebody help me?

 

Share this post


Link to post
Share on other sites
1 hour ago, redburn said:

Hi,

 

I'm creating a covered mission.

I'm trying to create a script in which if some member of my group shoots, alert the enemy against and if it shoots my team too:

 

but I do not know exactly how to do it with a group.

Can somebody help me?

 

 

This is what I'm using, works for all units and takes speed of sound and average reaction time into consideration:

 


//reveal all firing units to nearby units, no distinction between friend or foe

{

	_x addEventHandler ["Fired",{

		params ["_firer"];
		_nearbyUnits = allUnits select {_x distance2D _firer < viewDistance};//change viewDistance as needed

		{

			_reveal = [_x,_firer] spawn {

				params ["_unit","_firer"];
				//take speed of sound into consideration and add an average reaction time of ~0.17-0.21s for audible input

				_delay = (_unit distance _firer) / 343;
				sleep _delay;
				//reaction time
				sleep random [0.15,0.17,0.21];
				_unit reveal [_firer,0.5];//increase this number if you want a more immediate reaction

			};

		} forEach _nearbyUnits;

	}];

} forEach allUnits;

//to test
_rnd = selectRandom allUnits;
_rnd fire currentweapon _rnd;

Comments basically got it covered. Adjust the values to your liking, the reveal value at 4 will result in an immediate response (after speed of sound and reaction time has been applied).

 

Cheers

  • Like 5

Share this post


Link to post
Share on other sites
7 hours ago, Grumpy Old Man said:

 

This is what I'm using, works for all units and takes speed of sound and average reaction time into consideration:

 

 

Immersive, that's awesome. I may integrate this into my reaction script. Thanks.

  • Like 2

Share this post


Link to post
Share on other sites
1 hour ago, AZCoder said:

 

Immersive, that's awesome. I may integrate this into my reaction script. Thanks.

Thanks, it's a bit watered down, since I'm also using different reveal values for different weapons and distances, also taking suppressors into account, but something like this is easy to build upon.

 

Cheers

  • Thanks 1

Share this post


Link to post
Share on other sites
1 hour ago, Grumpy Old Man said:

Thanks, it's a bit watered down, since I'm also using different reveal values for different weapons and distances, also taking suppressors into account, but something like this is easy to build upon.

 

Cheers

Thanks man, i'm learning scripter lenguaje, it's more or less complicated but I'm trying to learn every thing.

  • Like 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

×