Author Topic: onBotActivated function  (Read 834 times)

I'm trying to get a bot to do something when activated, doing a ServerCmd works, but the function I'm attempting to use does not work.
I did a dump() on playerStandardArmor to see if the function was correct:


This is my code:
Code: [Select]
function ServerCmdbot(%cl)
{
new aiplayer(FRANK)
{
datablock = playerStandardArmor;
position = vectoradd(_botbrick.getPosition(),"0 0 0.4"); // pops the bot on-top of a brick called botbrick
};
}

function ServerCmdChatMessage(%cl) //works fine
{
FRANK.setMoveDestination("0 12 0");
%cl.bottomPrint("\c2LOOK AT ME, I CAN WALK.",5);
}

function FRANK::onBotActivated(%obj,%cl) //does not work.
{
FRANK.setMoveDestination("0 12 0");
}
I'm probably doing it wrong, marbleman said that I'd need to create a function to do this because torque doesn't have it by default. But I couldn't manage to get that working.
« Last Edit: December 19, 2013, 10:56:01 PM by alex dude »

You have to package player::activateStuff

Code: [Select]
function ServerCmdbot(%cl)
{
new aiplayer(FRANK)
{
datablock = playerStandardArmor;
position = vectoradd(_botbrick.getPosition(),"0 0 0.4"); // pops the bot on-top of a brick called botbrick
isFrank = true;
};
}

function ServerCmdChatMessage(%cl) //works fine
{
FRANK.setMoveDestination("0 12 0");
%cl.bottomPrint("\c2LOOK AT ME, I CAN WALK.",5);
}
package yourPackage
{
function Player::Activatestuff(%obj)
{
Parent::Activatestuff(%obj);
%ray = containerRaycast(%obj.getEyePoint(),vectorAdd(%obj.getEyePoint(),vectorScale(%obj.getEyeVector(),3)),$Typemasks::playerObjectType,%obj);
if(isObject(%col=firstWord(%ray)) && %col.isFrank)
{
//Do things
%col.setmoveObject(%obj);
}
}
};
activatePackage(yourpackage);
« Last Edit: December 20, 2013, 02:39:01 AM by Pecon »

pecon what are you doing

package yourPackage
{
function Player::Activatestuff(%obj)
{


what is this indention

%ray =       containerRaycast(%obj.getEyePoint(),vectorAdd(%obj.getEyePoint(),vectorScale(%obj.getEyeVector(),3)),$Typemasks::playerObjectType,%obj);

WHAT ARE YOU DOING

« Last Edit: December 20, 2013, 12:32:31 PM by alex dude »

Edit: This is more fun than expected

Pff, I've spawned about 175 bots which all were using jumps and jets to all pile on top of me. And then I gave all of them weapons and made them target each other.