Page 1 of 1

AI Alarms Tut problem

Posted: Sat May 24, 2003 9:06 pm
by Otto
I've just worked through the AI Alarms Tutorial. Everything works almost -but the AI won't switch on the alarm. I've got pathnodes in place but the AI just ain't interested. The player can switch on the alarm and the alarmspawners come right on cue but that isn't quite what I'm looking for! The script is exactly as the tutorial. I've checked and double checked. What actually triggers the AI to go to the alarm and switch it on?

Thanks in anticipation.

Otto

PS on another issue entirely why do the spawners sometimes appear to be killing themselves? :shock:

Posted: Sun May 25, 2003 5:26 am
by mohaa_rox
give it a targetname of "enemy"

Posted: Sun May 25, 2003 10:11 am
by Otto
OK, thanks, but that's in the tutorial and I've already done it. The enemy AI doesn't move to the alarm switch. As the player moves toward the AI the AI will engage the player (i.e. fire at him) rather than move towards the alarm. Any other ideas?

Thanks again

Otto

Posted: Sun May 25, 2003 10:31 am
by mohaa_rox
did u set up pathnodes leading to the alarm?

Posted: Sun May 25, 2003 2:52 pm
by Otto
Yes I put pathnodes leading to alarm. Do i have to put any key/values in them?

Thanks

Otto

Posted: Sun May 25, 2003 3:10 pm
by bdbodger
ok here is what I think may be happening . First some lines from the alarmer script
local.range = 5000
....
...
local.temprange = vector_length (self.origin - $alarm[local.i].origin)
if ((local.temprange < local.range) && (vector_length ($player.origin - $alarm[local.i].origin) > local.temprange))
local.temprange is the distance from the ai to the alarm switch . so the first part says is the distance to the alarm less than 5000 .
&& = And . The next part says is the distance from the player to the alarm greater that the ai distance to alarm . If these things are true the script goes on to set a 12 second timer .
while ((isalive self) && (local.break == 0) && (level.time < local.timer))

The script then checks to see if the ai reaches the alarm within the 12 seconds if so he pulls the alarm . Farther down in the script it checks to see how far the player is from the ai and sets that as the local.range . So what does this mean , well if the distance to the alarm is less that the distance to the player and is the ai closer to the alarm than the player and the ai cansee the player he should be trying to ring the alarm . but if the distance to the player becomes less that the distance to the alarm the ai will attack the player instead .

I hope this helps good luck

Posted: Sun May 25, 2003 9:06 pm
by Otto
Thanks for that. I've got it working of a sorts as now I think I know what actually triggers the AI to act. :lol: If anything the enemy AI was too close to the alarm! The AI was really reluctant to move to the alarm - the player had to goad him into it! It worked better when I moved the AI away from the alarm a bit and now I have three AI that will move and set the alarm off. But they are still somewhat reluctant/slow to act as they still want to fight rather than run to the alarm. Is there anyway I can speed their reaction up a bit and force them to the alarm? If he's good the player can take them all out before they reach the alarm.

Another issue i mentioned is that the spawners appear to be killing themselves - lots of groaning going on behing the wall - so i hope that's what happening! Any ideas how I can fix this?

Thanks for all your help, much appreciated.

Regards

Otto