DTS Objects refusing to become members of GameBaseData
by Dave Calabrese · in Technical Issues · 08/26/2005 (3:30 pm) · 4 replies
So, this one is just... weird. I've been over the code and my model, and I have NO idea why this is happening. All I'm trying to do is place a StaticShape in the world through the editor, but it never appears on the menu. So I made a function that would place the object in the world, and this is the error I receive:
The code for the ToxicBarrel is as such:
The model display's fine if I place it through the StaticShape section of the editor, but it never appears under the 'Explosives' category, which also never appears. I have also tried using other .DTS objects that work on the right-side editor menu in place of toxicbarrel_a.dts, but I get the exact same error.
The above code exists in the /server/scripts directory.
I have also attempted changing the name of the 'ToxicBarrel' object to something else to make sure that nothing else had the name (I used the name 'BigMetalShinyThingThatGoesBoom', as I doubt anything else in the engine used that name).
Anyone have any ideas on what could cause this?
Thanks in advance,
-Dave C.
Object 'ToxicBarrel' is not a member of the 'GameBaseData' data block class game/server/scripts/obj_toxicBarrel.cs (0): Register object failed for object barrel of class StaticShape.
The code for the ToxicBarrel is as such:
function makeBarrel(%here)
{
new StaticShape(barrel)
{
dataBlock = "ToxicBarrel";
position = "0 0 50";
rotation = "1 0 0 0";
scale = "1 1 1";
};
}
datablock StaticShapeData(ToxicBarrel)
{
category = "Explosives";
shapeFile = "~/data/shapes/parts/toxicbarrel_a.dts";
};The model display's fine if I place it through the StaticShape section of the editor, but it never appears under the 'Explosives' category, which also never appears. I have also tried using other .DTS objects that work on the right-side editor menu in place of toxicbarrel_a.dts, but I get the exact same error.
The above code exists in the /server/scripts directory.
I have also attempted changing the name of the 'ToxicBarrel' object to something else to make sure that nothing else had the name (I used the name 'BigMetalShinyThingThatGoesBoom', as I doubt anything else in the engine used that name).
Anyone have any ideas on what could cause this?
Thanks in advance,
-Dave C.
About the author
Recent Threads
#2
I just had to declare it in onServerCreated, just as you suggested! It all makes sense now!
I would just like to take a moment to let everyone on GarageGames know that Sean H. is now, officially, 'The Man', and will continue to hold the title of 'The Man' until someone proves themselves to be more 'The Man'-like than Sean.
Thank you very much!
-Dave C.
08/26/2005 (5:16 pm)
HA!!!! THAT WAS IT!!!I just had to declare it in onServerCreated, just as you suggested! It all makes sense now!
I would just like to take a moment to let everyone on GarageGames know that Sean H. is now, officially, 'The Man', and will continue to hold the title of 'The Man' until someone proves themselves to be more 'The Man'-like than Sean.
Thank you very much!
-Dave C.
#3
08/26/2005 (7:57 pm)
Your welcome Dave. i appreciate the gratitude although im pretty sure i cant be 'The Man' on these boards until i at least become an SDK owner. :)
#4
08/27/2005 (5:33 am)
I tried to make an exploding barrel once, but it kept falling through the floor. :p
Torque 3D Owner Sean H.
the other most likely reason for the error is that you're not loading the datablock along with the others. make sure this script is being loaded before the mission is loaded. since it contains a datablock declaration, it should be compiled in OnServerCreated(). all datablocks, and scripts which contain datablocks, should be compiled some time before the mission loading sequence begins.
also, ive never tried it, but if youre created a really basic static shape i believe you could also do the following:
function makeBarrel(%here) { new staticshape(barrel){ shapeFile = "~/data/shapes/parts/toxicbarrel_a.dts"; position = "0 0 50"; rotation = "1 0 0 0"; scale = "1 1 1"; }; }and avoid using a datablock altogether.