set

So my problem is trying to set things into random variables. Whenever I try it the thing ends up true whether or not you got that ending.
Example.

var randomnumber = function rng(min, max) {
return Math.floor(Math.random() * (max - min) + min);
}

set ("pig", randomnumber(1,2));

{if pig=1:
@set hello
My name is Kevin}
{if pig=2:
@setbye
My name is not Kevin}


Try this one. Seems to work for me.

    squiffy.getRndInteger = function(min,max){
        return Math.floor(Math.random() * (max - min + 1) ) + min;
    };

This is what I use. You can set your random number for odds. In mine I have a 1,3. So 1 out of 3 chance to kill, else you die.

[[spin]]:
<p>“Not today.”</p>
<p>You quickly spin as you take a knee, drawing your firearm.  You hip shoot and aim for the suspect’s stomach.</P>
[[Continue]](spin1)
[[spin1]]:
    var randomnumber = function rng(min, max) {
      return Math.floor(Math.random() * max) + min;

    }

    set ("kill", randomnumber(1,3));
    set ("life", get("life") + get("kill"));
{if kill=1:[[Not fast enough. The man had the jump on you and killed you to death.]](dead).}{else:[[What a rush. After a few quick shots, the man drops dead in front of you.]](alive1).}

Log in to post a reply.

Support

Forums