Animated shapes to load without Console
by Kila · in Technical Issues · 04/07/2008 (6:25 am) · 1 replies
How can I get my animated shapes to load as soon as the game level loads instead of having to always call them through the console?
by Kila · in Technical Issues · 04/07/2008 (6:25 am) · 1 replies
Torque Owner Mike Rowley
Mike Rowley
datablock StaticShapeData(myCoolShape) { category = "Misc"; // Your object will show up in the mission editor under "shapes/Misc" className = "MyTest"; // Give this a discriptive name shapeFile = "~/data/shapes/myObjectFolder/myCoolObject.dts"; //Path to your object isPlaying = 1; // Well....you want it to play don't you?? "0" = false }; function MyTest::onAdd(%this, %obj) // Make sure MyTest matches your classname. { %obj.playthread(0, "Ambient"); //Ambient is milkshapes default name for animations. Make sure // This is named the same as it is in your dts exporter. }Put this in "server/scripts" and exec it in game.cs (in the server folder) and you will be good to go.
Edit: forgot to say:
You place your object in your mission thru the mission editor ( F11 ). Look under shapes/Misc/ to find your object. This will start as soon as the game starts. If your animation is set to cyclic in your dts exporter, it will cycle thru forever. (or until your game stops)
If you don't want it to start imediately, Change the function by adding a scedule to it. (obj.scedule (milliseconds, start, true); //I don't know the proper word to use instead of start.