Jump to content
Sign in to follow this  
BEAKSBY

How do I script the following...

Recommended Posts

I want to say...

if there is no _killer then assign _killer = to the player(human) on the opposite side of _unit (that was killed).

I'm stuck at:

if ( isNull _killer) then {_killer = ??? something with playerSide , player and _unit and not ???};

Thanks in-advance

BTW this is for when an explosion kills an unit nearby since the "Killed" Event Handler does not return the killer for this case.

Share this post


Link to post
Share on other sites

How about tsomething like this?

_unit addeventhandler ["killed",
{
private ["_unit","_killer"];
_unit = _this select 0;  
_killer = _this select 1;
if (isNull _killer) then 
	{
	if ((side player) getFriend (side _unit) < 0.6)
		{
		_killer = player;
		};	
	};  
}];

Not on Arma box, can't test it for you.

Share this post


Link to post
Share on other sites
How about tsomething like this?

_unit addeventhandler ["killed",
{
private ["_unit","_killer"];
_unit = _this select 0;  
_killer = _this select 1;
if (isNull _killer) then 
	{
	if ((side player) getFriend (side _unit) < 0.6)
		{
		_killer = player;
		};	
	};  
}];

Not on Arma box, can't test it for you.

Yes but this is for MP, don't you have to designate the side of the player then?

Share this post


Link to post
Share on other sites
Yes but this is for MP, don't you have to designate the side of the player then?

Silly me, I completely overlooked where you asked about this being for MP. https://community.bistudio.com/wiki/playerSide

Share this post


Link to post
Share on other sites

Dead/killed unit will be Civilian, to get the actual side you will need to check the config

real_side = getNumber (configFile/"CfgVehicles"/(typeOf _unit)/"side");

results should be as follows

0=east

1=west

2=resistance

3=civilian

Share this post


Link to post
Share on other sites
REALSIDE

I suggest using faction

does the same as above.

Thanks, but...

...In my MP script when a unit in the "Killed" Event Handler is killed by a nearby explosion explosion, the

Dead/killed unit will be Civilian, to get the actual side you will need to check the config
as F2K Sel described.

So, getting back to my original request in post #1, I think my script should look like this:

_unit addeventhandler ["killed",

{

private ["_unit","_killer"];

_unit = _this select 0;

_killer = _this select 1;

_realSide = 0;

if ((side _unit) == civilian) then { //---if dead soldier was killed by an explosion

_realSide = getNumber (configFile/"CfgVehicles"/(typeOf _unit)/"side"); //---get actual side of dead soldier

if (side player != _realSide) then {_killer = player}; //---set player as _killer of _unit

};

Edited by BEAKSBY

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  

×