Game Development Community

How would I add 'ItemData' objects to the Scene Tree?

by Nicolai Dutka · in Torque Game Engine Advanced · 05/12/2010 (3:12 pm) · 2 replies

I'm actually using T3D at the moment, but TGEA also has the same limitation. I need my designers to be able to add pickups ('ItemData' objects) from the Scene Tree->Library under 'Scripted' with a double-click, the same way they currently add 'StaticShapeData' scripted objects.

#1
05/13/2010 (12:46 am)
T3D:

- go to the datablock-editor
- tab "new"
- create a new ItemData-Datablock
- in the properties (under Render) select your shapefile
- give the property "category" a value/name
- save the datablock (disk icon)
- go to the 'object editor' -> 'library' -> 'scripted' and place the item

TGE/A:

- you have to create a "ItemData"-Datablock manually

datablock ItemData(theNameOfTheDatablock)
{
   shapeFile = "game/data/items/ammo.dts";  // or whatever you want
   category = "MyKillerAmmo";
};

The property "category" is very important. After reloading the script you will see "MyKillerAmmo" as a node in your Creator-Tree.

If you want a complete list of properties, simply type into the console:

theNameOfTheDatablock.dump();

or...

In Torsion place the cursor inside the definition of the datablock and press CTRL-J.
#2
05/13/2010 (8:33 am)
My datablocks already exist. I can see them in the 'Existing' list in the Datablock editor in T3D. The problem is, I can't figure out where to find them for use within the level... We've been using a custom function that spawns the items in the level and I'd rather have the designers just double-click them from the list:

Object Editor->Scene Tree->Library->Items

But all I have is:

Object Editor->Scene Tree->Library->Scripted->StaticShape



EDIT:

FIXED!! This project was a conversion from TGEA to T3D. For some reason, ALL of our 'ItemData' based objects (aka 'pickups') were missing the 'category' field! I added that in and now I have:

Object Editor->Scene Tree->Library->Scripted->Pickups