Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Scripting Vs Variables : Random Encounters

11 years ago

In a storygame I'm making, I plan on have some random encounters. I'm wondering which is a better way to go:?scripting or variables? 

 

Right now, I'm working on variables for each type on encounter. I plan on have a dice roll on a link click. Then have a link show on the next page that will correspond to the earlier roll. 

 

Quick example 

You walk into a forest.

*Link* Continue (this would be where the roll happens)

 

You're walking through the forest.

*link* Continue (this would be the visible link that corresponds to the number rolled)

 

As you're walking along the forest, you hear a young girl screaming. (random encounter)

*link* You investigate

*link* You run

*link* You sing along to the beautiful music of her scream

 

You run away. Whatever made that girl scream is not going to get you too.

*link* Continuing through the forest 

 

Would scripting be easier and less work? I'm planning on having upwards of 20 different things able to happen in an encounter.

 

Scripting Vs Variables : Random Encounters

11 years ago

I think you would need a variable even if you used scripting. I suppose your current plan is to have a lot of different links, which only show up when you roll a specific number. If you used scripting you could have one link with a script, which rolls the dice and then sends you to different pages depending on the result. 

Whether you consider that easier is up to you.

Scripting Vs Variables : Random Encounters

11 years ago

You can't make random encounters using just variables...

If you want to make random encounters, you can either put the random encounters in the global link script, or in specific link scripts where you want the random encounters to occur.

For example:

If you want to put the random encounters in the global link script or specific link scripts:

%ROLL := 1D30

IF %ROLL = 1 THEN

BEGIN

$DEST := @P1

END

 

IF %ROLL = 2 THEN

BEGIN

$DEST := @P2

END

 

IF %ROLL = 3 THEN

BEGIN

$DEST := @P3

END

The above basically says that if the roll of dice is 1, it will take take you to page 1. If the roll of dice is 2, it will take you to page 2. If the roll of dice if 3, it will take you to page 3. I hope this helps.