It has two behaviors, one for "working" wich is actually a loop of player commands that makes him go back an forth throught a room, and the second behavior is for fighting enemies. I use an AreaTrigger to detect when an enemy gets inside the room and it enables input for the doctor and clears his command queue.
The problem here is that I can't manage to get the first behavior triggered again when the room is clear and no alive enemies are inside.
This is my script, tell me if you need screenshots or something else.
//========================= // SCRIPT REGISTER OBJECTS //========================= private IPlayer p_doctor = null; // DOCTOR SPAWN //=================== public void DocSpawn(TriggerArgs args) { p_doctor = (args as CreateTriggerArgs).CreatedObject as IPlayer; } // DOCTOR STARTS WORKING //=================== public void StartWorkingLoop(TriggerArgs args) { IObjectTrigger WorkLoopTrigger = (Game.GetSingleObjectByCustomID("StartWorkingLoopTrigger")as IObjectTrigger); { p_doctor.SetInputEnabled(false); WorkLoopTrigger.Trigger(); } } // DOCTOR ALERTS NEARBY ENEMIES //==================== public void DoctorEnterFightMode(TriggerArgs args) { IObjectTrigger DoctorSpeechAlert = (Game.GetSingleObjectByCustomID("DoctorAlertSpeechTrigger")as IObjectTrigger); IObjectTrigger CheckDoctorLifeLoop = (Game.GetSingleObjectByCustomID("CheckLifeLoopTimer")as IObjectTrigger); { if (!p_doctor.IsDead && !p_doctor.IsInputEnabled) { p_doctor.SetInputEnabled(true); DoctorSpeechAlert.Trigger(); CheckDoctorLifeLoop.Trigger(); } } } // DOCTOR NEEDS HELP DURING FIGHT //==================== public void CheckDoctorLife(TriggerArgs args) { IObjectTrigger DoctorSpeechHelp = (Game.GetSingleObjectByCustomID("DoctorHelpSpeechTrigger")as IObjectTrigger); IObjectTrigger CheckDoctorLifeLoop = (Game.GetSingleObjectByCustomID("CheckLifeLoopTimer")as IObjectTrigger); { if (!p_doctor.IsDead && p_doctor.IsInputEnabled && p_doctor.GetHealth() <= 60) { DoctorSpeechHelp.Trigger(); CheckDoctorLifeLoop.SetEnabled(false); } } } // ENEMIES TRIGGER DOCTOR FIGHT MODE //==================== public void CheckEntrance(TriggerArgs args) { IObjectTrigger DoctorFightTrigger = (Game.GetSingleObjectByCustomID("DoctorFightTrigger")as IObjectTrigger); { if ((args.Sender is IPlayer) && ((IPlayer)args.Sender).GetTeam() == PlayerTeam.Team2 && !((IPlayer)args.Sender).IsDead) { DoctorFightTrigger.Trigger(); } } }