-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHealthExample.html
77 lines (54 loc) · 3.29 KB
/
HealthExample.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<!--Add health-->
<!--Example 1: adding health
A simpe health addtion code.-->
<h1>Healer's house</h1>
"Do you wish to be healed?" xey ask.
[["Yes please!"->Heal me!]]
--
<!--make sure the passage name in the goto matches up right to the passage name of the passages you make.
If you want the player to be able to heal themselves again, link to the last passage. In this case we fully heal the player each time they go to the
Heal me! passage.-->
<h1>Heal me!</h1>
(set: $health to 100)
You are fully healed!
[[Go back to the healers house->Healer's house]]
<!--Example 2: Consumable health items.
I'll make this fantasy themed later. For now I'm happy the code works.-->
<h1>Park</h1>
This park is a nice place to eat and test consumable items.
(If: $inv contains "Cone of chips")[Eat a ''cone of chips''?(click:"cone of chips")[(goto: "Yum1")]]
(If: $inv contains "Small fish and chips")[Eat a ''Small fish and chips''?(click:"Small fish and chips")[(goto:"Yum2")]]
(If: $inv contains "Large fish and chips")[Eat a ''Large fish and chips''?
(click:"Large fish and chips")[(goto:"Yum3")]]
<!--this makes it so if you don't have healing items, you can't heal-->
(else:)[You have nothing to eat.]
--
<!--make sure the passage name in the goto matches up right to the passage name of the passages you make.
If you want the player to be able to use up more items to add to their health, link to the last passage.
add the tags donotshowinventory and donotshowquest here so the player doesn't comsume a healing item each time they check their inventory from this passage and come back to the passage-->
<h1>Yum!</h1>
(set: $health to $health + 5)(set: $inv to $inv - (a: "Cone of chips"))
You eat the chips and feel better!
[[eat more?->Park]]
<!--Take health-->
<h1>Search the cave</h1>
{(set:$area to "Cave")}
The cave is dark but we're not doing lighting up an area if/else item query right now.
You want treasure do you...
[Check the rusty chest?]<1a|
<!--If you want to injure the player, health bars are static so to make the bar update, you have to send the player to a new passage. Remember to add the health removing code there.-->
(click:?1a)[(goto: "Ow!")]
<!--If you don't want the player to have the option to keep injuring themselves,
link them to another passage in this passage instead of the previous one that says something like 'I'm not sticking my hand in there again!' ect.
However if you feel mean you can have them choose repetedly to injure themselves without breaking the game by going back to the previous passage.-->
<h1>Ow!</h1>
<!--You will need to tag this hideinventory and hidequest for now to stop duplicate health removal. Not worked out a nicer way around this yet.-->
{(set:$health to $health -5)}
The chest is full of broken glass! Ouch. Who even does that?
[[check cave again?->Cave search]]
<!--Death.
To make the player die if their health reaches 0.
For this to work you need a passage called Death. You could link this back to the start of your game where you set variables to 0 to give players another chance.
Do not put this in the footer passage, it seems tempting to make sure you don't have to add it to every passage, but Twine won't like that.
You may want to add donotshowinventory donotshowstats donotshowquest and donotshowhr as tgas to the passage-->
(if: $health is <=1)[(go-to: "Death")]