Trying to kill a player

Viktoriia
19 Feb 2021, 06:24

So I am not sure how to do this. I want my player to die once she has gone into these 3 rooms: The living room, the Basement, and the lawn. Do you know how can I achieve that?

So once she enters these 3 rooms at different times she dies.


K.V.
19 Feb 2021, 12:07

Hello.

One solution is to create a turn script with a script like this:

if (room1.visited and room2.visited and room3.visited){
  msg("You and your friends are dead.")
  finish
}

REFERENCES

https://docs.textadventures.co.uk/quest/attributes/visited.html

https://docs.textadventures.co.uk/quest/scripts/msg.html

https://docs.textadventures.co.uk/quest/scripts/finish.html


Viktoriia
20 Feb 2021, 05:14

When I press run the script there is an option to add turn script but within that tells me:
Run script after a number of turns or
Suppress turn scripts.

Which one should I go for? And how exactly can I write that?


mrangel
20 Feb 2021, 11:52

On the 'scripts' tab of the game, there is a section at the bottom to add turnscripts. These are scripts that run after every action the player takes, so you can use them to check for things that you don't know when they will happen.

In this case, I don't think you need a turnscript. Having visited all 3 rooms will always become true when the player enters the third room. So on the 'enter' script for each of those rooms, you can just check if they've already been in the other two.


Viktoriia
20 Feb 2021, 23:56

Oh makes sense. Thank you so much. This was truly helpful.