Forum Jump :

Author Message


Posts: 13
Rank:


Level: Member

Country: 00
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2015-05-03 07:44        
     
SOLUTIONS FOUND. READ BELOW.

Hi guys. My first thread here. I'm making missions and I decided to improve my script which shows radio message when a unit is killed.

Previously it was based on the unit's group, I use it as follows:

_eliminatedUnit = _this select 0;
_attackingUnit = _this select 1; 

if (format["%1", group _attackingUnit] == format["%1", group player]) then {
	player groupChat "Target eliminated (" +(typeof _eliminatedUnit) + ")";	}
};

Now I decided to significantly extend it. And one of the changes is something like that:

format["%1", side _attackingUnit] == format["%1", side player]) then {
	if (format["%1", side _eliminatedUnit] == format["%1", side player]) then {
		player sideChat "Friendly fire (" +typeof _attackingUnit+" killed "+(typeof _eliminatedUnit) + ")";
        };
};

The code format["%1", side _attackingUnit] returns correct results, but I can't get the killed unit side in format["%1", side _eliminatedUnit]. It's always CIV after a unit is killed. Does anybody an idea how to check a killed unit native side?

This post was edited by armalearner (2015-05-04 06:03, ago)


Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 61
In-game name: Kobayashi Maru

 
#2 Posted at 2015-05-03 21:10        
     
sure, killed units are civilian.
the native side is in configfile >> "CfgVehicles" >> "the_unit_class_you_want like B_soldier_F" >> "side"
Then you must catch the number returned by this parameter, via getNumber and typeof your unit:

Instead of side _eliminatedUnit write: getNumber (configfile >> "CfgVehicles" >> typeof _eliminatedUnit >> "side");
then getnumber will return:
0 for Opfor
1 for Blufor
2 for resistance
3 for civilian units.

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Advertisement


Author Message


Posts: 13
Rank:


Level: Member

Country: 00
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2015-05-04 05:57        
     
# Pierre MGI : sure, killed units are civilian.
the native side is in configfile >> "CfgVehicles" >> "the_unit_class_you_want like B_soldier_F" >> "side"
Then you must catch the number returned by this parameter, via getNumber and typeof your unit:

Instead of side _eliminatedUnit write: getNumber (configfile >> "CfgVehicles" >> typeof _eliminatedUnit >> "side");
then getnumber will return:
0 for Opfor
1 for Blufor
2 for resistance
3 for civilian units.

It works. Great. But I think it is far from normality that BIS left it on such a low-level, hard-coded approach...
I found another solution. It's simple as well. Just instead of "side some_unit" use "side group some_unit". It will return correct side because it looks like groups don't change to civilian type even when there is only one member, even without a name, or when no other units left in the group :)






Tags: Script, Side, Unit