Quantcast
Channel: Help! with 2.0 - Twine Forum
Viewing all articles
Browse latest Browse all 1844

[Twine 2.1.1][SugarCube 2.14] Traversing to a passage when a condition is met

$
0
0
Hey there!

I'm in the process of creating a way to automatically travel to a location without entering an infinite loop. Now, I've seen two methods of doing this. There's a topic about this, but I can't seem to find it (not even with google, the title must've been confusing). That concept showed using 'PassageHeader' (?, probably not, no idea...) and a boolean to send the player to somewhere else when an event is triggered.

I also remember TME posted a code, which enables one to override the next passage when a certain time has passed in game (event occurs):
This can be found here:
https://twinery.org/forum/discussion/8533/sugarcube-2-16-0-how-to-display-links-based-on-player-action-without-a-page-reload#latest

Does anyone know more methods of doing this?
Say, I have multiple quests going and I want to go to a passage when a quest is complete (an enemy is slain, a sword was picked up, you lost all your health and died, etc.). How do I manage these without conflicting?

I setup a quest system the following way:
<<set $equipEnchantedSilverSwordQuest =
{
	item: { name:"Enchanted Silver Sword", id: "enchanted.silver.sword" },
	character: $player
}>>
<<set $slayingCoboldSkeletonQuest =
{
	numEnemies: 8,
	enemyTypes: ["Cobold", "Skeleton"]
}>>
<<set $beThereOnTimeQuest =
{
        date: "20.12.428",
        time: "22:00"
}>>
<<set $silversword_log = 
{
	name: "Silver Sword Equip Quest Name",
	startPassage: "Quest - Equip Your Enchanted Silver Sword",
	onSuccess: {passage: "Battlegrounds", message: "Now go and slay some cobolds and skeletons"},
	questType: $equipEnchantedSilverSwordQuest,
	description: "This is a description for Quest - Equip Your Enchanted Silver Sword"
}>>
<<set $quest1_log =
{
	name: "Quest 1 Name",
	startPassage: "Quest 1 - Your Castle",
	onSuccess: {passage: "Party House", message: "congratulations for completing quest 1"},
	questType: $slayingCoboldSkeletonQuest,
	description: "This is a description for Quest 1"
}>>
<<set $returnBeforeNightfall
{
        name: "Quest - Return before nightfall",
	startPassage: "Quest 1 - Your Castle",
	onSuccess: {passage: "Couch - Resting", message: "You return your castle to rest until the morning."},
        onFailure:  {passage: "Graveyard - Game Over", message: "You've failed to return to your sanctuary before nightfall, your reward is death by cobolts and skeletons!"},
	questType: $beThereOnTimeQuest ,
	description: "This is a description for Quest - Return before nightfall"
}>>

// now of course you'd put these into an array and loop through them 

My question is, which special passage or Task Object would you use and how?

Viewing all articles
Browse latest Browse all 1844

Trending Articles