Accessing that silly AI
by Tasty Green Pees :-, · in Torque Game Engine · 02/22/2006 (3:55 am) · 4 replies
I've tried everything and I just keep getting weird things. Can anyone tell me how to pass methods to my ai player.
in my file bot.cs
I have these lines:
I now wish to access my newly created ai to pass methods to him like setMoveDestination etc.
I've pretty much pulled all my hair out at this point!
in my file bot.cs
I have these lines:
datablock PlayerData( myBot : PlayerShape )
{
// TO DO: Add extra stuff here to manage new A.I. functionality...
};
function AIPlayer::spawn( %name, %spawnPoint )
{
// Create the A.I. driven bot object...
%player = new AIPlayer()
{
dataBlock = myBot;
path = "";
};
MissionCleanup.add( %player );
%player.setShapeName( %name );
%player.setTransform( %spawnPoint );
return %player;
}
function AIManager::think( %this )
{
if( !isObject( %this.player ) )
%this.player = %this.spawn();
%this.schedule( 500, think );
}
function AIManager::spawn( %this )
{
%bot = AIPlayer::spawn( "Bot_1", pickSpawnPoint() );
return %bot;
}I now wish to access my newly created ai to pass methods to him like setMoveDestination etc.
I've pretty much pulled all my hair out at this point!
About the author
Torque Owner Chris Labombard
Premium Preferred
Try: