ProjectX on 15/7/2005 at 15:19
Okay I created a guard, and gave him a sleeping link to a bed in an inn. I want to script it so that if the AI becomes alert, he unlocks his door and starts patrolling around, instead of sleeping.
I set up a script called LOCSleepWalk which included the following:
Condition:
[INDENT]When this AI becomes alerted[/INDENT]
This is the only condition I could find that seemed suitable.
Actions:
[INDENT]Patrol: Enter patrol path pointed to by a TriggerLink named [Wakey][/INDENT]
There is a patrol in his room leading him out of the door, the guard is linked to the first point by a trigger script named Wakey
[INDENT]Set [bIsLocked] to [False] on linked objects of [TriggerScript:Unlock][/INDENT]
There is a door in the room which is locked to begin with. The guard is linked to the door with a triggerscript link named Unlock
[INDENT]Disable Trigger script[/INDENT]
This stops the script running every time the guard is alerted.
Can anybody see any problems with what I've done?
Ziemanskye on 15/7/2005 at 16:42
Um, what's currently happening?
ProjectX on 15/7/2005 at 17:45
The guard gets up and walks around his room. The door stays locked, and the guard doesn't attempt to follow the patrol path.
Krypt on 15/7/2005 at 18:06
An easier way to do this might be to give the AI an actual key to the door. I believe you can add one to his weapon loadout. I believe he'll automatically use the key to open the door if he comes on one with a matching key tag. You could make a script to set the key to bOutofWorld on mapstart if you don't want the player to be able to grab it off his belt. If you set it up this way you should be able to just make a normal patrol path that goes through the door and it would work fine.
Also be sure to check the Navmesh going through the door to make sure the guy can get through it.
ProjectX on 15/7/2005 at 18:34
cool thanks