is it possible to get random from two array cells

0 favourites
  • 7 posts
From the Asset Store
This is a Dungeon Master tool & the 1st of 12 Combat Engines from the Building Combat Engines for Browser Games workshop
  • so i have a weapons spreadsheet(array) that has two numbers for attack damage: min attack damage, and max attack demage.

    im trying to get a random number between the two , but not succeeding.

    i tried whats bellow but it gives me an error.

    any ideas ?

  • Aren't they the same number? Anyway, what's the error?

  • oh i forgot to change that in the screenshot,but yeah with the diferent cell it still crashes

    Is there something wrong with the expression?

  • Oh I thought you meant an error in the editor. An assert I dunno, are the values in the array definitely numbers? Try int() around the calculation to convert it if it produces a number as a string.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Oh I thought you meant an error in the editor. An assert I dunno, are the values in the array definitely numbers? Try int() around the calculation to convert it if it produces a number as a string.

    awsome dude ! yes that worked, your an angel!

    weird, it worked with just one int for the first array call, i put the second one to see what happens.

    the first part was seen has a string and the second part a number?

    now its giving me a preety big numbers, gonna see if i can convert it to a float or something, but its not very important, dont think i intend to show the numbers to the player.

  • Not sure what you mean on the first bit, but on the big number do you mean it's decimal places? You can use round(random(x,y)) to make it a whole number.

  • Not sure what you mean on the first bit, but on the big number do you mean it's decimal places? You can use round(random(x,y)) to make it a whole number.

    oh just meant this.

    round, worked flawlessly!, thanks again.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)