I am trying to get an animal (Max) follow you after the player picks up a specific item (Meat) but it doesn’t seem to work… this is the code that I have written for it, it would be a huge help if anyone could answer this for me!
After taking Meat: if MaxMove is false: now MaxMove is true
if MaxMove is true: Every turn: if the location of Max is not the location of the player: let the way be the best route from the location of Max to the location of the player; try Max going the way; otherwise: say “Max looks at you with his adorable eyes, licking his lips… That meat does smell good…”
if MaxMove is true can’t be the the start of a rule; a rule has to be introduced with a phrase which says which rulebook it’s part of. Fortunately, every turnis a rulebook, so you can swap those two lines and have it do what you want. Here’s a minimal working example:
Lab is a room.
Store is south of Lab.
Max is an animal in Lab.
Meat is a thing in Store.
MaxMove is a truth state that varies.
After taking Meat:
if MaxMove is false:
now MaxMove is true
Every turn:
if MaxMove is true:
if the location of Max is not the location of the player:
let the way be the best route from the location of Max to the location of the player;
try Max going the way;
otherwise:
say “Max looks at you with his adorable eyes, licking his lips… That meat does smell good…”
Of course, you don’t actually need the MaxMove flag, because you can key directly off the player carrying the meat:
Every turn when the player carries the meat:
if the location of Max is not the location of the player:
let the way be the best route from the location of Max to the location of the player;
try Max going the way;
otherwise:
say “Max looks at you with his adorable eyes, licking his lips… That meat does smell good…”