Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Random events

5 years ago

   Hey guys, are there some good example of a story game that has implemented random events? I have worked out a clunky way to do it with dice rolls and hiding/showing links based on dice results, but I am sure someone has done this a more elegant way already. For example, you are walking along a path, and baddies can randomly attack you. It is possible to walk the entire path and have no baddies show up. And the type of baddie is random. 

Random events

5 years ago
I'd make six different potential encounters (one or two having nothing bad happen) and in the link script just roll a 1D6 that reroutes you to the corresponding page.

You'll want to look at something like Dungeon Stompage or Delve! if you're going to have a lot of combat. Both are featured on the main page.

Random events

5 years ago

yeah i read Dungeon Stompage, died pretty quickly. I haven't decided what kind of battle system i want yet, or if I even do. But one idea i definitely want to incorporate is how previous paths and characters met influence future events without needing an entire story path. For instance, if previously in the story, u decide not to kill a young succubus, possibly later in the story that demon will randomly attack you. Those types of things will be global boolean variables, to let the story mechanism know that the character is available to appear later. A fluid interactive game experience. 

Random events

5 years ago
Wanting to do something similar on an old project is what got me to start learning scripting. There was a situation where you could kill or spare another character after a fight, and several choices down the road there would be consequences. The problem was I didn't want to have to have to copy and paste two versions of the game that were identical until then. The scripting was just the matter of toggling a variable that represented whether that character was alive or dead and checking it much later in a link script to send the player to the right page with $DEST. I don't think you'd need it to be global, at least not for the example you describe.

Scripting really does help a ton with organization and streamlining even when it's not being used in ways the reader will ever notice.

Random events

5 years ago

   Yes, i suspected my ultimate solution would be a script, and i expect there is a rng function i can call in script. And i see where i can create global link scripts. If i code it there, then i can generate random link redirects to force random encounters with potential previously encounter characters based on the boolean value. Just ideas floating around, i havent fleshed out how i would make this impact a story plot yet. 

Random events

5 years ago
Global scripts are checked literally any time the player clicks anything though. You'll most likely want to use link scripts instead, in places in the story where they're supposed to be encountering the events.

e: Oh. I just snooped a bit and I would really recommend going to the editor features under Storygame Properties and enabling advanced variables and scripting for that game.

Random events

5 years ago

thanks a ton. Yeah i found that setting already.  :)