Hi everyone,
I'm building my first text adventure in Twine so apologies if this is something super basic that I haven't been able to grasp.
In my story I have both $HEALTH and $MORALITY which vary as you make choices and move through passages. I've managed to set $HEALTH and $MORALITY and I have figured out how to +/- both in the passages BUT:
When <<if $HEALTH < 1>> i.e. when the player dies due to his/her choices, I want the passage the player has died on to:
Display some text about the death in that particular passage AND remove the live links which are in the passage in case you do not die.
How do I do that? At the end of my (possible death) passages I have e.g.:
<<set $HEALTH = $HEALTH -40>>
<<if $HEALTH < 1>>
The assailants rescue a wounded Aaliya and take you on board as a companion. You go on to become a fairly successful gang member -- that is until turf wars over control of Lyari end with 12 bullets in your gut causing massive blood loss.
You are dead.
<<endif>>
[[not dead option 1 of passage still showing/clickable]]
[[not dead option 2 of passage still showing/clickable]]
Please help!
Comments
< becomes lt (Less Than)
> becomes gt (Greater Than)
<= becomes lte (Less Than or Equal)
>= becomes gte (Greater Than or Equal)
= becomes eq (EQual)
In SET it's not a problem and you can happily use
<<set $HEALTH = 100>>
and it will work, but you can't use<<if $HEALTH < 1>>
and you need to use<<if $HEALTH lt 1>>
(I've been using Twine for several months now and I still make this mistake occasionally).Anyway, the code you'd need is... Don't forget there's also <<ELSEIF>> as well if you wanted a kind of in between point so you could have... If you have a look at http://2yu.co/sewb you'll find a game called Super Epic Warrior Battle which is something I've been working on for a little bit, and if you play the first battle, watch out for when your enemy gets below 6 HP because then you'll be able to try a fatality. That's basically doing the above code that uses
<<elseif>>
.Hope that's helped.
This is only true for version 1.3.5 - in 1.4 they are the intended operators and function correctly (but I confess that the visual camouflage of the < and > symbols amid the macro's closing >> may make people prefer the original text versions).
(In detail: 1.3.5 had a bug where the ">" symbol couldn't be used anywhere inside macros, thus necessitating the use of "gt" - however, the "<" symbol did not have this issue.)
This is flat-out wrong - == becomes "eq", and = becomes "to". It's due to this incredibly common UI disaster that I do not endorse "eq" or "=" at all, and encourage "is" and "to" instead.
...
But your main point is correct: the top post need only add an <<else>> macro to produce their desired effect: