Removing Behaviors?
by Mike Kowalski · in Torque Game Builder · 11/25/2008 (9:20 am) · 0 replies
Greetings, I have been having some trouble getting my game to remove behaviors from my player. Basically I have a player that can switch movement behaviors at the press of a key, and I can create new instances of behaviors with no problems.
The documentation says:
removeBehavior(BehaviorInstance bi,[bool deleteBehavior=true])
Params: bi: The behavior instance to remove deleteBehavior: Whether or not to delete the behavior Return:
bool success: Whether the behavior was successfully removed
So I went and setup:
%turn = AlignToJoystickBehavior.createinstance();
%move = ThrusterControlsBehavior.createinstance();
%hover =insertbehaviornamehere.createinstance();
if(player.form $= "FormA")
{
player.removebehavior(%turn, (1) );
player.removebehavior(%move, (1) );
player.addbehavior(%hover);
echo("TRANSFORM!");
}
Based on what the documentation said, I believe I'm calling it correctly, and the console doesn't have any script compilation errors and I can see my echo statement. Am I missing something?
Thanks in advance for any help!
The documentation says:
removeBehavior(BehaviorInstance bi,[bool deleteBehavior=true])
Params: bi: The behavior instance to remove deleteBehavior: Whether or not to delete the behavior Return:
bool success: Whether the behavior was successfully removed
So I went and setup:
%turn = AlignToJoystickBehavior.createinstance();
%move = ThrusterControlsBehavior.createinstance();
%hover =insertbehaviornamehere.createinstance();
if(player.form $= "FormA")
{
player.removebehavior(%turn, (1) );
player.removebehavior(%move, (1) );
player.addbehavior(%hover);
echo("TRANSFORM!");
}
Based on what the documentation said, I believe I'm calling it correctly, and the console doesn't have any script compilation errors and I can see my echo statement. Am I missing something?
Thanks in advance for any help!
About the author