Random chance

I am trying to develop a game that relies heavily on random chance but the script I would have relied on seems to have been dropped from the selection.

If anyone can help, I need to input a code that relies on random chance (like a 20% chance or a 50% chance) of activating a script that will follow it.


game book or Text adventure???


RandomChance (A_ZERO_TO_ONE_HUNDRED_VALUE) 9 ( http://docs.textadventures.co.uk/quest/functions/corelibrary/randomchance.html )
GetRandomInt (MIN_VALUE, MAX_VALUE) ( http://docs.textadventures.co.uk/quest/functions/getrandomint.html )
GetRandomDouble () ( http://docs.textadventures.co.uk/quest/functions/getrandomdouble.html )
DiceRoll ("NUMBER_OF_DICEdNUMBER_OF_SIDES_ON_DICE") ( http://docs.textadventures.co.uk/quest/functions/corelibrary/diceroll.html )


if (RandomChance (75)) {
  msg ("There's a 75% chance you'll see this message")
} else {
  msg ("There's a 25% chance you'll see this message")
}

in GUI/Editor, you can do this (using the '[EXPRESSION]' script option to be able to type in the scripting you want):

run as script -> add new script -> 'scripts' section/category -> 'if' Script (see below)

if [EXPRESSION] RandomChance (75)
-> then, -> add new script -> blah blah blah
blah blah blach


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums