Jump to content
Sign in to follow this  
thegunnysgt

select player at random, and by name

Recommended Posts

Two things..

How can I select a random player out of all players in a mission, and have that particular player assigned to do something?

Same as above, but instead of in being random have it based off of their name. So if I'm in a mission, thegunnysgt, it will always pick me instead of being random. I sort of remember this one, from when I did something similar in ArmA, but that was too long ago.

Thanks!

Share this post


Link to post
Share on other sites

_unit = playableUnits select floor(random count playableUnits)

if (name _unit == "thegunnysgt") then {

};

Share this post


Link to post
Share on other sites

Thanks, I thought what I had down for the name was correct, but since it was so long I wanted to make sure, and I didn't know how to do the random player.

Edited by thegunnysgt

Share this post


Link to post
Share on other sites

For some reason playableUnits isn't returning anything?

This is what I have in the script..

if ((name playableUnits) == "thegunnysgt") then {
_unit = "thegunnysgt";
} else {
_unit = playableUnits select floor (random count playableUnits);
};

_unit exec "script.sqf";

Edited by thegunnysgt

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  

×