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 → Addressing Players
Addressing Players
2001-07-08, 11:24 AM #1
Hi,

I want to implement something like
for each player do something

would that work?

for (blah = 0; blah=>GetNumPlayers(); blah=blah+1)
{
do something(blah);
}

That would mean that players are named by numbers, starting with 0 .. is that true? Or is there another neat solution to this?

Thanks in advance,

Raze
--
You are all just jealous because you can't hear the small voices!!
2001-07-08, 1:10 PM #2
Augh! Too many 'blahs'!
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2001-07-08, 1:21 PM #3
For one it would have to be a < in between blah and GetNumPlayers();

Secondly no I don't think that would work , it would just get a whole lot of items in the level.

Try GetThingSignature(player); maybe you could have each player when joined send a message to the host saying hes joined. So the host can get his sig.
2001-07-08, 1:43 PM #4
Depending on what you are trying to do...

I would do this:

Code:
activated:
TOTAL = GetThingCount();
While(TOTAL >= 0)
{
     if((GetThingType(TOTAL) == 10) && !(GetThingFlags(TOTAL) & 0x80000))
     {
     // do your thing here
     }
TOTAL = TOTAL - 1;
}
Return;
2001-07-08, 2:04 PM #5
Or why not just use triggers...

Hotkey cog has this line:

SendTrigger(-1, 123, 0, 0, 0, 0);

Another cog that all players have
runs this...

trigger:
if(GetSourceRef() == 123)
{
// DO EFFECT HERE
}
Return;
2001-07-09, 5:51 AM #6
Thanks everyone for the replies =)

I personally like the code of Daddy best because the problem with the trigger thing is that it can be easily hacked.. However, I plan to put this into a pulse (yea right) with about 1.0s so I guess this would take really long, wouldn't it?

-Raze
--
You are all just jealous because you can't hear the small voices!!
2001-07-09, 11:25 AM #7
You might want to increase pulse a tad. If you use GetThingCount(); that number is around 350 on a typical level. That would take like 5-6min at SetPulse(1.0);

↑ Up to the top!