Move NPC inside enterable container

I have a dog that follows the player wherever they go, which works fine.

However at one point of the game the player has to get inside an enterable container, I want the dog to get in too (we have to hide while something happens), I tried the following which complies but it only moves the player.

Instead of entering wheelie bin:
Move player to wheelie bin;
Move dog to wheelie bin.

Does this work?

instead of entering wheelie bin:
now dog is in wheelie bin;
continue the action.

How about:

Every turn when [dog-following condition is met] and the player is enclosed by a thing (called the entrapment):
    if the dog can see the entrapment:
        try the dog entering the entrapment.

I figure you’ve got something similar to make the dog follow the player from room to room; this just extends that to enterable containers and supporters. (Rooms are not things, so this doesn’t fire for those, but does fire for rideable animals, vehicles, and so on.)

The original code works for me in a minimal example.

Lab is a room.  A dog is in the Lab.

The wheelie bin is an enterable container in the Lab.

Instead of entering the wheelie bin:
	move the player to the wheelie bin;
	move the dog to the wheelie bin.

Have you tried running the code with “rules” and “actions” on in order to see exactly what’s happening? (That is, type “rules” and “actions” at the command prompt.)

For what it’s worth this also works with slightly different messages:

Carry out entering the wheelie bin:
	now the dog is in the wheelie bin.

Though if you do something along the lines of Daniel’s suggestion, trying the actual action with the dog, you’ll get a more sensible default message about the dog entering the bin… which you probably will want to customize anyway.

Thanks both, I went with Daniels solution as it generates the text flavour I want, works a charm.

1 Like