Getting at datablock variables...
by Daniel Brown · in Torque Game Engine · 08/08/2004 (2:08 pm) · 3 replies
Ok i cant seem to get this to work...
basically i have a set of variables that ive added to playerdata about the race of character etc, but what do i have to type in to get to the variables? %client.playerRace? %client.playerShape.playerRace?? All i want to do is echo the players race to see if it had worked but all i get is a blank space with the 2 above...
Thanks
basically i have a set of variables that ive added to playerdata about the race of character etc, but what do i have to type in to get to the variables? %client.playerRace? %client.playerShape.playerRace?? All i want to do is echo the players race to see if it had worked but all i get is a blank space with the 2 above...
Thanks
About the author
#2
I tried to chenge datablock, and it worked fine. Though i think it altered every instance of a vehicle.
Thanx,
Cura
08/09/2004 (10:08 am)
So how to change engineTorque of particular vehicle, for example?I tried to chenge datablock, and it worked fine. Though i think it altered every instance of a vehicle.
Thanx,
Cura
#3
I, and many others, have faught with this very issue, and here are my suggestions.
If your game is single player, you do NOT need to save the game, don't need to maintain state, and don't need object specific event handling, then you can use an OBJECT specific variable:
%someObj.value = someVal;
If any of the above is false, then you have 3 options.
Look at how Melv May is using non-datablock fields in the fxRenderObject resource and in some of his fx objects in the engine.
The second option (and the one I chose)... is to modify the datablock code in the engine to include the fields you need....and you then have to create a datablock for EACH vehicle. I wound up using this method in our single-player game so that I can do event processing on each individual character. I have modified the editor to create a datablock and character definition script dynamically, and add the player on the fly.
Another way to handle this is with global variables and/or an array, tied to that instance. I am uncertain of the network implications of this method, based on your particular game.
If anyone has any other architectural suggestions, I would love to hear them.
Cameron Aycock
Lead Programmer on "The Chronicles of Ny"
www.clownkeep.com
08/10/2004 (12:45 pm)
Pawel,I, and many others, have faught with this very issue, and here are my suggestions.
If your game is single player, you do NOT need to save the game, don't need to maintain state, and don't need object specific event handling, then you can use an OBJECT specific variable:
%someObj.value = someVal;
If any of the above is false, then you have 3 options.
Look at how Melv May is using non-datablock fields in the fxRenderObject resource and in some of his fx objects in the engine.
The second option (and the one I chose)... is to modify the datablock code in the engine to include the fields you need....and you then have to create a datablock for EACH vehicle. I wound up using this method in our single-player game so that I can do event processing on each individual character. I have modified the editor to create a datablock and character definition script dynamically, and add the player on the fly.
Another way to handle this is with global variables and/or an array, tied to that instance. I am uncertain of the network implications of this method, based on your particular game.
If anyone has any other architectural suggestions, I would love to hear them.
Cameron Aycock
Lead Programmer on "The Chronicles of Ny"
www.clownkeep.com
Torque Owner Dylan Sale