Game Development Community

Character Selection System help

by Ben Ewing · in Torque Game Engine · 09/12/2005 (4:46 pm) · 14 replies

Im trying to make a system that lets the player select which avatar they want to use, but ive hit a problem, I think its this:

%player = new Player() {
dataBlock = $chosen;
client = %this;
};

I thiml its because im using a variable in the datablock place, are there any alternatives to doing this?

#1
09/12/2005 (5:38 pm)
No, that should work fine as long as the variable has a good value in it.
#2
09/12/2005 (5:40 pm)
If someone would be kind enough to post a resource on Player Selection, it would undoubtedly help nearly all of us.

I have implemented some form of player selection after receiving not much help :P, using guiObjectView too, but it's far from perfect.
#3
09/12/2005 (6:46 pm)
Ill have to go look at the variables again,maybe theres a problem with the GUI part.
#4
09/12/2005 (7:34 pm)
I think RealmWars has that if you want an example..
You select an orc or an elf.
#5
09/12/2005 (8:39 pm)
Kay Ill go look at Realm Wars, because im still getting errors. Is there a way to look at what a variable = while Torque is running.
#6
09/12/2005 (9:07 pm)
Echo($chosen);

in the console
#7
09/13/2005 (7:25 am)
Ahhh still running into problems (The RealmWars selection system was to complex, I just want a simple "Press this button you have this charater") what does this error mean?

"starter.rpg/server/scripts/game.cs Line: 296 - Syntax error.
>>> Advanced script error report. Line 591.
>>> Some error context, with ## on sides of error halt:
error( "Attempting to create an angus ghost!" );

}



//GlowBody :)

//OrcBody :)



$chosen;## ##

>>> Error report complete."

I dont have the # signs in the actual code...
#8
09/13/2005 (7:28 am)
The # signs are in the error to highlight exactly what part of the code is showing the
error.

In this case you have a global variable refernced, but its not a legal line.

It does not say: $chosen = 1;

It just says: $chosen;

That is not legal sntax. The # sign shows you the error is after the semicolon.
#9
09/13/2005 (7:29 am)
@Ben

The #### signs show you where your error is. They are not in the code, but a way for TGE to tell you what's wrong. Your syntax is broken.

Edit: Dana beat me to it :)
#10
09/13/2005 (3:52 pm)
Thanks :) ill go fix it.

I fixed it, but I still get the same error
#11
09/13/2005 (4:00 pm)
There are quite a few divergences between C and TS syntax that take me by suprise. This is one of them.

Thankfully, "/* */" work in 1.4. That one tripped me up a bit too.
#12
09/14/2005 (3:54 pm)
You may wish to look for my "Actor" resource if you think you may want to allow people to change which avatar they are once the game is underway.

tone
#13
09/14/2005 (4:00 pm)
I have code in which before the game starts the player chooses a charecter type using the charecter displaying GUI (I don't have the exact name on hand) and then when they go into the game they start as that charecter I could give you that.
#14
09/14/2005 (5:42 pm)
I got to work, thanks though :), but the "Actor" resource does look interesting :).