Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Help with intertwining passages

So I am making a game and one of the features is a trader. Players will be able to buy supplies.
When I try to make it I can set up the different item's so that they are purchasable and are in different passages for example buying food gives you a different message different to when you buy clothes.
2 weeks worth of food: costs 100 gold
Apothecary supplies: costs 50 gold
Protective clothing for the whole group: costs 80 gold
A clump of rare precious metal: costs 120 gold
This is what I mean. How do I make it so that after they buy food and are greeted by this message:
Apothecary supplies: costs 50 gold
Protective clothing for the whole group: costs 80 gold
A clump of rare precious metal: costs 120 gold
Return to travelling
If they press on metal it displays food again, if people decided to pick metal first they get the chance to buy food, how can i make it so that once they've visited a passage they can't return there.
I apologize if it doesn't make sense.
I am using sugarcube just fyi

Comments

  • edited December 2016
    I'm not that experienced in Twine yet, so there may be easier ways to do it, but...

    One way would be to use variables. For example, $BoughtFood, $BoughtClothes, $BoughtMetal, $BoughtApothecary. If you have an initial Trader page that players can't return to, you can set those to 0 on that page, otherwise you'll have to figure out where (prior to shopping) it'd be best to do so. Then in your links (or first thing on the new page) you add in a
    <<set $BoughtXXX to += 1>>
    (with XXX being whichever they bought). Then when you list the links, you add an "if" condition.
    For example,
    <<if $BoughtMetal == 0>>
    	[[A clump of rare precious metal: costs 120 gold]]
    <</if>>
    

    That way, players won't see the link if they've already bought metal, since the variable in that case would be 1 instead of 0.

    If you need to use the same variables later for another shopping trip, you'll have to re-set them to 0 prior to that one.

    (Note: I mainly use Harlowe, so while I looked up the syntax for Sugarcube I'm not 100% sure I understood it completely ^^; )
  • Thank you so much, this is much better than anything I could have made
Sign In or Register to comment.