How can i make action that kills npc and stops them from following me

Not my code but i can see it’s usefulness if only i can stop it once i kill it.

“High Stakes”

The Egyptian Collection is a room. The Hellenistic Collection is east of the Egyptian. The Roman Collection is east of the Hellenistic. The Modern Collection is east of the Roman.

Doctor Van Helsing is in the Modern Collection. [Don’t ask why.]

Every turn:
if the location of Van Helsing is not the location of the player:
let the way be the best route from the location of Van Helsing to the location of the player, using doors;
try Van Helsing going the way;
let the distance be the number of moves from the location of Van Helsing to the location;
if distance is:
– 0:
say “The Doctor stares at you, while pulling a wooden stake from under his cloak.”;
end the story;
– 1:
say “You can hear the Doctor’s footsteps approaching.”;
– 2:
say “You wonder where the Doctor is. Then, you hear a distant voice shouting your name. It is his.”

Test me with “showme helsing / z / showme helsing / z / showme helsing / z”

First, add a condition to check:

Van Helsing can be alive or dead. Van Helsing is alive.

Then, check it:

Every turn when Van Helsing is alive:

And finally, change it:

Instead of attacking Van Helsing when Van Helsing is alive:
    say "You slay the vampire hunter!";
    now Van Helsing is dead.
4 Likes

Thanks, Draconis, for the learning, you did it more efficiently than I would have!

2 Likes