Hey gang. I’m still messing around creating monsters with cool characteristics just for fun. I was watching some folks play COD prop hunt, and I decided to make a creature that does something similar. It wanders around occasionally changing it’s printed name to the things around it and using this disguise to steal your stuff (carrying up to two items). That part works, but whenever I try to get the player to interact with the imposter, the player cannot do this because the player does not know the imposter’s true name. So if my imposter looks like a dresser for example, I would like “open dresser” to be met with something interesting, like the dresser running away in a random direction. The trouble is, if there isn’t an object in the room with the same name as the printed name of the imposter, I get a parser error (can’t take what isn’t there- something to that effect) and the action never executes, and if there IS such an object, then the player only ever interacts with the real object. I can’t even correct this with “instead of doing something to a dresser” because if there’s no dresser around, that action never happens.
I have two blocks of code below. The first one is the code I’m using to make the imposter, the second one is one example of a failed solution to my problem.
the imposter is a man in the bedroom.
The printed name of the imposter is "coin". The indefinite article is "a";
To have the imposter take a turn:
if the imposter randomly decides to act:
[the function that does the random-acting came mostly from Gavin Lambert, who helped me out in an earlier question on this forum. This is found elsewhere in my code with a few modifications. Thanks friend!]
if the player is in the location of the imposter:
if the player is not carrying nothing:
now the imposter carries a random thing carried by the player;
say "Your pockets suddenly feel lighter.";
if the imposter carries three things:
try the imposter dropping a random thing;
otherwise:
have the imposter transform;
have the imposter wander; [wander code also comes partly from the help y'all gave me in a previous question. Thanks guys, you rock!]
to have the imposter transform:
let NEAR be the list of things in the location of the imposter;
sort NEAR in random order;
now the printed name of the imposter is "[entry 1 of NEAR]";
So all of that works. Awesome! But I have tried a bunch of methods to get the player to interact with the imposter, all of which fail. I can’t even remember most of them, but here’s just one example::
Instead of taking something while the player is in the location of the imposter:
let N be the printed name of the imposter;
if the noun is N:
try taking the imposter
[at this point, I could make some rules about what happens instead of taking the imposter]