AIs Not a lot of people know that

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Parts
Sergeant
Posts: 72
Joined: Thu Apr 10, 2003 12:35 pm
Location: UK
Contact:

AIs Not a lot of people know that

Post 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]
[VS-UK]Capt.Parts[BnHQ]
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post 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
Image
Post Reply