• 0

Player number in Fraggle/LegacyScript

Question

In multiplayer, how do I get the player number, so I can refer to it in code?

 

I'm trying to make a linedef that only teleports player 1 elsewhere when it's crossed. Ideally it'd only be activated by player 1, but that's optional right now.

 

I've tried a "print(player);" and "print(playerobj)" and "print(trigger);", but player and playerobj just gives me crazy numbers, which are the same to both players in multiplayer, and trigger just gives me the "doomplayer" string.

 

Share this post


Link to post

1 answer to this question

  • 0

OK, I sort of figured this out. You need to use "player(x)" to refer to the player, "x" being the player number. Player 1 is actually player 0.

 

Funny thing is that if I use player 1, player 2 gets kicked off of the server on the PSP as soon as it teleports. It works fine if I teleport player 2, however.

yay glitches

 

Anyway, my code looks like this:

script 1
{
	//teleports player 2, actually
	if(trigger == player(1))
	{
		teleport(player(1), 14); //14 = sector tag with the teleport thingie
	}
}

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now