Howdy, Stranger!

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

Random Encounters based on passages

I've been playing around with the code form Dan Cox's tutorials and I've got it to where a player could advance from one room to another, but I'm having trouble getting the "Grue" event to only run when on the "init" passage.

Comments

  • You linked to the wrong video, the one with both the init and Grue example is the second video in the series.

    The init passage (0:48) in his example is used to setup the default values of all the $variables. Normally the way to do this in SugarCube is to create a special passage named StoryInit and to place the code to initialize your $variables in there, this special passage is automatically read at the start of your story so you do not need to <<display>> it (1:13) within your story's first passage.

    His statement that SugarCude does not have a random macro (6:45) is not fully correct, it does have a random function.

    His init passage does not directly causing the Grue event to happen as all it does is initialize the $attackNumber variable.
    The Grue Attack event is triggered by the random chance code within the Grue passage (6:06) and by the Grue passage being displayed by the <<display "Grue">> (8:52) within the Map System passage.

    So the Grue attacks wont happen until all the related coding has been done, which is around (11:30) in the video.
Sign In or Register to comment.