AddBehaviorTemplate
by Jumex · in Torque Developer Network · 07/18/2007 (5:22 am) · 1 replies
Over the last few days I have been woking with the 2D engine's behavior scripts. I have them almost figured out exept for a particular aspect.
%template.addBehaviorField(speed, "The speed to move toward the object at (world units per second)", float, 2.0);
%template.addBehaviorField(damage, "The amount of damage to apply", int, 10);
These are just 2 examples of the ".addBehaviorField" being used. Now my theory is that "SPEED" and "DAMAGE" are already defined in the engine. If this is the case where do I find a list of all these parameters that can be used with the ".addBehaviorField"
%template.addBehaviorField(speed, "The speed to move toward the object at (world units per second)", float, 2.0);
%template.addBehaviorField(damage, "The amount of damage to apply", int, 10);
These are just 2 examples of the ".addBehaviorField" being used. Now my theory is that "SPEED" and "DAMAGE" are already defined in the engine. If this is the case where do I find a list of all these parameters that can be used with the ".addBehaviorField"
About the author
Torque 3D Owner Stephen Zepp
No, those fields are not already defined in the engine at all. addBehaviorField() does a couple of things:
--creates a new dynamic field (by definition, not implemented within the engine, only for TorqueScript use) for your bahavior.
--gives the Level Builder information on how to allow level builder users to modify your dynamic field.
You can create any dynamic fields you wish with addBehaviorField, and they will be available within the level builder for GUI based editing. You must use these fields within TorqueScript (commonly in the various Behavior callbacks that are supplied by the engine) to affect the actions of the "owner" of this instantiation of the behavior.