I want to create what is, on the surface, a simple, minimalist game that opens up avenues and abilities as the player progresses. Trouble is, I don't even know where to begin. It kind of irritates me when software like this is advertised as being suitable for people with no programming knowledge, when in fact it's nothing of the sort. Twine might use its own language, but that doesn't mean it doesn't need learning.
Anyway, rant over. My game would unfold thusly:
1. Player starts of in a shack with only one option (which takes him outside)
2. When he's outside, he has two options (gather wood or return to the shack)
3. If he gathers wood, he'll then find that an option to start a fire and/or craft a weapon has been introduced when he returns to the shack.
4. If he crafts a weapon then goes back outside, he'll find the option to hunt for food has been added.
5. Then on returning to the shack the option to cook his catch will have been introduced (if he's lit the fire).
6. And so on and so on and so on.
Of course all this will require complex IFs and conditions, such as coding things so that once the fire has been lit, the option is removed, and that once he's hunted the option to hunt has been removed, etc etc.
I obviously don't expect anyone to create my game for me, but if someone could just get me started on how to code these complex conditions it would be very helpful.
Thanks in advance.
Comments
This greatly depends on what type of story and/or game you are trying to create, and how complex you want it to be. It is possible to build something like one of the Choose Your Own Adventure books without using any story variables or conditional programming logic. Based on your example you are trying to create a text-based Adventure / RPG with semi complex conditions on when an action is available or not.
The Twine application (1.x or 2.x) itself does not have it's own (programming) language, that is left up to the Story Formats to define its own language and feature set. This is why we ask people to state which Story Format (name and version) they are using because answer can be different for each one. Because you haven't stated which you are using I am going to assume you are using Harlowe.
On to the actual answers and suggestions.....
You can either use a variable or interrogate the story's History to determine if either something was done or a passage was visited. In the following example I will be using variables.
I would initialise some variables in the story's startup tagged passage to be used to track things like if the player has some wood or if they have lit the fire.. ... I would set the $hasWood variable to true in the Gather Wood passage to indicate that the player has some wood. ... I would check the current state of the $hasWood and $isFireLit variables in the Shack passage to determine if the fire can be or needs to be lit, and only show the relevant link if both are currently true. ... I would change the current state of the $hasWood and $isFireLit variable in the Start Fire passage to indicate that the fire has been started. Note that this action does not need to be a separate passage, it could be done within the Shack passage itself using a (link:) macro but the variable changes would still be the same. ... I would change the value of the $hasRawMeat variable in the Hunting passage.
I hope the above helps.
I'll look in Sugarcube's tutorial to see if it uses True/false rules. If so, I might be able to work it out from your instructions.
Initialise your variables in the StoryInit special passage like so: ... change the variable in the Gather Wood passage: ... check the variables in the Shack passage: ... change the variable in the Start Fire passage, or use a <<link>> macro:
If I make the Shack the first room by clicking the rocket icon, will the game still read those variables first?
Yes. The StoryInit special passage is automatically evaluated once during startup before any normal passages, so there is no need to link to it, call it, or otherwise display it.