Getting a name
by eqdarkleaf · in Torque Game Builder · 03/23/2010 (3:03 am) · 1 replies
I am creating enemies (and player) using a datablock, and I am adding a behavior to it, specifically the "faceobject" behavior. This is where i am stuck:
%template.addBehaviorField(object, "The object to face", object, "", t2dSceneObject);
Ok, so I need to place an object for the owner of the behavior to face. Since in this case, I want the enemy to face the player, the object needs to be the player. So when creating my datablock for the enemy I have:
_Behavior0 = "faceObjectLR object PlayerClass";
As you can see, I tried using the class as the object, but it does not work. My only other idea is to use the name of the object.... but how do add a name when creating the datablock? Or is there another way to refrence the character so the behavior will work?
%template.addBehaviorField(object, "The object to face", object, "", t2dSceneObject);
Ok, so I need to place an object for the owner of the behavior to face. Since in this case, I want the enemy to face the player, the object needs to be the player. So when creating my datablock for the enemy I have:
_Behavior0 = "faceObjectLR object PlayerClass";
As you can see, I tried using the class as the object, but it does not work. My only other idea is to use the name of the object.... but how do add a name when creating the datablock? Or is there another way to refrence the character so the behavior will work?
About the author
Torque Owner Mike Lilligreen
T2DTutorials
new t2dStaticSprite(background) { imageMap = "backdrop_bImageMap"; frame = "0"; canSaveDynamicFields = "1"; size = "100.000 75.000"; Layer = "31"; mountID = "2"; };Within behavior fields, to get an object you have to refer to its name. A class won't work as you found out.