Okay, another newbie question. I seem to have a lot of these. I’m having a hard item figuring out how to make an npc actor perform an action. I just can’t find reference tot he appropriate syntax anywhere.
I’m having the player follow an npc actor into a building. I can get them through all of that, but there’s a locked door in between. How can I get the NPC to pause, unlock the door, and then continue leading the player into the building?
Thanks to anyone that’s taken the time to read this far.
I suspect the general approach to use would be to put the code for the NPC unlocking and opening the door in the arrivingTurn() method of the ActorState (probably a GuidedTourState) the NPC is in just after leading the player character to the location of the door. You could synthesize the NPC actions with newActorAction(), or you could just display some appropriate text and change the state of the door with makeLocked(nil) and makeOpen(true).
I haven’t actually tested this, but it might look something like:
specialDesc = "Algenon is waiting for you to follow him through the oak door. "
escortDest = oakDoor
stateAfterEscort = throughTheLockedDoorState
"Algenon whips out a large brass key, unlocks the huge oak door, and swings it open, gesturing for you to follow him through. ";