Page 1 of 1

AIs Not a lot of people know that

Posted: Mon May 12, 2003 10:44 pm
by Parts
or maybe you do!

I have been adding AIs to multiplayer maps and having one problem. This was that the AI would not discriminate between Axis and Allies. As soon as I did $AIPlayer.enableEnemy = 1 the AI would shoot at everyone.

I have now discovered what causes this. It would appear that every player is considered to be an american sentient no matter what side they are on. Therefore if you specify your AI as german ($AIPlayer german) he will shoot at everyone and if you specify your AI as american ($AIPlayer american) he'll shoot at noone.

However it looks like you can change the side of the player sentients, as far as can I have found so far there is no issue with this. The thread below defines the players sides:

Code: Select all

SetTeams:

	while (1)
	{
		for (local.i = 1; local.i <= $player.size; local.i++)
		{
			if ($player[local.i])
			{
				if ($player[local.i].dmteam == axis)
				{
	
					$player[local.i] german
				}
				else if	($player[local.i].dmteam == allies)
				{
					$player[local.i] american
				}	
			}
		}
		wait 5
	}
End
 
Seems to work quite well, thought it might be useful to someone.[/code]

Posted: Tue May 13, 2003 6:05 am
by jv_map
Yup this is because 'american' is defined in the base TIKI in the models/players/base folder.

Look in jv_mp_ai.scr of my bots scripts, you'll find something similar ;)

Code: Select all

/**
Makes the player targetable when he joins. Internal use.
*/
set_target:
	local.player = parm.player
	if(self)
		local.player = self
	local.player threatbias 0
	if(local.player.dmteam == axis)
		local.player german
	else
		local.player american
end

/**
Untargets the player. Internal use.
*/
set_notarget:
	local.player = parm.player
	if(self)
		local.player = self
	local.player threatbias ignoreme
end