Config Datablocks in the level editor?
by Trace Kern · in Torque Game Builder · 05/19/2007 (2:35 am) · 6 replies
Okay folks, hoping someone out here can help me with this problem.
I am currently trying to use the old RTS tutorial over on TDN, but I'm working with the 1.5 beta. Obviously things are going to be out of date in the documentation and tutorials, but I wasn't expecting something this extreme.
I am at the point in the tutorial where i've created an objectTypes.cs script file, which contains a series of datablocks containing variables and dynamic fields for different entity classes and sub-classes.
Now here's where things get tricky. Althought it doesn't explicitly explain this, I've gathered that during this and a few previous steps, I placed several objects using the level editor, and I was supposed to set the config datablock for these objects manually for testing purposes.
The problem I'm having is that none of the defined datablocks, or any datablocks at all, are showing up in the "config datablock" pull-down menu under the scripting rollout.
Which brings me to my question. How do I get defined datablocks to show up in the pull-down? Or faling that, can someone walk me through a work-around for this problem? I can't proceed with this tutorial without being able to set the datablock manually within the level editor.
I would prefer to avoid rolling back to 1.1.3 just to continue with my education, so any help is appreciated.
I am currently trying to use the old RTS tutorial over on TDN, but I'm working with the 1.5 beta. Obviously things are going to be out of date in the documentation and tutorials, but I wasn't expecting something this extreme.
I am at the point in the tutorial where i've created an objectTypes.cs script file, which contains a series of datablocks containing variables and dynamic fields for different entity classes and sub-classes.
Now here's where things get tricky. Althought it doesn't explicitly explain this, I've gathered that during this and a few previous steps, I placed several objects using the level editor, and I was supposed to set the config datablock for these objects manually for testing purposes.
The problem I'm having is that none of the defined datablocks, or any datablocks at all, are showing up in the "config datablock" pull-down menu under the scripting rollout.
Which brings me to my question. How do I get defined datablocks to show up in the pull-down? Or faling that, can someone walk me through a work-around for this problem? I can't proceed with this tutorial without being able to set the datablock manually within the level editor.
I would prefer to avoid rolling back to 1.1.3 just to continue with my education, so any help is appreciated.
#2
I think this will actually help me in designing my behavior based AI system when I can have them added through behaviors as well and thus on a similar level as the AI components themself.
05/19/2007 (4:50 pm)
Thank you for this input.I think this will actually help me in designing my behavior based AI system when I can have them added through behaviors as well and thus on a similar level as the AI components themself.
#3
05/21/2007 (3:44 am)
The next release will add support for loading custom data for the game project in the editor, most probably by having one managed file which is executed by the editor in which you would place any execs that need to be visible in the editor too.
#4
Now if I could just figure out why the coded gui labels over the objects aren't working.
05/21/2007 (11:07 am)
Thanks folks for the help on the datablocks issue. Copying the datablocks from the objectTypes.cs file into a datablocks.cs in the behaviors folder worked. I was able to see and set the datablocks in the editor.Now if I could just figure out why the coded gui labels over the objects aren't working.
#5
05/21/2007 (5:22 pm)
@Neo, might this also fix the issue with art resource images not being selectable from the dropdown lists within behavior GUIs?
#6
This executes two files that includes our config datablocks and GUI profiles from the game directory. Seem to work just fine (no idea about the "assigned after behaviors" thing though, this particular project is mostly a conversion from TGB 1.1.3 to 1.5... so not using behaviors).
05/21/2007 (6:51 pm)
Personally I fixed this by adding the following two lines to projectInternalInterface.ed.cs in the ProjectBase::_onProjectOpen function after the setScriptPathExpando lines:// blikstad: execute game profiles and pseudoClasses exec(expandFileName( "^game/gameScripts/profiles.cs")); exec(expandFileName( "^game/gameScripts/pseudoClasses.cs"));
This executes two files that includes our config datablocks and GUI profiles from the game directory. Seem to work just fine (no idea about the "assigned after behaviors" thing though, this particular project is mostly a conversion from TGB 1.1.3 to 1.5... so not using behaviors).
Torque 3D Owner Patrick Shaw
1) Put the datablocks into simset ie
$gameDatablocks = new SimSet() { canSaveDynamicFields = "1"; setType = "Datablocks"; new t2dSceneObjectDatablock(entityDataBlock) .... }2) Create a list of the datablocks in your *.cs datablock file:
//build list of datablocks for "assign datablocks" behavior function createGameDatablocksList() { %count = $gameDatablocks.getCount(); for (%i = 0; %i < %count; %i++) { %obj = $gameDatablocks.getObject(%i); %name = %obj.getName(); if (%list $= "") %list = %name; else %list = %list TAB %name; } $GameDatablocksList = %list; } createGameDatablocksList();3) Create a behavior for adding the datablock:
if (!isObject(assignDatablock)) { %template = new BehaviorTemplate(assignDatablock); %template.friendlyName = "Assign Datablock"; %template.behaviorType = "game"; %template.description = "Assigns a config Datablock to the object"; %template.addBehaviorField(config, "The configuration datablock", enum, "entityDataBlock", $GameDatablocksList); } function assignDatablock::onAddToScene(%this, %scenegraph) { %this.owner.setConfigDatablock(%this.config); }Hope this helps.