Jump to content
Kreu

Check if a group exists

Recommended Posts

Following situation:

In my mission the RESISTANCE players and their AI disguise as EAST soldiers and infiltrate their base.

For that i let them joinSilent a WEST group. WEST is allied with EAST.
Works like a charm.

Now once a player damages or kills an EAST soldier i want him to joinSilent Resistance again.
So each enemy soldier has a kill and a dammage eventhandler. Once they fire i want the shooter to join the group grpResRejoin so that he gets treated like an enemy.
I created this group at the start of the mission: grpResRejoin = createGroup [independent, false];
Now the wiki says that once the last unit of an group dies, the group always gets deleted.
So it might happen that a player kills an East soldier, joins the group grpResRejoin, gets killed himself and the group gets deleted.
But what if another player kills an enemy now? He can't join grpResRejoin anymore because it got deleted.
So i need to check each time before i want a player to join the group, if the group does exist. If not it needs to be created first.
Problem is i can't check if the group does exist.
(isNull grpResRejoin) doesn't return anything if the group hasen't been created.
So how do i solve the Problem?

Thank you for any advise

Share this post


Link to post
Share on other sites
!isNull ( missionNamespace getVariable[ "grpResRejoin", grpNull ] )

 

  • Like 3

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

×