Jump to content
Sign in to follow this  
ios

Check if units are dead

Recommended Posts

I am looking for a way i check if units are dead, here what i have :

{if ((side _x) != West) && (not alive units _x)}
then 
{
_jok = random 10;
if (_jok >= 5) then 
{_x addaction ["Look for a clude", "Clude.sqf"];} forEach allUnits;
sleep 100;
};

i can't find what's wrong :s it's on arma II and not on arma II OA so allDead Commande do not work !

thanks in advance !

Share this post


Link to post
Share on other sites

Sorry, but you should really do a syntax check.

What do you want to do?

Check on all units if they are not west and not alive. If true addaction to all units?

Share this post


Link to post
Share on other sites

yes that's it, check if they are not west and not alive and if its true so addaction to their dead body :o

Share this post


Link to post
Share on other sites

This way it doesn´t show errors:

{if (((side _x) != West) && (not alive _x))
then 
{
_jok = random 10;
if (_jok >= 5) then 
{_x addaction ["Look for a clude", "Clude.sqf"];
sleep 100;
}}} forEach allUnits;

But I don´t know about the functionality.

Share this post


Link to post
Share on other sites

your code kindof screams ERROR,SHIT,F....,BALLS... i have no idea where you even got these codes from...

anyhew....

{
if ((side _x) != west AND !alive _x) then {
	_jok = random 10;
	if (_jok >= 5) then {
		_x addaction ["Look for a clude", "Clude.sqf"];
	};
};
} forEach allUnits;
sleep 100;

BUT... major flaw:

description on allUnits:

Return a list of all units (all persons except agents). Dead units and units waiting to respawn are excluded.
so youre code is pretty much screwed before even alive.

killed eventhandlers on the other hand is what you need.

Share this post


Link to post
Share on other sites

Thanks ! you're right !

here what i have and it's work (not tested in mp maybe you can tell me if it's gonna work)

init.sqf

{if ((side _x) != west) then {_x addEventHandler ["killed", "null = [_this select 1] execVM ""Clude.sqf"""]}} foreach allUnits;

Clude.sqf

_this = _this select 0;
search = _this addaction ["Look for a clude","Clude\findclude.sqf"];

FindClude.sqf

_luck = random 30;

if (not((_this select 1)==player)) exitwith {};

_greg = _this select 0;

if (_luck >= 25) 
then {
hint "You find a clude";
_greg removeaction search;};

if ((_luck >= 20) AND (_luck < 25))
then {
hint "you find a piece of clude";
_greg removeaction search;
};

if (_luck < 20)
then {
hint "you find nothing";
_greg removeaction search;
};

Share this post


Link to post
Share on other sites

hint will not work on dedicated servers, use uniname sidechat instead or something.

Share this post


Link to post
Share on other sites

Hint and sidechat are both local, so doesnt really matter. Both work just fine on dedis. Its just that the person using the action will be the only one seeing the message, which in this case is probably good.

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  

×