NPC in multiple rooms

Is there a simple way to put an NPC “man” into multiple rooms? I’m sure someones asked this question before, but I’ve been searching around and haven’t found anything. You can’t seem to do…

Bob is a man.
Bob is in bedroom, den and basement.

Thanks in advance. This forum has been very helpful to me while making my first game. Programming these has been really fun!

You can’t have one thing in more than one location simultaneously. You can either make Bob teleport into each room before the player enters, or make Bob a kind, which will let you place multiple (but separate) Bobs.

Making bob teleport to the rooms before the player enters:

After going to bedroom: now Bob is in bedroom; continue the action. After going to den: now Bob is in den; continue the action. After going to basement: now Bob is in basement; continue the action.

To do the second option of placing multiple bobs of the same “bob” kind:

Bob is a kind of man. One Bob is in bedroom. One Bob is in basement. One Bob is in den.

For the second option: remember that if two or more bobs enter the same room, you will probably see something like “You can see two Bobs here.” Be careful about your Bob placement if they are mobile.

Awesome! Thanks!

Sorry, I was a bit hasty in my examples. I have edited the post with an improved version which will take into account failed attempts to enter the rooms. (in case there is a locked door or something else prevents the player from moving.)

Much appreciated.

Just out of curiosity, what’s with Bob, anyway? Is he a follower? Blazing fast at zooming into rooms before you get there? Some kind of magic man?

Also, how did no-one nab the username Zork until feb 2012? :smiley:

You could do this like this.

Carry out going (this is the move bob rule): move bob to the room gone to.

Saves having to write a rule for every single room.

You could also make Bob a backdrop, like so.

Bob is a backdrop. Bob is everywhere.

Hope this helps.

How about something like this:

A room can be bob-holding. A room is usually not bob-holding.
The bedroom is bob-holding. The den is bob-holding. The basement is bob-holding.

Each turn: If the location is bob-holding, move bob to the location.

(This makes a difference if there are ways other than a “go” action that the player might move between rooms. Make sure this rule runs after any rules that might move the player.)

You can also change whether a room is bob-holding with this method. (If a room can go from bob-holding to not bob-holding, add on a clause like “otherwise, remove bob from play”.)

Thanks everyone. Bob isn’t really a character per se. My game takes place in a city, and I’d like to color it with lots of “extras” - basically characters just being in a place and cycling through some funny dialogue. So, I figure, why program twenty different winos when I can make one wino and put him in twenty different places.

As to the Zork thing, yeah, I was pretty surprised too.

@climbingstars - I was going to use the backdrop option, but was curious if there was a better way.