Player Editing Questions
by Richard Van Stone · in Torque Game Engine · 01/08/2005 (11:43 am) · 1 replies
I want to create a system where players can choose from five different dts models as their character in game. The model they pick will be saved in their preferences and stored on the mysql database. I'm thinking I'm going to have to edit the player.cs file so that it loads the appropriate model based off of information I'm going to store in a global variable. This is my thought process as to how it'll work. I know it's not in torque syntax yet, please let me know if I'm on the right track
Have a global variable such as playerchoice
playerchoice.model = bear
playerchoice.texture = bear01.tga
playerchoice.scale = 0.5
And then in the player.cs it'll set the playermodel, texture and scale.
Is this the best way to do it?
Richard
Have a global variable such as playerchoice
playerchoice.model = bear
playerchoice.texture = bear01.tga
playerchoice.scale = 0.5
And then in the player.cs it'll set the playermodel, texture and scale.
Is this the best way to do it?
Richard
About the author
Torque Owner Eric Lavigne
If this is a multiplayer, server-based game, you need one for each player. Then instead of a global variable you would make the playerchoice variable a part of the player class. Also, sending the strings "bear" and "bear01.tga" over the network is inefficient. Here's an alternative. You said there are only five choices, right? So player choice should be a number between 1 and 5 (simpler to keep track of in database, simpler to send over network). You could create functions that converted these numbers into models or textures. playertexture(3) -> "bear01.tga" for example
Aside from that one small objection, I think you're on the right track. Good luck.