Game Development Community

Help Needed with "Unable to find object" error

by Kimberly Unger · in Torque Game Engine · 11/19/2003 (4:40 pm) · 4 replies

Hi!

We are trying to use the "Player Target Locking" resource and have run into a problem. When we added the mods to our 'Player.cs' we get the following message in the log


Unable to find object: '' attempting to call function 'getClosestBot'


when we process the command

%bot = %client.ship.getClosestBot( );

in the lockOn() fuction. Our getClosestBot fuction is declared as

function Ship::getClosestBot(%this)
{.....

We use ship because our className in the datablock FlyingVehicleData () is Ship.

Can anyone help or explain why we are getting this message?

#1
11/19/2003 (5:09 pm)
%client.ship = ??
#2
11/20/2003 (7:47 am)
The resouce has the code

%client.player.getClosetBot();

This gives me the message


Unknown command getClosestBot


That help?

P.S.
When I change

function Ship::getClosestBot(%this)
{
to
function Player::getClosestBot(%this)
{

i get the same message.
#3
11/20/2003 (9:07 am)
What's %client.player?
#4
11/20/2003 (3:34 pm)
OK Ben, this is the code segment

function lockOn( )
{
    echo("LOCKING ON TO TARGET");
    %client = ClientGroup.getObject(0);

    %i = $unlockedBots.getCount();
    while( %i > 0 )
    {
        $totalBots.add( $unlockedBots.getObject( %i-1 ) );
       
        %i--;
    }
// is the bot in and close enough?  If so add the bot to the unlocked
// group

    for( %i=0; %i < $totalBots.getCount(); %i++)
    {
        if( AIPlayer::isObjectInView( %client.player, $totalBots.getObject( %i ), 20 ) )
        {
           $unlockedBots.add($totalBots.getObject( %i ));
        }
    }
// get the closest bot from those in the unlockedBots
// array.
    %bot = %client.player.getClosestBot( );

This is the best I can do to define %client.player.