Game Development Community

Renaming objects...possible?

by Joe Rossi · in Torque Game Builder · 10/05/2006 (12:10 am) · 0 replies

In my game I want to put a bunch of the same monsters in a level using script, with names like monster1, monster2, monster3 etc. This is what I have so far, but, it's going to be tedious to paste datablocks for every monster into a function like this. I'd rather load them from individual files, but it doesn't seem like I can dynamically set name handles when doing that. ( These names are very important for what I'm doing! )

Here %name is the name formatted to be like droid1, droid2, ...

function create_monster( %name  ){    
     
    %tmp = new t2dShape3D(%name) {
      shape = "T2D/data/shapes/monster.dts";
      intraDetailLevel = "0";
      canSaveDynamicFields = "1";
      Position = "-27.536 38.768";
      size = "16.000 16.000";
      Layer = "20";
      name = %name;
      mountID = "8";
   };

 [b]  //I really want this instead.. .tob is a file containing a single object.
   //%name = exec( "~/data/objects/" @ %monstername @ ".tob" ) ; 
 [/b]
    myscenegraph.addtoscene( %name );      
}

Any ideas would be much appreciated...