Want to implement players can choose a player.cs, $50 reward
by Highlander · in Torque Game Engine · 05/17/2007 (10:32 am) · 8 replies
Heya guys,
I'd like players to be able to choose which character they are going to be. I believe to do so basically all I need is different player.cs files in server/scripts/, so imagine I would have player.cs, player2.cs, player3.cs etc.,
each representing a different character (i.e., soldier, medic, rocket guy, whatever). Each can have a different mesh, different speed, etc..
When the player joins the game, a list of available characters should pop up. The player chooses one and drops into the game.
How could I go about this? Am I missing out some details or is it really that straightforward? If you actually code this up I'll paypal you $50.
If you point me to a resource that does this, I'll paypal you $10. I couldn't find one but maybe I was searching wrong, it seems too basic.
I'd like players to be able to choose which character they are going to be. I believe to do so basically all I need is different player.cs files in server/scripts/, so imagine I would have player.cs, player2.cs, player3.cs etc.,
each representing a different character (i.e., soldier, medic, rocket guy, whatever). Each can have a different mesh, different speed, etc..
When the player joins the game, a list of available characters should pop up. The player chooses one and drops into the game.
How could I go about this? Am I missing out some details or is it really that straightforward? If you actually code this up I'll paypal you $50.
If you point me to a resource that does this, I'll paypal you $10. I couldn't find one but maybe I was searching wrong, it seems too basic.
#2
Now lets say you have three buttons called "Use Player 1", "Use Player 2", and "Launch". For the first buttons command field, you would have something like this, $pref::player = "Player1"; and for the second button, you would have this, $pref::player = "Player2"; The launch button would just have "loadMyMission();" for a command.
Then in server/scripts/game.cs, inside you "GameConnection::createPlayer" function, find this block of code:
I sure this is just one of many ways you could do this, but its a start.
05/17/2007 (11:12 am)
You could just have one file called "players.cs" and in it have different dataBlocks, example:datablock PlayerData(Player1)
{
...............
shapeFile = "~/data/shapes/player/player1.dts";
...............
};
datablock PlayerData(Player2)
{
...............
shapeFile = "~/data/shapes/player/player2.dts";
...............
};
//Players 3 - NNow lets say you have three buttons called "Use Player 1", "Use Player 2", and "Launch". For the first buttons command field, you would have something like this, $pref::player = "Player1"; and for the second button, you would have this, $pref::player = "Player2"; The launch button would just have "loadMyMission();" for a command.
Then in server/scripts/game.cs, inside you "GameConnection::createPlayer" function, find this block of code:
// Create the player object
%player = new Player() {
dataBlock = PlayerBody;
client = %this;And replace "dataBlock = PlayerBody;" with "dataBlock = $pref::player;".I sure this is just one of many ways you could do this, but its a start.
#4
05/17/2007 (11:15 am)
Yay i win?
#5
http://www.jamestadeo.com/Games-by-James-Tadeo/torque/Torque-Tutorials/Torque-Player-Selection/Torque-Player-Selection.php
05/17/2007 (11:20 am)
Check also:http://www.jamestadeo.com/Games-by-James-Tadeo/torque/Torque-Tutorials/Torque-Player-Selection/Torque-Player-Selection.php
#6
05/17/2007 (11:34 am)
OK I like Gianfranco's link, thats exactly what i was looking for, so he gets $10. Caleb, your solution is about half way there (I really wanted the pulldown with the characters like what that link shows) so I'm going to give you $25. Chip I'm going to give you $10 for that link and mb I'm going to give you $5 for making me laugh and actually writing Chip's resource. (total $50 that worked out nicely)
#8
05/21/2007 (12:19 am)
It might save you alot of money if you use the search function.
Torque 3D Owner Peter Simard
Default Studio Name