New variables for clients?
by Martin Schultz · in Torque Game Engine · 09/09/2002 (2:49 am) · 2 replies
Hi,
I'd like to have some additional, self created variables for each client connecting to the current game, like attributes.
I'm still not quite sure where to put those variables. How for example, would it be possible (and where) to add a variable to each player object created.
What I want to archive is, that each player connecting to the racing mod, gets a command from the server to display a vehicle selection gui, the user selects which vehicle he wants and sends back a value to the server. The server stores the variable permanently with the client (must be persistent after respawning) and re-spawns him depending on this value with the corresponding car.
Thanks in advance for any kind of help!
Best,
Martin
I'd like to have some additional, self created variables for each client connecting to the current game, like attributes.
I'm still not quite sure where to put those variables. How for example, would it be possible (and where) to add a variable to each player object created.
What I want to archive is, that each player connecting to the racing mod, gets a command from the server to display a vehicle selection gui, the user selects which vehicle he wants and sends back a value to the server. The server stores the variable permanently with the client (must be persistent after respawning) and re-spawns him depending on this value with the corresponding car.
Thanks in advance for any kind of help!
Best,
Martin
#2
$Pref::Player::Vehicle (exactly my choice, btw :-) ) works just fine client-side, gets saved and loaded along with the other prefs, etc.
In order to send it to the server, I used this workaround: The client spawns as observer. Now he needs to hit a button, which is a client-side action. That client-side action triggers the player creation, which I modified so that it takes an additional parameter, namely the vehicle choice.
Only thing you'd need to change is that the whole thing gets triggered server-side, possibly before/instead of creating the player as observer first.
09/09/2002 (12:46 pm)
Bruce, I have parts of this working, except for one thing.$Pref::Player::Vehicle (exactly my choice, btw :-) ) works just fine client-side, gets saved and loaded along with the other prefs, etc.
In order to send it to the server, I used this workaround: The client spawns as observer. Now he needs to hit a button, which is a client-side action. That client-side action triggers the player creation, which I modified so that it takes an additional parameter, namely the vehicle choice.
Only thing you'd need to change is that the whole thing gets triggered server-side, possibly before/instead of creating the player as observer first.
Torque 3D Owner Bruce Wallace
I am experimenting with a few different ways but would like to hear what people would think the best way was.
As for this post an Idea would be:
1.Have your selection GUI set a global script variable
ex. $Pref::Player::Vehicle =
2.Have the server ask the client for its choice.
3.Then the client can respond by telling the server its variable that you have set with the GUI.
Just make sure the server isn't using its own set Variable and it should work fine.
Hope this helps,
Bruce