Finalizing tutorial and creating final game example
This commit is contained in:
116
examples/tutorial.tw
Normal file
116
examples/tutorial.tw
Normal file
@ -0,0 +1,116 @@
|
||||
:: StoryTitle
|
||||
At the Duchess's Party
|
||||
|
||||
:: StoryData
|
||||
{
|
||||
"ifid": "BE18C022-A213-466C-8DD1-DCCD5CB1DF48"
|
||||
}
|
||||
|
||||
:: Story JavaScript [script]
|
||||
Config.passages.nobr = true; // Deal with linebreaks.
|
||||
|
||||
State.variables.reputation = 0;
|
||||
State.variables.playerKnowledge = {poetry: 0, industry: 0, astronomy: 0};
|
||||
|
||||
State.variables.characters = [
|
||||
{
|
||||
name: "Arabella Armstrong",
|
||||
poetry: 3, industry: 0, astronomy: 0
|
||||
},
|
||||
{
|
||||
name: "Blake Brookhaven",
|
||||
poetry: 0, industry: 3, astronomy: 0
|
||||
},
|
||||
{
|
||||
name: "Claudio Croix",
|
||||
poetry: 0, industry: 0, astronomy: 3
|
||||
}
|
||||
]
|
||||
|
||||
StoryManager.storylets["Conversation"] = {
|
||||
name: "Conversation",
|
||||
tags: ["circulating"],
|
||||
generate: function() {
|
||||
let storylets = [];
|
||||
for (let i in State.variables.characters) {
|
||||
let character = State.variables.characters[i];
|
||||
let storylet = {
|
||||
passage: "Conversation",
|
||||
description: "Talk to " + character.name,
|
||||
priority: 0,
|
||||
character: character
|
||||
|
||||
}
|
||||
storylets.push(storylet);
|
||||
}
|
||||
return storylets;
|
||||
}
|
||||
};
|
||||
|
||||
StoryManager.storylets["Buttonholed"] = {
|
||||
name: "Buttonholed",
|
||||
tags: ["circulating"],
|
||||
generate: function() {
|
||||
if (Math.random() < 0.2) {
|
||||
let char = randomChoice(State.variables.characters);
|
||||
return [{
|
||||
passage: "Being approached",
|
||||
description: "You see " + char.name + " approaching you.",
|
||||
interrupt: true,
|
||||
character: char
|
||||
}]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
StoryManager.storylets["Conversation topic"] = {
|
||||
name: "Conversation topic",
|
||||
tags: ["during conversation"],
|
||||
generate: function() {
|
||||
let storylets = [];
|
||||
for (let topic in State.variables.playerKnowledge) {
|
||||
if (State.variables.playerKnowledge[topic] > 0 |
|
||||
State.variables.talkingTo[topic] > 0)
|
||||
storylets.push({
|
||||
passage: "Conversation topic",
|
||||
description: "Talk about " + topic,
|
||||
priority: 0,
|
||||
topic: topic
|
||||
})
|
||||
}
|
||||
return storylets;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
:: Start
|
||||
You stand at the edge of the grand ballroom in the Duchess's palace.<br>
|
||||
<<set _possibleStories = window.SM.getStorylets(3, "circulating")>>
|
||||
<<ShowStoryletLinks _possibleStories>>
|
||||
|
||||
|
||||
:: Conversation
|
||||
<<set $talkingTo = $currentStorylet.character>>
|
||||
You talk with $talkingTo.name. <br>
|
||||
<<set _possibleStories = window.SM.getStorylets(3, "during conversation")>>
|
||||
<<ShowStoryletLinks _possibleStories>>
|
||||
[[Keep circulating | Start]]
|
||||
|
||||
:: Being approached
|
||||
$currentStorylet.character.name is coming toward you to talk. <br>
|
||||
You can [[talk to them | Conversation]], or risk snubbing them by [[trying to get away | Start]].
|
||||
|
||||
:: Conversation topic
|
||||
<<set $topic = $currentStorylet.topic>>
|
||||
<<if $playerKnowledge[$topic] < $talkingTo[$topic] >>
|
||||
<<set $playerKnowledge[$topic] = $playerKnowledge[$topic] + 1>>
|
||||
(They tell you about $topic) (Knowledge of $topic goes up)
|
||||
<<elseif $playerKnowledge[$topic] == $talkingTo[$topic]>>
|
||||
(You discuss $topic) (reputation goes up slightly)
|
||||
<<set $reputation = $reputation + 1>>
|
||||
<<elseif $playerKnowledge[$topic] > $talkingTo[$topic]>>
|
||||
(You tell them about $topic) (reputation goes up)
|
||||
<<set $reputation = $reputation + 2>>
|
||||
<</if>><br><br>
|
||||
|
||||
[[Keep circulating | Start]]
|
Reference in New Issue
Block a user