Game Development Community

Naming a player

by Bristow · in Torque Game Engine · 04/12/2006 (9:06 am) · 5 replies

I know you can set the player's name using:

1111.setName(Bob)

but I only know how to do that in the console in the mission editor,I want to know how to set the name ahead of time so the player, and even AI, have a preset name everytime they spawn and not a number that
changes everytime

would there be anyway to do this in the script beforehand so that everytime the player spawns his name is
automatically Bob? (assuming you want his name to be Bob)

#1
04/12/2006 (3:17 pm)
In aiPlayer.cs, look for the function AIPlayer::spawn. You should see %player.setName("Kork"); or something along those lines. When you change it to Bob, you should be able to call Bob.setName(New Name); or any other command you want, and use Bob rather than an ever changing ID number.
#2
04/12/2006 (3:22 pm)
Look in GameConnection::createPlayer()
for the call to %player.setShapeName().

shapeName is what shows up above the player in the HUD;
name is the name of the variable, not the player.
#3
04/14/2006 (8:40 am)
Ok, but where is GameConnection::createPlayer() located, I mean which .cs?
#4
04/14/2006 (8:59 am)
Server/scripts/game.cs
#5
04/14/2006 (9:05 am)
@bristow - a decent "find in files" utility is the #1 tool you can use for just about any kind of development, including torque. the free version of visual studio for example, will search all your C and Script files for text like "GameConnection::createPlayer" and get you the answer in like three seconds.