Random 5 Help

Discussion in 'How Can I...?' started by shumekadventures, Aug 22, 2022.

  1. shumekadventures

    shumekadventures Boxer

    Joined:
    May 12, 2020
    Messages:
    10
    Likes Received:
    0
    The Random 5 Node is not working, and I really need a random 5+ node to finish a game, can anyone help me? I cant write code.
     
  2. shumekadventures

    shumekadventures Boxer

    Joined:
    May 12, 2020
    Messages:
    10
    Likes Received:
    0
    Reading a bit of Javascript manual I managed to do simple code:
    var rnd;
    function init(){
    }
    function start(){
    }
    function update(dt){
    }
    function signal(name, value, sender, source){
    var rnd = Math.floor(Math.random() * 5) + 1;
    /**/ if(rnd == 1) this.emitSignal('Out1', true);
    else if(rnd == 2) this.emitSignal('Out2', true);
    else if(rnd == 3) this.emitSignal('Out3', true);
    else if(rnd == 4) this.emitSignal('Out4', true);
    else if(rnd == 5) this.emitSignal('Out5', true);
    }

    With this randomly chooses a number between 1 and 5 and outputs a true signal. And it works well in ver. 3.4.9 so thanks. Reading can take you as far as you are willing to go.
     
  3. Elite Games

    Elite Games Avid Boxer

    Joined:
    Dec 18, 2019
    Messages:
    184
    Likes Received:
    84
    Its working
     

    Attached Files:

  4. shumekadventures

    shumekadventures Boxer

    Joined:
    May 12, 2020
    Messages:
    10
    Likes Received:
    0
    Thank you, for some reason is not working in my bbdoc, so I am using my little code and it works fine.
     
  5. Elite Games

    Elite Games Avid Boxer

    Joined:
    Dec 18, 2019
    Messages:
    184
    Likes Received:
    84
    If you are on latest version 3.4.9 its very buggy so its better to create custom logic rather then the built one. I am also facing issues with built-in nodes sometime they work.
     
  6. shumekadventures

    shumekadventures Boxer

    Joined:
    May 12, 2020
    Messages:
    10
    Likes Received:
    0
    Yes that is the version, and yes I had to do my own code.
     

Share This Page