Questions to Stefans advanced bot scripting ....
by Michael Schaumburg · in Torque Game Engine · 12/03/2002 (5:09 am) · 23 replies
I got it working this great source "Adding NPC support". Now I try to to get Stefans source "Advanced bot scripting" at www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=2505 to work for the NPC's. When I try to acces from a NPC to the code, I get some errors in the console. First how I create the NPC:
I was running through the scripts but I can't find this missing functions. In the console I get the following:
fps/server/scripts/aiPlayer.cs (275): Unknown command getLocation
fps/server/scripts/aiPlayer.cs (155): Unknown command setTargetObject
fps/server/scripts/aiPlayer.cs (174): Unknown command move
Why is the function unable to find the object ?
fps/server/scripts/aiPlayer.cs (163): Unable to find object: '' attempting to call function 'hasInventory'
fps/server/scripts/aiPlayer.cs (163): Unable to find object: '' attempting to call function 'hasInventory
Any idea ??
Also I changed my create function to start the NPC with a weapon, but he still has no weapon:
function NPC::create(%datablock)
{
// Create the player object
%obj= new AIPlayer()
{
dataBlock= %datablock;
};
%obj.setMoveSpeed(0.2);
%obj.handleWaypointsAndChase(%this);
return %obj;
}I was running through the scripts but I can't find this missing functions. In the console I get the following:
fps/server/scripts/aiPlayer.cs (275): Unknown command getLocation
fps/server/scripts/aiPlayer.cs (155): Unknown command setTargetObject
fps/server/scripts/aiPlayer.cs (174): Unknown command move
Why is the function unable to find the object ?
fps/server/scripts/aiPlayer.cs (163): Unable to find object: '' attempting to call function 'hasInventory'
fps/server/scripts/aiPlayer.cs (163): Unable to find object: '' attempting to call function 'hasInventory
Any idea ??
Also I changed my create function to start the NPC with a weapon, but he still has no weapon:
// start with a weapon
%weapon = new Item(){
dataBlock = Rifle;
};
%ammo = new Item(){
dataBlock = RifleAmmo;
};
MissionCleanup.add(%weapon);
MissionCleanup.add(%ammo);
%obj.pickup(%weapon,1);
%obj.pickup(%ammo,2);
#22
12/17/2002 (8:05 pm)
Anyone ever figure out what Ken came up with here?
#23
That's it, and it works just fine using the new AIPlayer class with no engine changes. Instead of the custom TrollAvatar, one would use the stock LightMaleHumanArmor instead...
12/18/2002 (8:24 am)
function TrollAvatar::openFire(%this,%obj)
{
%obj.setImageTrigger(0,false);
%this.schedule($MIN_TRIGGER_HOLD+getRandom($MAX_TRIGGER_HOLD), "ceaseFire", %obj);
}That's it, and it works just fine using the new AIPlayer class with no engine changes. Instead of the custom TrollAvatar, one would use the stock LightMaleHumanArmor instead...
Associate Stefan Beffy Moises