Dynamic events, and how to do it

It’s probably worth plotting out the types of conditions you want to use. Off the top of my head I can think of:

  1. Fixed boolean: You met this person, or you went to this location, or you found this item, etc.
  2. Value based trigger: You’ve collected x of this, you’ve been on 3 dates, you’ve done 5 missions
  3. Pure random: Something like I described above
  4. Moderated random: You use the random generator, but you augment it (boost or reduce odds of things happening, prevent the same thing happening twice, etc.)

From what you have said, I suspect you want a mix of all 4. The key thing is to keep it simple - you want to design a pattern which you can then slot any event chain into by creating the requisit variables.

1 and 2 above are functionally identical. You just track them in slightly different ways. Something like this:

DEFAULT SCENE

*if HasClue true
    *goto_scene InvestigateClue

*if TotalDates = 3
    *goto_scene BoatDate

*if (HasCane true) and (CrimeScenesVisited = 5)
    *goto_scene InspectorVisit

You arrive back at your apartment and consider your next move

#Check out the next crimscene
    *goto_scene Crimescene4

#Ring Diana
    *goto_scene DianaDate3

You’ll need more control variables I imagine, but this is the basis of fixed boolean and value based control

Now, how to add in randomness to either:

  1. Pick a random scene to override the default
  2. When an option is picked, pick a random scene from a pool (e.g. there’s 10 crime scenes, pick one)

I am literally creating this as I go, so let’s see what happens.

For 1, we can use this code:

*create Wheel1 0
*create Wheel2 0
*create Wheel3 0

*rand Wheel1 1 50
*if Wheel1 < 10
    Wheel 1 fires
    *finish

*rand Wheel2 1 50
*if Wheel2 < 5
    Wheel 2 fires
    *finish

*rand Wheel3 1 50
*if Wheel3 < 25
    Wheel 3 fires
    *finish

Default scene fires

You then insert what happens for each wheel. Now the problem is that the outcome is currently fixed.
How do we randomise the scene that is played?

Here is the straightforward method, which will grow and grow for every scene you have in the pool.

STARTUP:

*create Wheel1 0
*create Wheel2 0
*create Wheel3 0

*create Wheel1scene false
*create Wheel2scene false
*create Wheel3scene false
*create Wheel4scene false
*create Wheel5scene false

*rand Wheel1 1 50
*if Wheel1 < 40
    *gosub_scene wheel1
    *finish

*rand Wheel2 1 50
*if Wheel2 < 5
    Wheel 2 fires
    *finish

*rand Wheel3 1 50
*if Wheel3 < 25
    Wheel 3 fires
    *finish

Default scene fires

WHEEL 1:

*temp Wheel1
*rand Wheel1 1 5

*if (Wheel1 = 1) and (Wheel1scene = false)
    *set Wheel1scene = true
    *goto_scene wheel1scene

*if (Wheel1 = 2) and (Wheel2scene false)
    *set Wheel1scene = true
    *goto_scene wheel2scene

*if (Wheel1 = 3) and (Wheel3scene false)
    *set Wheel1scene = true
    *goto_scene wheel3scene

*if (Wheel1 = 4) and (Wheel4scene false)
    *set Wheel1scene = true
    *goto_scene wheel4scene

*if (Wheel1 = 5) and (Wheel5scene false)
    *set Wheel1scene = true
    *goto_scene wheel5scene

Again you’ll need more control variables in there I imagine - this is just the basic method.
You don’t need more than one ‘wheel’ - if you want all of your scenes to sit in the same pool.
The wheel method lets you set and augment the chance of different types of scenes occur and of course you can merge in the fixed boolean and value based conditions also.

As long as the subroutines have an exit clause/loop in case they hit scenes that can’t be played.

Following the link above, this is very similar to the solution suggested in there. Mine is very rough as I made it as I was typing - I have tested it though!

4 Likes