# Dice having Different Variables

Get help using Construct 2

### » Mon Dec 03, 2012 4:54 pm

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.
B
4
Posts: 4
Reputation: 508

### » Mon Dec 03, 2012 7:06 pm

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.
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

### » Mon Dec 03, 2012 10:12 pm

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.
B
4
Posts: 4
Reputation: 508