Game Development Community

Setting behaviors in script

by Kevin James · in Torque Game Builder · 03/03/2008 (2:12 pm) · 1 replies

What's up?

I'm having problems setting a behavior on an object in script. I hunted around the Behaviors forums and found a thread, but the advice given there didn't help me out. If someone knew how to set behavior fields in script, I'd appreciate knowing that too.

Last question: does setting behaviors in script defeat their purpose? I have a gnawing feeling that setting behaviors in scripts is kind of like building levels in scripts. What do you think?

Later,
Kevin

About the author

Computer security, digital forensics, and platform jumper enthusiast. shells.myw3b.net/~syreal/


#1
03/03/2008 (3:12 pm)
Booyeah! Just answered my own question! It dawned on me to look at the level file of a level with behaviors in it, duh! What you do is:

%object = new t2dStaticSprite()
{
      //default field values
      _behavior0 = "behaviorTemplateName";

      //customized field values
      _behavior1 = "behaviorTemplateName[TAB]fieldName[TAB]fieldValue";
};

It's important to note that some editors treat the tab key as 5 spaces instead of a "new field". If that's the case, then make an object in the level builder then open the level file and copy the space between the behavior template name and the behavior field. Perhaps there is an easier way? Let me know.