Make Your IF NPCs Move

Add the gifts of motion and conversation to your characters.

Adding NPCs to your Inform adventures ( [Hack #88] ) can make your game come alive. Of course, the more vivacious your characters, the better the illusion of reality. What’s missing is movement and speech.

Designing a Mobile Character

Let’s add another nonplayer character with a bit more zip than our sedentary access controller; how about a fearsome security daemon to smack our little spy around? Since you’ve already cast a shrieking beast as the access controller, let’s go another direction with the security daemon:

Object pixie "security daemon"
  with name 'security' 'daemon' 'pixie' 'melodious' 'chimes' 'gossamer'
            'wings',
    describe
        "^A security daemon is here, buzzing angrily around you.",
    description
        "The tiny security daemon darts around on gossamer wings,
        leaving a trail of melodious chimes in her wake.",
    before [;
        Listen: "She makes a lovely little racket as she swoops about.";
    ],
  has animate female;

Note that the player can refer to the chimes and the wings; it’s bad form to mention something and then have the game spit out a message saying You can't see any such thing. when the player tries to interact with it. On the other hand, the chimes and wings aren’t separate objects here because this encourages players to interact with them more extensively than needed. Plus, now both listen to chimes and listen to daemon produce the same message without any extra code.

You’ve probably also noticed the ...

Get Gaming Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.