0 votes
asked by (2.4k points)
closed by

I want to make a basic if then statement for a death-reload mechanic...

(Unless: -Player is on "Dead"-)[
(If: $health < 1)[
(go-to: "Dead")
 ]
]

(once the player is on the death passage, they can reload to their last "save" and gain all their health)

The reason this is important is if I don't do this it will keep reloading death because of having no hp and saying unless history contains "dead" will mean dying twice will break the game.

I need something valid to replace "Player is on "Dead"

closed with the note: Got my answer.

1 Answer

+1 vote
answered by (131k points)
selected by
 
Best answer

You can use the (passage:) macro to obtain the name of the current passage being viewed.

(unless: (passage:)'s name is "Dead")[
	(if: $health < 1)[
		(go-to: "Dead")
	]
]

warning: The above example was written from memory, and it has not been tested.

commented by (2.4k points)

So what ended up happing is it worked, but going back "reloading" wouldn't work. So I made a small edit that fixed it.

(unless: (passage:)'s name is "Dead" or "Save point")[
	(if: $health < 1)[
		(go-to: "Dead")
	]
]

Again, you're the best.

commented by (131k points)

Your conditional expression is wrong, it should be.

(unless: (passage:)'s name is "Dead" or (passage:)'s name is "Save point")[
	(if: $health < 1)[
		(go-to: "Dead")
	]
]

 

Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...