Dice having Different Variables

0 favourites
  • 3 posts
From the Asset Store
Fully animated four sided dice, top down wooden tray and dice throwing cup
  • Hi,

    I'm attempting my first question because I'm either not seeing the proper tutorial, FAQ, or just plain not development-smart enough yet.

    Is it possible to have dice have different sets of numbers based on an object chosen, or do I have to make approximately 40 dice?

    Here is what I am trying to describe;

    Player chooses object A---dice are rolled Yahtzze-style. Player gets to keep certain dice for a total of 3 rolls/re-rolls.

    Player chooses object B......K. Each letter representing another object (really the same object but having different dice values).

    So for example sake: Object A variables 1-6

                            Object B variables 7-12

                            Object C variables 13-18

                            etc

    The dice are going to look the same, just be worth different values.

    Thank you for steering me in the right direction if this is possible.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • not sure I understand what you mean exactly.. but if you are wanting to retrieve the total out of a number of dice instances rolled you can do so like this:

    sum = 0   (local variable)

    +For each Dice

         >add Dice.result to Sum     (result being the dice roll, 1-6)

    however if you literally do want dice instances to have different values (I'm not sure why?) there would be a number of ways to do so with a private variable

    for example

    Dice.ID can be numbered 0,1,2,3..

    and in the events, after generating a random number 1-6 you can do:

    set Dice.Result to Dice.Result+(Dice.ID*6)

    That means dice with an ID of 0 will return 1-6.   an ID of 1 will return 7-12, an ID of 2 will return 13-18 etc etc.

  • I see where that would work. Thank you.

    I am looking for certain chosen objects to have a greater value of distance moved based on the dice roll, so what you described sounds like it would work perfectly as long as my multiplier works for all sides of the die. Hmmmmm......I'll have to calculate that one out.

    Thank you.

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