Vectors in functions
by ... · in Torque Game Engine · 08/29/2006 (11:28 am) · 1 replies
Hello everyone,
I want my AIplayer to move to a location
this is what ive done so far
any help is welcome.
Thanks ,
Robin.
I want my AIplayer to move to a location
this is what ive done so far
function AIPlayer::moveToPos(%this,%pos)
{
// Move to the given position x y z
echo("-->AI Move to "@%pos@" .");
%this.setMoveDestination(%pos, %pos);
}this function seems not to get a %pos valuefunction serverCmdTestmoveTo(%client)
{
%pos = %client.player.getTransform();
echo("Move to "@%pos@" .");
$Squad[1].pushTask("moveToPos(%pos)");
}
GlobalActionMap.bindCmd(keyboard, "n", "commandToServer('TestmoveTo');", "");any help is welcome.
Thanks ,
Robin.
About the author
Torque Owner Tod Kuykendall
You call the subroutine passing only one value: moveToPos(%pos)
But the subroutine is expecting two values: moveToPos(%this,%pos)
Your subroutine call should match the arguments of the subroutine being called.
If you're going to use "this" in the subroutine you need to pass it in along with "pos" or if you don't need it drop it off and only pass pos. I suspect that what you want to do is pass in the "this" being moved along with the position you want it to move to. If you supply only the position the subroutine as no idea of what you want moved or any way to access it.
HTH,
=Tod