Well first of all I wouldn't know what caused the fps drop, but it seems unlikely the change you made fixed it
As anything between parens ( and ) is executed first in a line,
!(isAlive self.enemy && self cansee self.enemy 4000 90)
would first evaluate
(isAlive self.enemy && self cansee self.enemy 4000 90)
to 1 or 0 and then the ! would simply change the 1 to a 0 or vice versa.
So basically the conditions checked by the game are exactly the same in either method...
Anyway I think the root of your problems is a slight misunderstanding of the holster and unholster commands. If you tell an AI to holster, he won't hold
any weapons untill you tell him to unholster again. Hence, in yoru case, you shouldn't want your AI to hoster, but change his weapon to a p38 instead.
Now I gotta confess that I have little experience with changing a weapon 'on-the-fly', but I think it's best to use the gun command:
Code: Select all
while(isAlive self)
{
if!(isAlive self.enemy && self cansee self.enemy 4000 90)
self gun "weapons/p38.tik"
else
self gun "weapons/kar98.tik"
waitframe
}
If this doesn't work, use the weapon command instead, like this:
Code: Select all
while(isAlive self)
{
if!(isAlive self.enemy && self cansee self.enemy 4000 90)
self weapon "walter p38"
else
self weapon "mauser kar 98k"
waitframe
}
Be advised however that this may actually alter the equipment of the AI (depending on which TIKI you are using).
Anyhow it's probably a good idea to improve the script a bit, so that the guy doesn't 'get' a new weapon each frame.
You could for example try this:
Code: Select all
while(isAlive self)
{
if !(isAlive self.enemy && self cansee self.enemy 4000 90)
{
self weapon "walter p38"
while (isAlive self && !(isAlive self.enemy && self cansee self.enemy 4000 90))
waitframe
}
else
{
self weapon "mauser kar 98k"
while (isAlive self && isAlive self.enemy && self cansee self.enemy 4000 90)
waitframe
}
//waitframe // shouldn't need this no more :)
}
I got a bit confused along the way

so you might have to swap the p38 and mauser lines
