Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Getting a random player in MP
Getting a random player in MP
2001-07-25, 4:26 PM #1
Okay, I have decided to run a different route with Jawa Tag and deciding who will be the Jawa. Is there a way to pick a random player and identify them through cog? I was thinking like.

rand_num = Rand() * GetNumPlayers();
first_jawa_target = rand_num

I know that won't work, but something along those lines. My whole goal is to stay away from adding the cog to the level so that it can be played in any level.

-Tazz
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance

Tazz
2001-07-25, 4:56 PM #2
I wish! I suggest having the first person killed (by a player) be the Jawa.

------------------
-Hell Raiser
X-Treme Cogger for DBZ: TDIR
-Hell Raiser
2001-07-25, 5:05 PM #3
Code:
for(x=0; x<GetSectorCount(); x=x+1)
{
   potential = FirstThingInSector(x);


   while(potential != -1)
   {
      if(GetThingType(potential) == 0x400)
      {
         players[ID] = potential;
         ID = ID + 1;
      }


      potential = NextThingInSector(potential);
   }
}


chosen = rand()*ID;
if(chosen == ID) chosen = ID - 1;
randPlayer = players[chosen];


You need to register
int players[0] local
.
.
.
int players[maxplayers] local

in the symbols. "maxplayer" being the max number of players allowed to join in game, usually 4, so that being 3.

This should return a random player thing ID.

------------------
http://millennium.massassi.net/ - Millennium

[This message has been edited by Hideki (edited July 25, 2001).]

↑ Up to the top!