# How do I

0 favourites
• 5 posts
• Hello, could anyone help me out? I want system to pick and create one out of two objects onto the layout whenever a task is completed. Thanks for your anticipated help.

• You can create a variable called "objectPicker" and assign it to 0 (so it doesn't pick anything) and then when the task is done you can add an action:

Set Value "objectPicker": int(random(1, 3))

Compare Variable "objectPicker" == 1: Create object 1

Compare Variable "objectPicker" == 2: Create obejct 2

• ## Try Construct 3

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

Construct 3 users don't see these ads
• One thing id like to point out if say if two of the item are either common found item or super mega rare. you could in theory do this choose(1,2,3,4,5,6,7,8,9,10)

and have it compare like if chosen number is less then or equal to 9 use common

if it did choose 10 then use super mega rare

The choose just simple roll the dice of ten number while random uses likes 1.83434239472893472347 and 2.8409804854 number and the Int just whack off the .83434239472893472347 number

And keep in mind that the Int will alway return the value as a positive so if you need a negative number dont use "int".

• One thing id like to point out if say if two of the item are either common found item or super mega rare. you could in theory do this choose(1,2,3,4,5,6,7,8,9,10)

and have it compare like if chosen number is less then or equal to 9 use common

if it did choose 10 then use super mega rare

The choose just simple roll the dice of ten number while random uses likes 1.83434239472893472347 and 2.8409804854 number and the Int just whack off the .83434239472893472347 number

And keep in mind that the Int will alway return the value as a positive so if you need a negative number dont use "int".

Instead of 'choose(1,2,3,4,5,6,7,8,9,10)', can you use 'floor(random(1,10)) instead? I'm just asking in order to figure out how the events work since I've theorized about something similar for creating rare items.

• you could, it just a demo to show the dice roll and how it would work and if memory serve me right The different in the two is that the Random has like a billion number to choose from since it will use 1.989+ while choose would just use ten possible outcome. Which I find it more controllable.

Cause there is times when i need that one number to appear to know what the possible of chances when they will arrive at there......I never got close to a number or it would be too few or it would act the other way where it would choose nothing but 3.5 3.2 3.1 ...

which made me go nuts because the number was for the item and the event selector.... So yeah random does work good if it a non important value like gold or resource then it doesn't matter if you need certain probability to happen.

like for instance let say you need a flame enchant to deal blast damg but at a 10% chance

the Choose would give better result then random because sometime you never reach to the desire number only because the random thinks it giving a different but its doing dances around it like a silly orc but choose merely limit which number it has access to.

You could if you still want to use random to make rare to appear to happen rather then pure luck you could for every non rare obtain you can lower the max value to a point lower to reduce the billion number it has to choose all teh way down to 1 so that the rare would spawn so that it show to exist rather then never obtain it. or least is what ive observe when using the two , choose and random mod.

• 5 posts