Game Development Community

Adding objects by script

by Otto Itkonen · in Torque Game Engine · 09/17/2008 (6:22 am) · 1 replies

What kind of code is needed to add objects to the mission with script?

#1
09/17/2008 (3:34 pm)
Do you mean add an object to the mis file, or like add an object to the scene while the game is running? If the second case, you generally just create it like
%obj = new TSStatic(); 
//or
%obj = new TSStatic()
{
// example...
fields = values;
};
If you do that on the server side it will be automatically added to the server-scene, and then ghosted to clients and added to their scene(s). If you want the object to also be cleaned up when the mission ends then you might also do...
MissionCleanup.add(%obj);