Thanks for the tip but I already managed to do it
Here's the script that worked in the end:
void main(){
object oNPC=GetObjectByTag("kor33b_belaya");
float x=88.44;
float y=-5.2;
float z=58.51;
int bRun=FALSE;
vector vExit=Vector(x,y,z);
location lExit=Location(vExit,0.0f);
object oDoor = GetObjectByTag("k33b_dor_academy", 0);
ActionPauseConversation();
SetLocked(oDoor, FALSE);
DelayCommand(4.0, AssignCommand (oDoor,ActionOpenDoor(oDoor)));
SetCommandable(TRUE,oNPC);
DelayCommand(0.0, AssignCommand (oNPC,ActionForceMoveToLocation(lExit,bRun)));
DelayCommand(7.0, AssignCommand (oNPC,ActionForceMoveToLocation(lExit,bRun)));
DelayCommand(8.5, AssignCommand(oDoor,ActionCloseDoor(oDoor)));
DelayCommand(8.5, SetLocked(oDoor,TRUE));
DelayCommand(11.0, DestroyObject(oNPC));
DelayCommand(3.5, ActionResumeConversation());
}
I also paused the conversation for 3.5 seconds to stop the player from cheating himself through a door that's supposed to be locked^^
But I have two new and somewhat related questions:
Is there a way to stack commands? What I mean is that for example, the first command forces an NPC to walk somewhere and the second one does something else. Is there a way to make it so that the second one is triggered only after the first command is done, i.e. the NPC has walked to his destination.
And the second question is: How do I make it so that a dialogue is triggered once the player is near enough?