quick note:
"if (RandomChance (Value))" is the exact same thing (though it's a shortened, ie quest-code-understood, form of) "if (RandomChance (Value) = true)"
this is the same thing for Boolean Attributes:
"Object.visible" is the same as "Object.visible=true"
if you don't put the "=false", then it's understood to be "=true", by the quest engine
(I just like to write it out in full, for new people, and myself too, to see it correctly, to avoid any confusion that they, or me, may have, lol)
-----------------------
"RandomChance" is for, using an analogy, '1/1,000,000,000,000 chance of winning the lottery' = % chance of just a single choice being true (of occuring, ie 'winning')
example:
in a shuffled deck of cards, the chance of the top card being an Ace of Spades = whatever you set the percent "Value (0 through 100)" to in "RandomChance (Value)", you SET~DECIDE the ODDS of that single 'card' (choice~option~selection).
if (RandomChance (100) = true) {
-> // whatever script_1
} else {
-> // whatever script_2
}
// script_1 will always be executed, lol
if (RandomChance (99) = true) {
-> // whatever script_1
} else {
-> if (RandomChance (100) = true) {
->-> // whatever script_2
-> }
}
// there's a 99% chance that script_1 will be executed, but should the "1%" happen (lol), then there's a 100% chance that script_2 will be executed
if (RandomChance (99) = true) {
-> // whatever script_1
} else {
-> if (RandomChance (50) = true) {
->-> // whatever script_2
-> }
}
// there's a 99% chance that script_1 will be executed, but should the "1%" happen (lol), then there's a 50% chance that script_2 will be executed
if (RandomChance (99) = true) {
-> // whatever script_1
} else {
-> if (RandomChance (0) = true) {
->-> // whatever script_2
-> }
}
// there's a 99% chance that script_1 will be executed, and despite should the "1%" happen (lol), script_2 will *NEVER* be executed anyways
if (RandomChance (100) = true) {
-> // whatever script_1
} else {
-> if (RandomChance (100) = true) {
->-> // whatever script_2
-> }
}
// there's a 100% chance that script_1 will be executed, so despite script_2 having a 100% chance of executing, it will *NEVER* be executed because it never makes it to that code line, as it requires the *failure* of script_1 to be executed, but at 100% chance of success, there's 0% chance of failure, lol.
----
and we can make it include more than 2 choices~options~selections, too:
(the "50" Value has nothing to do with this, you can change each of the three "50s" to any Value between 0 and 100, though 0 and 100 will possibly wipe out parts of your scripting as I've shown already above, hopefully)
CONCEPTUALLY:
if (RandomChance (50) = true) {
-> // whatever script_1
} else {
-> if (RandomChance (50) = true) {
->-> // whatever script_2
-> } else {
->-> if (RandomChance (50) = true) {
->->-> // whatever script_3
->-> }
-> }
}
CORRECT SYNTAX~FORMAT:
if (RandomChance (50) = true) {
-> // whatever script_1
} else if (RandomChance (50) = true) {
-> // whatever script_2
} else if (RandomChance (50) = true) {
-> // whatever script_3
}
and if you want full functionality:
(I'm changing the Values to make it more clear for you)
// also, you need to understand this too about how RandomChance actually works:
// if (true_a=true_b), then do this_1
// if (false_a=true_b), then (CAN'T) do this_1
// if (false_a=false_b), then do this_2
// if (true_a=false_b), then (CAN'T) do this_2
// true_a = successful RandomChance (Value), otherwise if it fails, then it equals (returns): false_a
// for the "true_b" or "false_b", you type in what you want: "=true" or "=false"
//
// this probably just confused you... so let me give examples:
//
// if (RandomChance (100) = true)
// if (100% chance of being true = true)
// 100% chance of being true, means that it always RETURNS (or IS): true
// we thus (conceptually are) algebraically substituting out "RandomChance (100)" for placing in: "true"
// look at my colors of font to see this
// if (true = true), then do script
//
// if (RandomChance (50) = true)
// if (50% chance of being true = true)
// 50% chance of being true, means that it will 50% be "true" and 50% be "false", thus RETURNS (or IS): true (50%) or false (50%)
// we thus (conceptually are) algebraically substituting out "RandomChance (50)" for placing in: "true" (50%) or "false" (50%)
// look at my colors of font to see this
// if (true = true), then do script
// if (false = true), then (CAN'T) do script
//
// or another way of trying to explain it:
//
// if (RandomChance (100) = true) -> 100% SUCCESS (100% TRUE = true), it does script_1
// if (RandomChance (100) = false) -> 0% SUCCESS (100% TRUE -> 100% true = false -> ERROR!), it does NOT do script_1
//
// if (RandomChance (0) = true) -> 0% SUCCESS (0% TRUE -> 100% false = true OR 0% true = true -> ERROR!), it does NOT do script_1
// if (RandomChance (0) = false) -> 100% SUCCESS (0% TRUE -> 100% false = false), it does script_1
//
// if (RandomChance (50) = true) -> 50% SUCCESS (50% TRUE = true), it does script_1 only 50% of the time
// if (RandomChance (50) = true) -> 50% FAILURE (50% TRUE = true), it does script_1 only 50% of the time
//
// if (RandomChance (50) = false) -> 50% SUCCESS (50% TRUE -> 50% false = false), it does script_1 only 50% of the time
// if (RandomChance (50) = false) -> 50% FAILURE (50% TRUE -> 50% true = false), it does script_1 only 50% of the time
//
// if (RandomChance (75) = true) -> 75% SUCCESS (75% TRUE -> 75% true = true), it does script_1 only 75% of the time
// if (RandomChance (75) = false) -> 25% SUCCESS (75% TRUE -> 25% false = false), it does script_1 only 25% of the time
//
// if (RandomChance (25) = true) -> 25% SUCCESS (25% TRUE -> 25% true = true), it does script_1 only 25% of the time
// if (RandomChance (25) = false) -> 75% SUCCESS (25% TRUE -> 75% false = false), it does script_1 only 75% of the time
if (RandomChance (75) = true) {
-> // whatever script_1a
} else if (RandomChance (75) = false) {
-> // whatever script_1b
} else if (RandomChance (90) = true) {
-> // whatever script_2a
} else if (RandomChance (90) = false) {
-> // whatever script_2b
} else if (RandomChance (60) = true) {
-> // whatever script_3a
} else if (RandomChance (60) = false) {
-> // whatever script_3b
}
------------------
whereas, "GetRandomInt", is for, using an analogy, 'selection out of a collection of choices, such as playing rock paper scissors game' = the selection alogrithm of~for some number of choices
example:
in a shuffled deck of cards, the chance of the top card being an Ace of Spades = 1/52 odds + the algorithm (that is used by "GetRandomInt") the computer (well, quest, anyways) uses to determine what card will be at the top, which gets turned over.
(actual) example:
selection = ToString (GetRandomInt (1,3))
if (selection = "1") {
-> // script_1
} else if (selection = "2") {
-> // script_2
} else if (selection = "3") {
-> // script_3
}
~OR~
selection = ToString (GetRandomInt (1,3))
switch (selection) {
-> case ("1") {
->-> // script_1
-> }
-> case ("2") {
->-> // script_2
-> }
-> case ("3") {
->-> // script_3
-> }