AIPlayer?
by Firas · in Technical Issues · 10/21/2004 (10:19 am) · 12 replies
I add to the engine the code from this resource:
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3746
my problem is: the bot is added but not move or attack ??
I'm sure I did it right thing, the AIPlayer.cc and AIPlayer.h and Build the solution, then I add the .cs files to the starter.fps so how can I make it work??
I try to spawn the bot from the consol by typing the following:
$bots[$botCounter].setAttackTargetObject(%client.player);
I have the follwing error:
Unable to find objects: Attempting to call function 'setAttackTargetObject'
please help
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3746
my problem is: the bot is added but not move or attack ??
I'm sure I did it right thing, the AIPlayer.cc and AIPlayer.h and Build the solution, then I add the .cs files to the starter.fps so how can I make it work??
I try to spawn the bot from the consol by typing the following:
$bots[$botCounter].setAttackTargetObject(%client.player);
I have the follwing error:
Unable to find objects: Attempting to call function 'setAttackTargetObject'
please help
About the author
#2
I'm using the HEAD version of torque, so may this be the problem??
coz when I press CTRL-B I have the following error on the consol:
serverCmdAddBot : Unknown command.
what do you think ?
10/21/2004 (6:10 pm)
I press CTRL-B (I didn't miss that) but nothing happen??I'm using the HEAD version of torque, so may this be the problem??
coz when I press CTRL-B I have the following error on the consol:
serverCmdAddBot : Unknown command.
what do you think ?
#3
go toconsol and type:
$mybot02=AIPlayer::spawnPlayer("abc");
I have a new bot but it's not moveing or attaking it's just stand and here is my function:
function AIPlayer::spawnPlayer(%name)
{
// An example function which creates a new AIPlayer object
// using the the example player datablock.
%player = new AIPlayer() {
dataBlock = PlayerBody;
aiPlayer = true;
};
MissionCleanup.add(%player);
// Player setup
%player.setMoveSpeed(1);
%player.setTransform(pickSpawnPoint());
%player.setEnergyLevel(60);
%player.setShapeName(%name);
%player.incInventory(Crossbow, 1);
%player.incInventory(CrossbowAmmo, CrossbowAmmo.maxInventory);
%player.use(Crossbow);
//for attach
%player.setAttackTargetObject(%client.player)
return %player;
}
so what is the problem?
10/21/2004 (6:54 pm)
Guys about the problem above I try the following :go toconsol and type:
$mybot02=AIPlayer::spawnPlayer("abc");
I have a new bot but it's not moveing or attaking it's just stand and here is my function:
function AIPlayer::spawnPlayer(%name)
{
// An example function which creates a new AIPlayer object
// using the the example player datablock.
%player = new AIPlayer() {
dataBlock = PlayerBody;
aiPlayer = true;
};
MissionCleanup.add(%player);
// Player setup
%player.setMoveSpeed(1);
%player.setTransform(pickSpawnPoint());
%player.setEnergyLevel(60);
%player.setShapeName(%name);
%player.incInventory(Crossbow, 1);
%player.incInventory(CrossbowAmmo, CrossbowAmmo.maxInventory);
%player.use(Crossbow);
//for attach
%player.setAttackTargetObject(%client.player)
return %player;
}
so what is the problem?
#4
That's your problem. %client.player can't just pop out of thin air.
10/22/2004 (4:46 am)
%player.setAttackTargetObject(%client.player)That's your problem. %client.player can't just pop out of thin air.
#5
pUT in server/scripts/comand.cs
in client/scripts/defaultbind.cs
and in client/config.cs
Now i used aispider.cs (just a copy of aiplayer and named aispider)
10/22/2004 (5:25 am)
Actually iit dose work mine works like this i use that resource in my curent project likepUT in server/scripts/comand.cs
$botCounter = 0;
function serverCmdAddBot(%client) {
MissionCleanup.add($bots);
%npcName = "Bot" @ $botCounter;
$bots[$botCounter] = AISpider::aiSpawnSpider(%npcName);
MissionCleanup.add($bots[$botCounter]);
$bots[$botCounter].setAttackTargetObject(%client.player);
$botCounter++;
}in client/scripts/defaultbind.cs
/ace
function addBot(%val)
{
if(%val)
{
commandToServer('AddBot');
}
}
moveMap.bind(keyboard, "ctrl b", addBot);
function addSpiderBot(%val)
{
if(%val)
{
commandToServer('AddSpiderBot');
}
}
moveMap.bind(keyboard, "ctrl v", addSpiderBot);
//endaceand in client/config.cs
moveMap.bind(keyboard, "ctrl b", addBot); moveMap.bind(keyboard, "ctrl v", addSpiderBot);
Now i used aispider.cs (just a copy of aiplayer and named aispider)
#6
just a thought
the ai_update from that page should still work
also if i remember right the ai site is set very low you may have to get closer to it for it to see you
10/22/2004 (5:30 am)
Sometimes, if you happen to spawn 2 bots on the exact same location it will look just like 1 and they will be stuck (just to make sure that aint happing ) go into the editor and move the bot manualy and see if there is another one therejust a thought
the ai_update from that page should still work
also if i remember right the ai site is set very low you may have to get closer to it for it to see you
#7
10/22/2004 (6:01 am)
But Gonzo is correct, firas has it as a server function where no client info is passed. Ace has a commandToServer which comes from a client.
#8
Im currently working that resource into a better one with classes and hopefully some better ai site stuff .
//randomthought
heh, i never "plan" cuz nothing seems to work the way you plan, so i only "get the general idea" and leave it at that.
//endrandomthought
10/22/2004 (1:05 pm)
Heh, ya i never goto console to input anything, only to read. Im currently working that resource into a better one with classes and hopefully some better ai site stuff .
//randomthought
heh, i never "plan" cuz nothing seems to work the way you plan, so i only "get the general idea" and leave it at that.
//endrandomthought
#9
12/14/2004 (8:43 am)
Hey guys I play Realm Wars and am trying to get bots into my new map... I cant even get them to spawn in it. I have tried typing this $mybot02=AIPlayer::spawnPlayer("abc"); bu all it says is (o): unable to instantiate non_conobject class AIplayer. Any ideas of where the problem is?
#10
02/10/2005 (7:15 am)
Im getting the same problem, I think it has something to do with the engine code i think AIPlayer.cc needs recompiled back into the engine, im gonna check it out today and see.. thanks
#11
02/12/2009 (8:01 am)
Im working with tgea 1.7.2 and I trying to add the aiplayer.cs in to my project and the exec comand .. but when I load the mission it hangs.. Can you tell me how to add the aiplayer.cs .. thanks
#12
if i remeber right there is another thread on this , i dont do torque any more
search beginning starterkit ai luck
03/09/2009 (5:24 pm)
last post 4 years ago if i remeber right there is another thread on this , i dont do torque any more
search beginning starterkit ai luck
Torque Owner Gonzo T. Clown