Game Development Community

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:

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!

#1
02/22/2006 (4:33 am)
Have you taken a look at the AIGuard resource?

Try:
AIManager.player.setMoveDestination(....);
#2
02/22/2006 (4:43 am)
No I hadn't. Thanks, Chris.
#3
02/22/2006 (1:47 pm)
This may also be helpful:

Using Basic AI Commands
#4
02/23/2006 (1:30 am)
Thank's Matt. Lemme check this out.