Giving an item dynamic on creation
by Christian · in Torque Game Engine · 05/05/2007 (8:46 am) · 2 replies
Is there a way to give an item you create a set of dynamic fields? So whenever I add one of these:
in game. I need it to have
ChocolateMarker.meltSpeed = 0.35;
ChocolateMarker.aroma = 0.035;
ChocolateMarker.taste = 1;
datablock StaticShapeData(ChocolateMarker)
{
category = "Chocolate";
shapeFile = "~/data/shapes/bars/chocolate.dts";
};in game. I need it to have
ChocolateMarker.meltSpeed = 0.35;
ChocolateMarker.aroma = 0.035;
ChocolateMarker.taste = 1;
#2
If I change a dynamic field on each individual marker that I place and save they revert to the ::onAdd default values.
Is there a way to fix that?
05/09/2007 (12:17 pm)
Thanks Tim. As of now it gives each marker a set of dynamic fields that are preset in script.If I change a dynamic field on each individual marker that I place and save they revert to the ::onAdd default values.
Is there a way to fix that?
Torque Owner Tim Heldna
datablock StaticShapeData(ChocolateMarker) { category = "Chocolate"; shapeFile = "~/data/shapes/bars/chocolate.dts"; }; function ChocolateMarker::onAdd(%this,%obj) { %obj.meltSpeed = 0.35; %obj.aroma = 0.035; %obj.taste = 1; }Place a ChocolateMarker in your world with the world editor, select it and hit F3 to view its properties. You will see your values listed.Naturally, the above tags can be returned in script.