making npcs do things

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.

Specifically:

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.

There are a couple of extensions that really help with these sorts of things. Check out the following:

http://inform7.com/extensions/Emily%20Short/Simple%20Followers/index.html

http://inform7.com/extensions/Michael%20Callaghan/Patrollers/index.html

This is just one solution of many.

Those are both for Inform though, aren’t they? I’m looking specifically for a tads3 solution.

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:

[code]

  • arrivingAtLockedDoorState: GuidedTourState
    specialDesc = "Algenon is waiting for you to follow him through the oak door. "
    escortDest = oakDoor
    stateAfterEscort = throughTheLockedDoorState

    arrivingTurn()
    {
    "Algenon whips out a large brass key, unlocks the huge oak door, and swings it open, gesturing for you to follow him through. ";
    oakDoor.makeLocked(nil);
    oakDoor.makeOpen(true);
    }
    ;[/code]

Yeah- I’m dumb- sorry.

That’ll do perfectly, thanks so much. As usual, I was frustrated because I was looking for the wrong solution. Learning curve.