[SOLVED]How do I randomly spawn things

Get help using Construct 2

Post » Mon Aug 15, 2016 8:03 pm

I want to know how to spawn things very random, meaning that I want them to spawn at a random time and a random distance from each other. I have been playing around with it and I can't figure out a way to do it, but if there is someone out there who can show me or give me a tutorial or even a guide please do.
Help Me :shock:
Last edited by TheOriginalEpic on Wed Aug 17, 2016 7:01 pm, edited 1 time in total.
B
13
S
3
G
1
Posts: 8
Reputation: 1,330

Post » Mon Aug 15, 2016 9:40 pm

Here, try these tutorials out.

https://www.scirra.com/tutorials/383/ra ... -intervals
https://www.scirra.com/tutorials/456/ra ... off-screen
https://www.scirra.com/tutorials/566/sp ... ntra-style

I think they should help you achieve what you want. Post a capx of your attempt if you can't get it to work and we'll try and troubleshoot it. I typed in "spawn random" in the tutorials page and found those 3. There are probably others and probably different combinations of words you can use to find others too!
B
30
S
15
G
22
Posts: 183
Reputation: 14,221

Post » Mon Aug 15, 2016 10:38 pm

Thank You for the help dude I'll go and check them out
The video games love me so I love them and its probably the only reason I want to create them.
B
13
S
3
G
1
Posts: 8
Reputation: 1,330

Post » Mon Aug 15, 2016 11:01 pm

Message: TheOrigianlEpic can only post plain text URLS until they have 500 rep. 3 URLS modified. Why?
heyguy wrote:Here, try these tutorials out.

https://www.scirra.com/tutorials/383/ra ... -intervals
https://www.scirra.com/tutorials/456/ra ... off-screen
https://www.scirra.com/tutorials/566/sp ... ntra-style

I think they should help you achieve what you want. Post a capx of your attempt if you can't get it to work and we'll try and troubleshoot it. I typed in "spawn random" in the tutorials page and found those 3. There are probably others and probably different combinations of words you can use to find others too!


Thank you dude tutorial No. 2 worked sorta :D
The video games love me so I love them and its probably the only reason I want to create them.
B
13
S
3
G
1
Posts: 8
Reputation: 1,330

Post » Tue Aug 16, 2016 4:52 am

Message: TheOrigianlEpic can only post plain text URLS until they have 500 rep. 4 URLS modified. Why?
heyguy wrote:Here, try these tutorials out.

https://www.scirra.com/tutorials/383/ra ... -intervals
https://www.scirra.com/tutorials/456/ra ... off-screen
https://www.scirra.com/tutorials/566/sp ... ntra-style

I think they should help you achieve what you want. Post a capx of your attempt if you can't get it to work and we'll try and troubleshoot it. I typed in "spawn random" in the tutorials page and found those 3. There are probably others and probably different combinations of words you can use to find others too!



https://mega.nz/#!CE8SBCKC!vXBoCnNz_i90 ... L4MZ60XDew
here is the file of me trying to do stuff
Last edited by TheOriginalEpic on Tue Aug 16, 2016 9:01 pm, edited 1 time in total.
The video games love me so I love them and its probably the only reason I want to create them.
B
13
S
3
G
1
Posts: 8
Reputation: 1,330

Post » Tue Aug 16, 2016 7:28 am

Tried but I can't download the file. Try dropbox or google drive maybe?
B
30
S
15
G
22
Posts: 183
Reputation: 14,221

Post » Tue Aug 16, 2016 9:08 pm

Message: TheOrigianlEpic can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
heyguy wrote:Tried but I can't download the file. Try dropbox or google drive maybe?


Alright here's the dropbox:
https://www.dropbox.com/s/jll5xj0j9pbyr41/Random%20Spawning%28Demonstration%29.capx?dl=0
Last edited by TheOriginalEpic on Wed Aug 17, 2016 6:58 pm, edited 1 time in total.
The video games love me so I love them and its probably the only reason I want to create them.
B
13
S
3
G
1
Posts: 8
Reputation: 1,330

Post » Wed Aug 17, 2016 9:00 am

I have seen your capx, but i do not understand what you try to do.

So, let me tell you some basics.
Lets say we trow dices. Now the randomness depends on how much times you try.

So if you really want true randomness, the you got to try a lot. To do this in c2, try this.

Global variable 'timer' ... number .. = 0
Global variable 'Pick_Ups' .. number .. = 0

condition > system > every tick
action > system > set value ... variable = 'timer' ... value = floor(random(1,5))
action > system > set value ... variable = 'Pick_Ups' ... value = floor(random(4,31))

condition > system > every x second ... interval=timer
sub condition > system > compare two values ... 1st value = Pick_Ups .. = .. 2d value = 5
condition > system > once while true
action > create on random places
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Aug 17, 2016 6:08 pm

99Instances2Go wrote:I have seen your capx, but i do not understand what you try to do.

So, let me tell you some basics.
Lets say we trow dices. Now the randomness depends on how much times you try.

So if you really want true randomness, the you got to try a lot. To do this in c2, try this.

Global variable 'timer' ... number .. = 0
Global variable 'Pick_Ups' .. number .. = 0

condition > system > every tick
action > system > set value ... variable = 'timer' ... value = floor(random(1,5))
action > system > set value ... variable = 'Pick_Ups' ... value = floor(random(4,31))

condition > system > every x second ... interval=timer
sub condition > system > compare two values ... 1st value = Pick_Ups .. = .. 2d value = 5
condition > system > once while true
action > create on random places


Thank you for the help I tried your idea but ya know mines sort of better in a way
You see in mine I set the objects to spawn at a random time and place and it never stops
But with yours it only spawns the object once because of the trigger once while true condition
thanks for the help though :D
The video games love me so I love them and its probably the only reason I want to create them.
B
13
S
3
G
1
Posts: 8
Reputation: 1,330

Post » Wed Aug 17, 2016 7:10 pm

Yours spawns 2000 objects (as long as the value is 5), wich is a rare case, because of the 'add'.
Mine 'we mine means' spawns once when the value is 5 and then not till it is again 5, that is what 'once while true' means.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Next

Return to How do I....?

Who is online

Users browsing this forum: Bobbyneal100, Euduardo, Kin, mickclarke, tinhofiel, TRMG and 42 guests