Remove NPC from play and give player an object

Hi there. I have a scene where the player gives part of a bomb to an NPC who then detonates the bomb, killing the NPC and helping the player find a treasure. I want the game, at this point, to remove the NPC (the Pirate) and give the item to the player (the Treasure). I thought:

remove the Pirate from play;
now the player carries the Treasure;

But neither of these worked. How do I get Inform to remove a man from the game. And how do I get to put an object into a player’s inventory?

Thanks for the help!

Sounds like my kind of scene!

I find having a store room handy.

[code]Store Room is a room.

Move the pirate to Store Room;
Move the treasure to the Player.[/code]

Should do the trick.

I got this error message with those commands:

“remove the X from play” is legit, though. Should work.
Or “now the X is off-stage”.

You have to wrap your code in a rule that tells Inform when it should happen. Something like this:

Instead of giving the detonator to the Pirate: say "'Arr, thank you,' says the Pirate. He inserts the detonator into the bomb, which promptly explodes, blowing him to smithereens. One gold coin flies up out of the mess and settles into your hands."; remove the Pirate from play; now the player carries the gold coin; remove the detonator from play. [since this is an "instead of giving" rule which stops the giving action from carrying out of its standard behavior, if we didn't do this the player would still have the detonator.]

Note that my initial spaces are really tab stops. You could also do some of this in an “After giving…” rule, if you change the “block giving rule” so that you can actually give the detonator to the Pirate – the Standard Rules have a rule that ensures that giving never works unless you change that rule (or special-case the instances where giving works with an Instead rule, the way I just did).

Also, it seems more likely that the treasure would wind up on the floor than in the player’s inventory! If you want that to happen change “now the player carries the treasure” to “now the treasure is in the location of the pirate”.

Only also see to it that you move the treasure from the pirate before you move the pirate off-stage (or you’ll move any treasure he carries off-stage with him).

As an aside: a while back there was a proposal for a shared world with a mutant/pirate theme, discussed in the mutant pirates thread and the google doc linked to in that thread. If you’re working on a pirate game maybe you’ll find it inspiring, maybe you even want to join in. Although honestly nobody ever finished a single game in that setting yet so it’s not really much of a shared world yet.