Game Development Community

Issue with creating an fxLight in the world editor

by Todd D. Degani · in Torque Game Engine · 05/16/2005 (2:13 pm) · 4 replies

While digging through some code I noticed that the fxlighticon.png file was missing from the common/editor directory. Since I had never use the fxLight I figured I would check it out.

After I entered the editor I attempted to place one but the datablock dropdown list was empty. I then went and found the original resource for this and made a new file called common/server/fxLightProfile.cs and copied the datablock into it.

datablock fxLightData(DefaultLight)
{
....
}

Then I setup common/main.cs to exec the new script file:
exec("./server/fxLightProfile.cs");

I know this file is getting execed because my console log dumps out "Loading compiled script common/server/fxLightProfile.cs."

When I go to create the fxLight the DefaultLight datablock still does not showup in the listbox and if I just press ok without the datablock I get:
"editor/newObject.cs (0): Register object failed for object testLight of class fxLight."

I also tried changing ObjectBuilderGui::buildfxLight so that the addfield line looked like this:
%this.addField("dataBlock", "TypeDataBlock", "fxLight Data", "fxLightData DefaultLight");

When I did this the console log reported that:
Object 'DefaultLight' is not a member of the 'GameBaseData' data block class
editor/newObject.cs (0): Register object failed for object testLight of class fxLight.

I looked through all the posts I could find but couldn't seem to find what I am missing. Thanks.

#1
05/16/2005 (4:50 pm)
Ok I figured this out but I don't know why it works. I took a look at the demo and it had this working. I needed to put the file containing my datablock into the servers/scripts directory of where my game is located. Then I exec'd it from game.cs.

To work with the example this would be example/starter.fps/server/scripts, in case anyone runs into this later.

If anyone knows why this works instead of the way I was doing it please enlighten me. The script was getting executed both ways so I don't know what the difference was.
#2
05/16/2005 (11:43 pm)
Because datablocks are wiped and reloaded whenever you start a server, so that no more than are needed are in memory. As a result, they have to be in the right branch of the code, lest they not be loaded up again when the reset happens. Thanks for posting your solution in the thread! Much more helpful for later seekers... :)
#3
05/17/2005 (7:26 am)
Ah that makes sense. Thanks for the explanation Ben. Which branch is the correct branch to get them to get reloaded? Obviously server/scripts of my game directory, but does any branch under server work? Seems kind of strange that common/server wouldn't load, did it need to be common/server/scripts?
#4
05/17/2005 (9:38 pm)
It's not a subdirectory, it's which set of exec'ed scripts. Try running with trace() on - might clarify things a bit!