How do I

Get help using Construct 2

Post » Sat Sep 24, 2016 6:44 am

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.
B
6
S
1
Posts: 44
Reputation: 484

Post » Sat Sep 24, 2016 5:08 pm

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))

Then add an event below that (or perhaps a sub event, depending on your task):
Compare Variable "objectPicker" == 1: Create object 1
Compare Variable "objectPicker" == 2: Create obejct 2
B
19
S
7
Posts: 161
Reputation: 1,751

Post » Sat Sep 24, 2016 9:19 pm

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".
B
51
S
24
G
6
Posts: 391
Reputation: 7,820

Post » Sat Sep 24, 2016 10:15 pm

Gearworkdragon wrote: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.
B
196
S
109
G
7
Posts: 134
Reputation: 19,439

Post » Sun Sep 25, 2016 3:44 am

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.
B
51
S
24
G
6
Posts: 391
Reputation: 7,820


Return to How do I....?

Who is online

Users browsing this forum: jkmalau and 16 guests