How can I put a custom object into the scene 'by default'?
by So Yamaoka · in Torque Game Engine · 08/03/2005 (5:27 pm) · 3 replies
Hi all,
First off, if similar questions have been asked, my apologies. and could you give me a pointer to the article(s) in that case. I have searched the community but no luck.
I'd like to to add a custom C++ object, which is fxRenderObject by Melv May, into the scene when the mission is launched. In other words, the custom object should be in the scene, like a terrain, before the player spawns.
According to the Torque Scripting tutorial (http://www.garagegames.com/docs/tge/general/ch05s02.php,) it seems like I can add the object by writin a script (let's say blah.cs):
And I made TGE call this blah.cs from game.cs:
However, nothing appears in the scene. nor in the world editor inspector. I got a debugging message in the console though. Am I doing something completely stupid here or missing something important?
any suggestions are appreciated.
thanks,
So
First off, if similar questions have been asked, my apologies. and could you give me a pointer to the article(s) in that case. I have searched the community but no luck.
I'd like to to add a custom C++ object, which is fxRenderObject by Melv May, into the scene when the mission is launched. In other words, the custom object should be in the scene, like a terrain, before the player spawns.
According to the Torque Scripting tutorial (http://www.garagegames.com/docs/tge/general/ch05s02.php,) it seems like I can add the object by writin a script (let's say blah.cs):
new fxRenderObject()
{
position = "23.0, -410.0, 200.0";
};
echo("fxRenderObject is called."); // just for debuggingAnd I made TGE call this blah.cs from game.cs:
function onServerCreated() // or function onMissionLoaded()
{
// snip...
exec("./blah.cs");
}However, nothing appears in the scene. nor in the world editor inspector. I got a debugging message in the console though. Am I doing something completely stupid here or missing something important?
any suggestions are appreciated.
thanks,
So
About the author
#2
thanks for your reply anyways. So, what I am doing here is not terribly insane?
08/03/2005 (9:17 pm)
Sorry, that was confusing. What I meant by 'debugging message' was 'my debugging message' which isecho("fxRenderObject is called."); // just for debuggingthere is no error message in the console window. I just wanted to say that the script seemed to be compiled correctly and ran.thanks for your reply anyways. So, what I am doing here is not terribly insane?
#3
I have:
1. used starter.fps instead of tutorial.base (i was using tutorial.base downloaded from code sampler.)
2. added a custom object using an in-game editor.
3. saved the mission and quit.
4. opened the saved mission file with a text editor.
5. cut and pasted a computer-generated script in the mission file to onMissionLoaded() method in game.cs
One problem is that I can't find the object in the world editor inspector.
..but here's my stupidity. I realized that there's no problem to use the saved mission file. I can clearly see the object in the world editor inspector.
thanks,
So
08/04/2005 (10:46 am)
Ok, the problem is solved but I don't know exactly why. I just make a log what I've tried.I have:
1. used starter.fps instead of tutorial.base (i was using tutorial.base downloaded from code sampler.)
2. added a custom object using an in-game editor.
3. saved the mission and quit.
4. opened the saved mission file with a text editor.
5. cut and pasted a computer-generated script in the mission file to onMissionLoaded() method in game.cs
One problem is that I can't find the object in the world editor inspector.
..but here's my stupidity. I realized that there's no problem to use the saved mission file. I can clearly see the object in the world editor inspector.
thanks,
So
Associate Kyle Carter