Randomization scripting help
So, I would just like someone to explain to me how all the random stuff works. You know:
int &randy = random(#, #)
if (&randy == #)
{
...
}
if (&randy == #)
{
...
}
Please, I want to make fit real good and I need to know how the random stuff works. The .chm file in the develop dir tells me nothing.
int &randy = random(#, #)
if (&randy == #)
{
...
}
if (&randy == #)
{
...
}
Please, I want to make fit real good and I need to know how the random stuff works. The .chm file in the develop dir tells me nothing.
Here, an example from my D-Mod:
&ouch = random(3,1);
if (&ouch == 1)
{
say("Ouch!", 1);
}
if (&ouch == 2)
{
say("Eep!", 1);
}
if (&ouch == 3)
{
say("Yelp!", 1);
&ouch = random(3,1);
if (&ouch == 1)
{
say("Ouch!", 1);
}
if (&ouch == 2)
{
say("Eep!", 1);
}
if (&ouch == 3)
{
say("Yelp!", 1);

The command random works like this:
random(range,base);
range: amount of possible outcomes, So if you fill in 3 there are three different possible outcomes. The base is the lowest of those numbers. So filling in:
random(3,70); will return 70, 71 or 72
random(2,0); will return 0 or 1
random(6,1); will return 1, 2, 3, 4, 5 or 6
random(3,-5); will return -5, -4 or -3 (never checked if the base could be negative though...
)
So for your script:
int &number = random(3,25); will return 25, 26 or 27.
if (&number == 25)
{
say("Yes, number is in fact 25",1);
}
if (&number == 26)
{
say("Yes, number is in fact 26",1);
}
if (&number == 27)
{
say("Yes, number is in fact 27",1);
}
random(range,base);
range: amount of possible outcomes, So if you fill in 3 there are three different possible outcomes. The base is the lowest of those numbers. So filling in:
random(3,70); will return 70, 71 or 72
random(2,0); will return 0 or 1
random(6,1); will return 1, 2, 3, 4, 5 or 6
random(3,-5); will return -5, -4 or -3 (never checked if the base could be negative though...

So for your script:
int &number = random(3,25); will return 25, 26 or 27.
if (&number == 25)
{
say("Yes, number is in fact 25",1);
}
if (&number == 26)
{
say("Yes, number is in fact 26",1);
}
if (&number == 27)
{
say("Yes, number is in fact 27",1);
}
Thanks alot. Huge help! You see, in fit, instead of the monsters always showing up on the same screen, I wanted it to be less predictable and make them show up randomly on a couple of screens. Thanks!