Retreiving my Player ID
by Mark Grooby · in Torque Game Engine · 11/03/2006 (8:47 pm) · 4 replies
About the author
#2
11/04/2006 (3:37 am)
Hey egobrain, no need to bump all your threads after a measily 4 hours. You are not the only one around here asking for help.
#3
11/04/2006 (4:05 am)
If the question is really simple, then odds is that it has been asked before and you could find it in 30 seconds by searching. You have also no reason to be "annoyed" because you ain't paying for any support, people do it because they like to help. Have fun!
#4
I can tell that you don't understand that, and that is okay considering your age.
Good luck with your game!
11/04/2006 (5:00 am)
No, I don't think you're stupid Mark. I think you are very young and only think of no one else but yourself. Half of the people who frequent these forums are asleep right now, and given a few more hours they would be here to help you solve your issue, without having someone being rude and bumping their thread every 4 hours.I can tell that you don't understand that, and that is okay considering your age.
Good luck with your game!
Torque Owner Ishbuu
Speaking from stock Starter.fps file game.cs in starter.fps/server/scripts contains yonder function at around line 300 (stock)
function GameConnection::createPlayer(%this, %spawnPoint) { if (%this.player > 0) { // The client should not have a player currently // assigned. Assigning a new one could result in // a player ghost. error( "Attempting to create an angus ghost!" ); } // Create the player object %player = new Player() { dataBlock = PlayerBody; client = %this; }; MissionCleanup.add(%player); // Player setup... %player.setTransform(%spawnPoint); %player.setShapeName(%this.name); // Starting equipment %player.setInventory(Crossbow,1); %player.setInventory(CrossbowAmmo,10); %player.mountImage(CrossbowImage,0); // Update the camera to start with the player %this.camera.setTransform(%player.getEyeTransform()); // Give the client control of the player %this.player = %player; %this.setControlObject(%player); }The player is created here:
// Create the player object %player = new Player() { dataBlock = PlayerBody; client = %this; };%player is your player ID, you can echo it if you like
// Create the player object %player = new Player() { dataBlock = PlayerBody; client = %this; }; echo("Player Added! Player ID number:" SPC %player);Or you can make it an array...// Create the player object %player = new Player() { dataBlock = PlayerBody; client = %this; }; $mostRecentPlayer = %player;Or maybe pass it to a gui?// Create the player object %player = new Player() { dataBlock = PlayerBody; client = %this; }; addNewPlayer2GUI(%player, %this); // NOTE: This function is not included ;)Hope this helped.
[Ishbuu]