Killer Kork, an ai bot
by devans · 07/03/2006 (11:35 am) · 94 comments
Download Code File
Description:
Killer Kork is an ai bot with a purpose (you guessed it), eliminating opponents, but with a twist! With this resource, Kork must use his new-found senses of sight and sound to track down the enemy. If he hasn't seen or heard you, he doesn't 'magically' know you exist. Even with these limitations, you might find him hard to beat!
To use:
Killer Kork is set in the starter.fps scene. Just download and unzip the four files in killer.kork.ai.zip into the starter.fps\server\scripts folder (backup aiPlayer.cs first, if you want to keep the original), and launch. No TGE engine mods necessary, completely script-based.
By default the scripts will create two teams of bots, the Brains and the Algos, which will commence to battle it out. Simply setting the $AIPlayer::TeamCount, you can set how many bots are spawned on each team. It is also possible to set whether the bots will attack human opponents using the isHumanFriendly boolean in the AIManager class (bottom of aiPlayer). By default, 'Evil Brain' and 'Evil Algo' are the only bots set to attack human players on sight.
The files:
..\server\scripts\aiPlayer.cs -low lvl body functions (heavily modified from original)
..\server\scripts\aiAlgo1.cs -high lvl decision-making functions (new)
..\server\scripts\aiSensObj.cs -sensory feedback (new)
..\server\scripts\consoleFunctions.cs -convenient in-game functions (new, not required)
Features:
- Raytrace vision
- Hearing radius
- Basic flocking
- Retrieval of heath/ammo
- Basic obstacle avoidance
- Avoids bodies of water
- Attempts to get 'unstuck'
- Quick 'dodge' function that can happen between think cycles
Bonus:
- Tons of static variables to set various attributes of the bots
- Heavily commented code
- Configurable debug lvl (set through $AIPlayer::DebugLevel, or on the fly with the Con::setDebug function) of messages sent to console (0 error, 1 critical, ...5 verbose)
- Spawn counter for each team (higher number = losing team)
Bot Behavior states:
- Wander (roam the map, keeping an eye on path markers, look for health/ammo)
- Attack (if any enemies are sensed, go get 'em!)
- Search (look for a lost target)
- Respond (react to unknown threat)
- Follow (follow friendly)
- Assist (assist friendly)
Below I'll briefly try to describe some of the finer points of Kork's ai code, which might not be so obvious on first load.
- Kork has a 'center of vision', and a peripheral vision cone. Players in his center of vision have a much better chance of being spotted. Moving targets are also much easier for Kork to spot.
- If Kork has seen an opponent, then subsequently lost sight of them, he will run to the last location of the sighting and start searching from that point
- In battle, Kork attempts to slide away from the direction his opponent's weapon is facing. This tends to make two bots locked in combat weave back and forth, attempting to get out of the way while compensating for their opponent's movement.
- Kork tries to 'snipe' if his opponent is far enough away and not facing his direction, before running in to close the gap. This helps with aim, since only one object is then in motion.
- Kork will be put into a 'Respond' state if he takes damage or senses a nearby explosion without having a target.
- Kork will go to fetch ammo he might have seen immediately if he runs out, no matter what the situation. If he reaches his 'low' threshold of either ammo or health, however, he will only go to fetch if not engaged with an opponent.
- In order to facilitate retrieval of items (i.e., not getting stuck), upon approach a horizontal line is drawn out from the eyePoint, which is then used to check a clear path by raytracing points (default 40 points at 0.3 units apart)from the line to the item. Kork then uses the average of the points that tested 'good' as his approach route.
- To prevent Kork from straying too far, he attempts to stay within range of the path nodes (DistPathMax), but will freely wander around looking for something to do as long as he's seen a path marker within range.
- Since this is based on the stock starter.fps crossbow weapon, Kork will rely on the explosion radius damage of the crossbow bolt by aiming at the feet of a particularly fast-moving opponent. He does, however, do a pretty good job of anticipating the location of a moving target when shooting a bolt.
Additional info/History:
Killer Kork was born as a project to make TGE 'do' something during a visit from my brother last August. It was originally envisioned as a battleground for pitting each our own ai code against the other, but considering my brother's Ph.D. in physics, as well as 10+ years professional coding experience, it quickly became a losing battle for my ai code (which was busy doing 'victory dances' and such on getting a frag... =). The result I'm posting is his code (with his blessing), developed over a two week period, without any previous torque-script experience. That said, it obviously isn't fully featured, optimized, etc, but hopefully a solid starting point for anyone wanting some ai (and can't wait for the 'real deal').
On a side note, re-implementing the original idea of two sets of combating ai code is easily achievable by simply modifying the AIManager class (and uncomment the execute line at top of AIPlayer) to include two different versions of ai code. We were also using a modified .mission file with a second path, where the other team could start somewhat unmolested.
This code comes AS-IS. It was based on TGE 1.3, but I've given it a quick test in 1.4, and everything seems to run fine. Instead of letting it gather dust on my HD, I hope someone finds it useful. If you do use it in a project, or change it in an interesting way, please send me a mail dgevans at hotmail dot com. It was a learning experience for me, and now hopefully others =)
I'd also like to thank Sam Bacsa for Codeweaver (then called TorqueScript Dev?), which we used extensively. It was a HUGE help!
/daniel
Description:
Killer Kork is an ai bot with a purpose (you guessed it), eliminating opponents, but with a twist! With this resource, Kork must use his new-found senses of sight and sound to track down the enemy. If he hasn't seen or heard you, he doesn't 'magically' know you exist. Even with these limitations, you might find him hard to beat!
To use:
Killer Kork is set in the starter.fps scene. Just download and unzip the four files in killer.kork.ai.zip into the starter.fps\server\scripts folder (backup aiPlayer.cs first, if you want to keep the original), and launch. No TGE engine mods necessary, completely script-based.
By default the scripts will create two teams of bots, the Brains and the Algos, which will commence to battle it out. Simply setting the $AIPlayer::TeamCount, you can set how many bots are spawned on each team. It is also possible to set whether the bots will attack human opponents using the isHumanFriendly boolean in the AIManager class (bottom of aiPlayer). By default, 'Evil Brain' and 'Evil Algo' are the only bots set to attack human players on sight.
The files:
..\server\scripts\aiPlayer.cs -low lvl body functions (heavily modified from original)
..\server\scripts\aiAlgo1.cs -high lvl decision-making functions (new)
..\server\scripts\aiSensObj.cs -sensory feedback (new)
..\server\scripts\consoleFunctions.cs -convenient in-game functions (new, not required)
Features:
- Raytrace vision
- Hearing radius
- Basic flocking
- Retrieval of heath/ammo
- Basic obstacle avoidance
- Avoids bodies of water
- Attempts to get 'unstuck'
- Quick 'dodge' function that can happen between think cycles
Bonus:
- Tons of static variables to set various attributes of the bots
- Heavily commented code
- Configurable debug lvl (set through $AIPlayer::DebugLevel, or on the fly with the Con::setDebug function) of messages sent to console (0 error, 1 critical, ...5 verbose)
- Spawn counter for each team (higher number = losing team)
Bot Behavior states:
- Wander (roam the map, keeping an eye on path markers, look for health/ammo)
- Attack (if any enemies are sensed, go get 'em!)
- Search (look for a lost target)
- Respond (react to unknown threat)
- Follow (follow friendly)
- Assist (assist friendly)
Below I'll briefly try to describe some of the finer points of Kork's ai code, which might not be so obvious on first load.
- Kork has a 'center of vision', and a peripheral vision cone. Players in his center of vision have a much better chance of being spotted. Moving targets are also much easier for Kork to spot.
- If Kork has seen an opponent, then subsequently lost sight of them, he will run to the last location of the sighting and start searching from that point
- In battle, Kork attempts to slide away from the direction his opponent's weapon is facing. This tends to make two bots locked in combat weave back and forth, attempting to get out of the way while compensating for their opponent's movement.
- Kork tries to 'snipe' if his opponent is far enough away and not facing his direction, before running in to close the gap. This helps with aim, since only one object is then in motion.
- Kork will be put into a 'Respond' state if he takes damage or senses a nearby explosion without having a target.
- Kork will go to fetch ammo he might have seen immediately if he runs out, no matter what the situation. If he reaches his 'low' threshold of either ammo or health, however, he will only go to fetch if not engaged with an opponent.
- In order to facilitate retrieval of items (i.e., not getting stuck), upon approach a horizontal line is drawn out from the eyePoint, which is then used to check a clear path by raytracing points (default 40 points at 0.3 units apart)from the line to the item. Kork then uses the average of the points that tested 'good' as his approach route.
- To prevent Kork from straying too far, he attempts to stay within range of the path nodes (DistPathMax), but will freely wander around looking for something to do as long as he's seen a path marker within range.
- Since this is based on the stock starter.fps crossbow weapon, Kork will rely on the explosion radius damage of the crossbow bolt by aiming at the feet of a particularly fast-moving opponent. He does, however, do a pretty good job of anticipating the location of a moving target when shooting a bolt.
Additional info/History:
Killer Kork was born as a project to make TGE 'do' something during a visit from my brother last August. It was originally envisioned as a battleground for pitting each our own ai code against the other, but considering my brother's Ph.D. in physics, as well as 10+ years professional coding experience, it quickly became a losing battle for my ai code (which was busy doing 'victory dances' and such on getting a frag... =). The result I'm posting is his code (with his blessing), developed over a two week period, without any previous torque-script experience. That said, it obviously isn't fully featured, optimized, etc, but hopefully a solid starting point for anyone wanting some ai (and can't wait for the 'real deal').
On a side note, re-implementing the original idea of two sets of combating ai code is easily achievable by simply modifying the AIManager class (and uncomment the execute line at top of AIPlayer) to include two different versions of ai code. We were also using a modified .mission file with a second path, where the other team could start somewhat unmolested.
This code comes AS-IS. It was based on TGE 1.3, but I've given it a quick test in 1.4, and everything seems to run fine. Instead of letting it gather dust on my HD, I hope someone finds it useful. If you do use it in a project, or change it in an interesting way, please send me a mail dgevans at hotmail dot com. It was a learning experience for me, and now hopefully others =)
I'd also like to thank Sam Bacsa for Codeweaver (then called TorqueScript Dev?), which we used extensively. It was a HUGE help!
/daniel
#22
In the function 'AIAlgo1::haveAmmo', bots decide if they have ammos.
I found that it is hard coded only for crossbowAmmo.
So, I think, if you want equip the other weapons, you'll have to change that to fit for your weapon.
Maybe something like this,
Hope this helps.
Hongjin
08/10/2006 (8:39 pm)
For anyone who wants to know the result!In the function 'AIAlgo1::haveAmmo', bots decide if they have ammos.
I found that it is hard coded only for crossbowAmmo.
So, I think, if you want equip the other weapons, you'll have to change that to fit for your weapon.
Maybe something like this,
$botWeapon = SMG; //weapon for the bot mountImage($botWeapon@"Image",0); incInventory($botWeapon@"Ammo",100); //and in the function haveAmmo return %this.player.getInventory($botWeapon@"Ammo") > 0; instead of return %this.player.getInventory(crossbowAmmo) > 0;
Hope this helps.
Hongjin
#24
09/18/2006 (11:38 am)
This was the most interesting resource so far! I could not stop playing with it! =) =) =)
#25
ok on a clean run of 1.4.2 the code is awesome,but on my
altered versions ie cg version and tse,fps still bad even after
taking out the water etc,and replacing models with stock.
hmmm
11/06/2006 (3:09 pm)
hmm i get a massive performance hit 2-3 fps :(ok on a clean run of 1.4.2 the code is awesome,but on my
altered versions ie cg version and tse,fps still bad even after
taking out the water etc,and replacing models with stock.
hmmm
#26
11/07/2006 (9:25 am)
Great resource. Got it running on 1.5 and it works very well.Question ...
can someone point me in the right direction toward making the bots so that they ONLY attack NON ai players? In other words, I want them to attack me and all other clients and not each other. I adjusted it to make them all not human freindly, so they shoot at me now but still spend a lot of time fighting each other.
#27
I also heve a suggestion for Nmuta Jones. In AIalgo1.cs on line 118 there is a create function. Here is where the isHumanFriendly is stated to be true. Try adding a new field isAIFriendly and set it to false. I not very good at using script yet but I think this is a start to your problem. I am looking for the same result but have not yet tested this theory. When I get to that part I will post my result.
11/14/2006 (12:23 am)
This is excellent! It works great with one exception. When I run it the AI bots only work for a little while. When the mission (starter.fps) first starts the bots do what they are programmed to do, but if I wait a bit they just run around and do nothing. For some clarification here's what it does. The mission loads, the bots and my player are spawned (I am just using the supplied Kork players and I lowered the teams to 1 player each, because of a low video card in my laptop the fps is very low when there is more) if I go near or fire at the bots they respond like they should. After the bots get fraged and respawned a few times they stop responding to anything they see or hear. Infact, they don't see or hear anything (nothing is registered in the console). I have checked through the code and can't seem to find the problem.I also heve a suggestion for Nmuta Jones. In AIalgo1.cs on line 118 there is a create function. Here is where the isHumanFriendly is stated to be true. Try adding a new field isAIFriendly and set it to false. I not very good at using script yet but I think this is a start to your problem. I am looking for the same result but have not yet tested this theory. When I get to that part I will post my result.
#28
I will echo Nmuta's desire to set up this resource so that the ai only fires on humans, and not on other ai. I've been working on it but so far no luck. It is easy to get both ai to attack humans, but I don't want them to fight each other. There are a lot of hooks in this code that are tough to follow - I may have to draw myself a huge wiring diagram to see how it is working.
I tried getting rid of the "teams", tried Ryan's ideas on isAIfriendly, and tried rewiring the Players section around line 920 in aiAlgo1.cs where // closest/weakest attack targets are specified so that even if a player is not a team member, it is just followed or assisted.
Anyone have ideas on how to tweak this resource so that the teams are united, and only humans are the targets?
12/26/2006 (10:46 am)
Thanks Daniel and Mathew for this cool resource! I commented out the firing code bits so that I could get up close and see how these guys behave without getting my butt blown away.I will echo Nmuta's desire to set up this resource so that the ai only fires on humans, and not on other ai. I've been working on it but so far no luck. It is easy to get both ai to attack humans, but I don't want them to fight each other. There are a lot of hooks in this code that are tough to follow - I may have to draw myself a huge wiring diagram to see how it is working.
I tried getting rid of the "teams", tried Ryan's ideas on isAIfriendly, and tried rewiring the Players section around line 920 in aiAlgo1.cs where // closest/weakest attack targets are specified so that even if a player is not a team member, it is just followed or assisted.
Anyone have ideas on how to tweak this resource so that the teams are united, and only humans are the targets?
#29
In AiAlgo1.cs, around line 917, make your code look like this:
// == Players
if( %obj.isPlayer() )
{
// closest/weakest attack target
if( (%this.attackObj == 0 ||
(%dist < $AIAlgo1::AttackClose && %this.attackObj.damage < %obj.damage)) &&
(%obj.isHuman() ) )
%this.attackObj = %obj; // closest human
// closest older friendly
if( %this.followObj == 0 && !%plr.isHuman() && %obj.id < %plr.getId() )
%this.followObj = %obj;
// closest friendly in a fight
if( %this.assistObj == 0 && !%plr.isHuman() && %obj.isFiring() )
%this.assistObj = %obj;
}
Basically what I did was to change definitions of closest attackable enemy to mean anything that is human, and I disregarded the arguments about what team any given ai player is on. Also for friendlies, anything non-human automatically becomes friendly.
Also, in aiPlayer.cs, I made this change at around line 884:
function AIPlayer::isTeammate(%obj, %team)
{
// make sure we are talking about a player
if( !AIPlayer::isHuman(%obj) )
return false;
else
return true;
}
Earlier, I also changed the number of ai players (team members) to 1 so that I ended up with two teams of one player each, because I was seeing a pretty significant performance hit with so many ai players (8) fighting by default. To know how to do this, check Daniel's directions.
Now I am working on making these guys chase me down more aggressively, instead of picking me off and taking their time as they are prone to doing.
Once again, Daniel and Mathew, awesome resource!
12/28/2006 (9:59 am)
Okay, I have something that seems to be working to make the two ai teams act like one, and really focus on attacking the human player. In AiAlgo1.cs, around line 917, make your code look like this:
// == Players
if( %obj.isPlayer() )
{
// closest/weakest attack target
if( (%this.attackObj == 0 ||
(%dist < $AIAlgo1::AttackClose && %this.attackObj.damage < %obj.damage)) &&
(%obj.isHuman() ) )
%this.attackObj = %obj; // closest human
// closest older friendly
if( %this.followObj == 0 && !%plr.isHuman() && %obj.id < %plr.getId() )
%this.followObj = %obj;
// closest friendly in a fight
if( %this.assistObj == 0 && !%plr.isHuman() && %obj.isFiring() )
%this.assistObj = %obj;
}
Basically what I did was to change definitions of closest attackable enemy to mean anything that is human, and I disregarded the arguments about what team any given ai player is on. Also for friendlies, anything non-human automatically becomes friendly.
Also, in aiPlayer.cs, I made this change at around line 884:
function AIPlayer::isTeammate(%obj, %team)
{
// make sure we are talking about a player
if( !AIPlayer::isHuman(%obj) )
return false;
else
return true;
}
Earlier, I also changed the number of ai players (team members) to 1 so that I ended up with two teams of one player each, because I was seeing a pretty significant performance hit with so many ai players (8) fighting by default. To know how to do this, check Daniel's directions.
Now I am working on making these guys chase me down more aggressively, instead of picking me off and taking their time as they are prone to doing.
Once again, Daniel and Mathew, awesome resource!
#30
01/10/2007 (5:03 pm)
Awesome resource! Thanks! I'm gonna enjoy tinkering with this one! :)
#31
02/09/2007 (10:00 am)
I am having trouble getting this to work in with the TGE 1.5 + AFX verison.
#32
02/15/2007 (8:53 pm)
Still have not been able to get this to work. one of the issues is that is gives an error saying it's inubale to start the aimanager. Has anyone been able to test this with 1.5 +AFX?
#33
04/05/2007 (9:08 pm)
I'm trying to get this to work as well. If anyone has tested this with TGE 1.5.1 and got it working, let me know please.
#34
scripts/aiplayer.cs (0) Unable to find parent object PlayerBody for PlayerData.
can someone help me out?
04/08/2007 (8:00 am)
I get the error, scripts/aiplayer.cs (0) Unable to find parent object PlayerBody for PlayerData.
can someone help me out?
#36
//-----------------------------------------------------------------------------
// DemoPlayer datablock used by AIPlayer
//-----------------------------------------------------------------------------
datablock PlayerData(DemoPlayer : LightMaleHumanArmor)
{
shapeFile = "~/data/shapes/spaceOrc/player.dts";
category = "bot"
shootingDelay = 2000; // just a place holder
};
04/26/2007 (6:55 am)
Hey Joseph, I got the same error and the problem is that the datablock in aiplayer.cs is looking for an object file to place in the scene. Here is a quick fix which allows you to at least run the game, but nothing else works for me :S Around line 104 you will see this code. Just add shapeFile = blah blah to it and put it in some sort of category like "bot".......Hope that helps//-----------------------------------------------------------------------------
// DemoPlayer datablock used by AIPlayer
//-----------------------------------------------------------------------------
datablock PlayerData(DemoPlayer : LightMaleHumanArmor)
{
shapeFile = "~/data/shapes/spaceOrc/player.dts";
category = "bot"
shootingDelay = 2000; // just a place holder
};
#37
I got into the game. But my bots are nowhere. What am i suposed to do?
04/26/2007 (7:39 am)
thanks man.I got into the game. But my bots are nowhere. What am i suposed to do?
#38
I love this resource and I've modified it a lot. Kork doesn't run around like a whacko anymore, he will follow his path or stay in one spot if there isn't one close. If he is under fire, he will crouch down, have a look around, and if he doesn't see a player he will run to his friend and alert him. The friend will follow him back to the under fire location and they will hang out ther until something happens. He wil reload when his magazine is empty. He will also surrender to the player if the player's weapon is pointed at him before Kork could detect him and the player has told him to "freeze". Good stuff.
05/08/2007 (11:28 am)
@joseph: read the posts before. near the end of aiplayer.cs, there is an AIManager::think() function. Make sure that your paths are named like it is referenced in the function. Then, just type AIManager::think() into your console and everything should work as expected.I love this resource and I've modified it a lot. Kork doesn't run around like a whacko anymore, he will follow his path or stay in one spot if there isn't one close. If he is under fire, he will crouch down, have a look around, and if he doesn't see a player he will run to his friend and alert him. The friend will follow him back to the under fire location and they will hang out ther until something happens. He wil reload when his magazine is empty. He will also surrender to the player if the player's weapon is pointed at him before Kork could detect him and the player has told him to "freeze". Good stuff.
#39
==>AIManager::think();
fps/server/scripts/aiPlayer.cs (1021): Unable to find object: '' attempting to call function 'init'
fps/server/scripts/aiAlgo1.cs (199): Unable to find object: '' attempting to call function 'getShapeName'
fps/server/scripts/aiAlgo1.cs (200): Unable to find object: '' attempting to call function 'getPosition'
fps/server/scripts/aiPlayer.cs (1023): Unable to find object: '' attempting to call function 'schedule'
fps/server/scripts/aiPlayer.cs (0): Unable to find object: '' attempting to call function 'schedule'
Mapping string: MsgClientKilled to index: 14
Mapping string: SPAWNS: Algo %1, Brain %2 to index: 15
My bots still do not apear. Can some one help me out please?
05/08/2007 (3:19 pm)
Now i get this message in the console.==>AIManager::think();
fps/server/scripts/aiPlayer.cs (1021): Unable to find object: '' attempting to call function 'init'
fps/server/scripts/aiAlgo1.cs (199): Unable to find object: '' attempting to call function 'getShapeName'
fps/server/scripts/aiAlgo1.cs (200): Unable to find object: '' attempting to call function 'getPosition'
fps/server/scripts/aiPlayer.cs (1023): Unable to find object: '' attempting to call function 'schedule'
fps/server/scripts/aiPlayer.cs (0): Unable to find object: '' attempting to call function 'schedule'
Mapping string: MsgClientKilled to index: 14
Mapping string: SPAWNS: Algo %1, Brain %2 to index: 15
My bots still do not apear. Can some one help me out please?
#40
Also, what does the number after Path 1 do?
// Create player object
%haveSpawned = true;
%team = (%index % 2) + 1;
switch( %index )
{
case 0:
%plr = AIPlayer::spawnOnPath("Evil Brain","MissionGroup/Paths/Path1", 1);
%algo = AIAlgo1::create(%plr, $AIPlayer::DebugLevel);
%algo.isHumanFriendly = false;
case 1:
%plr = AIPlayer::spawnOnPath("Evil Algo","MissionGroup/Paths/Path1", 0);
%algo = AIAlgo1::create(%plr, $AIPlayer::DebugLevel);
%algo.isHumanFriendly = false;
case 2:
%plr = AIPlayer::spawnOnPath("Evil Id","MissionGroup/Paths/Path1", 0);
%algo = AIAlgo1::create(%plr, $AIPlayer::DebugLevel);
%algo.isHumanFriendly = false;
default:
if( %index % 2 == 0 )
{
%path = "MissionGroup/Paths/Path1";
%plr = AIPlayer::spawnOnPath("Brain" @ %index, %path, -1);
%algo = AIAlgo1::create(%plr, $AIPlayer::DebugLevel);
%algo.isHumanFriendly = false;
}
else
{
%path = "MissionGroup/Paths/Path1";
%plr = AIPlayer::spawnOnPath("Algo" @ %index, %path, -1);
%algo = AIAlgo1::create(%plr, $AIPlayer::DebugLevel);
%algo.isHumanFriendly = false;
}
}
05/18/2007 (7:37 am)
I need to have multiple teams so I edited the AI manager and it seems to work, but can anyone tell me what the default portion of this code does?Also, what does the number after Path 1 do?
// Create player object
%haveSpawned = true;
%team = (%index % 2) + 1;
switch( %index )
{
case 0:
%plr = AIPlayer::spawnOnPath("Evil Brain","MissionGroup/Paths/Path1", 1);
%algo = AIAlgo1::create(%plr, $AIPlayer::DebugLevel);
%algo.isHumanFriendly = false;
case 1:
%plr = AIPlayer::spawnOnPath("Evil Algo","MissionGroup/Paths/Path1", 0);
%algo = AIAlgo1::create(%plr, $AIPlayer::DebugLevel);
%algo.isHumanFriendly = false;
case 2:
%plr = AIPlayer::spawnOnPath("Evil Id","MissionGroup/Paths/Path1", 0);
%algo = AIAlgo1::create(%plr, $AIPlayer::DebugLevel);
%algo.isHumanFriendly = false;
default:
if( %index % 2 == 0 )
{
%path = "MissionGroup/Paths/Path1";
%plr = AIPlayer::spawnOnPath("Brain" @ %index, %path, -1);
%algo = AIAlgo1::create(%plr, $AIPlayer::DebugLevel);
%algo.isHumanFriendly = false;
}
else
{
%path = "MissionGroup/Paths/Path1";
%plr = AIPlayer::spawnOnPath("Algo" @ %index, %path, -1);
%algo = AIAlgo1::create(%plr, $AIPlayer::DebugLevel);
%algo.isHumanFriendly = false;
}
}

Torque Owner game4Rest
colyd studio
BTW, bots do not fire at me after adding to my project. In the default mission they worked OK. But when I added them into my project, the bots didn't fire.
strangely, if I equip the bots with crossbows, they fire at me. But if I change their crossbows with other guns they don't fire. I have no idea what differences are there between crossbow and the other guns.
I believe they have same system. Then why this happen?
Would someone let me know why this happens?
Thanks in advance,
Hongjin