I'm working on an in-detail document on how Slender works in Slenderman's Shadow, and for one of his mechanics, it involves explaining how the "random" condition works.
Example from "random.fpi", the script used for the random player spawns in the Claustrophobia map
:state=0:etimerstart,dimvar=location,state=1
:state=1,random=3:plrmoveto=startloc1,setvar=$CAY -42,setvar=location 1,state=20
:state=1,random=2:plrmoveto=startloc2,setvar=$CAY 314,setvar=location 2,state=20
:state=1,random=1:plrmoveto=startloc3,setvar=$CAY 0,setvar=location 3,state=20
:state=1,random=0:plrmoveto=startloc4,setvar=$CAY 314,setvar=location 4,state=20
There are four possible locations for the player to spawn at, and all of them function.
Ched80's FPSC Syntax List PDF:
"RANDOM=X is true when a random number between 0 and X equals 0, i.e. random=1 gives a 50% chance of being true, whereas random=100 gives a 1% chance of being true."
If this was the case, startloc4 would've been true 100% of the time and therefore always spawn the player in location 4.
WikiBooks FPI Script article:
"RANDOM=X is true when a random value between 0 and X is equal to one"
If this was the case, startloc4 would've been true 0% of the time and therefore never spawn the player in location 4.
Not only am I confused why "random=0" has neither a 100% or 0% chance of being true, but I'm also unsure of how the following works:
From "random_chase.fpi" the script that triggers the chase mechanic, added in the Elementary map
:state=30,random=7,varless=distance 5:setvar=chase 1,sound=audiobank\Elementary\DemonicScream.ogg,setvar=explode 0,etimerstart,state=100
:state=30:etimerstart,state=100
:state=40,random=6,varless=distance 5:setvar=chase 1,sound=audiobank\Elementary\DemonicScream.ogg,setvar=explode 0,etimerstart,state=100
:state=40:etimerstart,state=100
:state=50,random=5,varless=distance 5:setvar=chase 1,sound=audiobank\Elementary\DemonicScream.ogg,setvar=explode 0,etimerstart,state=100
:state=50:etimerstart,state=100
:state=60,random=3,varless=distance 5:setvar=chase 1,sound=audiobank\Elementary\DemonicScream.ogg,setvar=explode 0,etimerstart,state=100
:state=60:etimerstart,state=100
This script also uses "random", but with the values 3, 5, 6 and 7. How exactly does that work? Does it just pick a random number out of each value of random (i.e., randomly pick either 3, 5, 6 or 7)?
Other than that, I have a decent understanding of how everything else should work.