Jump to content
Sign in to follow this  
rakowozz

isPlayer as a Trigger Condition

Recommended Posts

I've been trying to use isPlayer as a condition for a trigger with no success. I need to verify if any of multiple slots are human players. I'd like to spawn an unit, for instance, if any of these slots are human players.

I even gave this a shot, but it's obviously entirely wrong:

{isPlayer _x} count [unit1,unit2,etc.] < 1

I'm probably missing something obvious here, but is there an alternative? Thanks in advance.

Edited by rakowozz

Share this post


Link to post
Share on other sites

Maybe use > 0 instead?

Now you are counting if less than 1 of them is player.

Share this post


Link to post
Share on other sites

Would:

{isPlayer _x} count [p1,p2,p3,p4] == {isPlayer _x in thislist} count [p1,p2,p3,p4]

work to check (on a dedicated server scenario with respawn) if all human players (min=1/max=4players and p1-p4 are the unitnames) are in a trigger area ?

And would:

{isPlayer _x} count [p1,p2,p3,p4] == {alive _x} count [p1,p2,p3,p4]

work to check how many human players are currently dead and waiting for respawn ?

Share this post


Link to post
Share on other sites
Would:

{isPlayer _x} count [p1,p2,p3,p4] == {isPlayer _x in thislist} count [p1,p2,p3,p4]

work to check (on a dedicated server scenario with respawn) if all human players (min=1/max=4players and p1-p4 are the unitnames) are in a trigger area ?

There're many different ways to do both. I usually don't use triggers, but I think thisList is supposed to work.

In case it doesn't, one thing that comes to mind is distance... though there must be better ways (regarding performance). count is very powerful.

{isPlayer _x} count [p1,p2,p3,p4] == {isPlayer _x && _x distance [x,y,z] < 100} count [p1,p2,p3,p4]//[x,y,z] are your coordinates, or the name of your Object - or, even better, the name of your trigger

And would:

{isPlayer _x} count [p1,p2,p3,p4] == {alive _x} count [p1,p2,p3,p4]

work to check how many human players are currently dead and waiting for respawn ?

This will return true if all connected players are alive. False if at least one of them is dead. Are you using this one in a trigger too?

To have a number of dead players on the server returned:

{isPlayer _x && !alive _x} count [p1,p2,p3,p4];

If I remember right, alive isn't really microsecond accurate, but should be enough to that purpose.

P.S.: corrected syntax for count conditions

Edited by rakowozz

Share this post


Link to post
Share on other sites

For some reason,

{isPlayer _x} count [p1,p2,p3,p4] == {isPlayer _x in thislist} count [p1,p2,p3,p4]

does not work, it also does not work if i check for distance....

But:

{isPlayer _x} count [p1,p2,p3,p4] == {not alive _x} count [p1,p2,p3,p4]

works !

Share this post


Link to post
Share on other sites

That's because isPlayer _x in thislist is incorrect syntax.

Correct usage of the commands would be:

isPlayer _x

That checks if the unit is a human player.

_x in thislist

That checks if the unit is in the unit list of the trigger

So, basically you are trying to use two commands at the same time.

If you want to check both:

isPlayer _x && _x in thislist

Share this post


Link to post
Share on other sites
it also does not work if i check for distance....

Woops, I updated the post with correct syntax. I had used ; instead of && for the count conditions.

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  

×