# How do I Make randomized enemies?

Get help using Construct 2

### » Wed Mar 16, 2016 2:17 pm

for example my boss will spawn every 70 seconds. But there is four boss types and each of them has a 1/4 chance of appearing. This means every 70 seconds a random boss will be picked for the player to fight. I also want to do the same with enemies, for example a enemy convoy has a 1/67 chance of spawning in place of a fighter plane. how do i do that?
B
6
Posts: 46
Reputation: 336

### » Wed Mar 16, 2016 3:02 pm

For the boss part you can every 70 seconds set a variable to either 1,2,3 or 4 which we do by using "Choose(1,2,3,4)". The choose "command" will pick any of the numbers that we insert in the parenthesis.

Then we create a subevent to check which variable we have received and make actions accordingly.

I'm not so sure what you mean by "spawning in place of a fighter plane". But if you want something to have a 1/67 chance for something to happen you can use the same principle but use int(random(66))

Why it's not Int(random(67)) is because the 0 is also accounted for when using random (Someone correct me if i'm wrong).

Maybe try something like this?

EDIT: 1 Oooops... The Convoy and the Fighter plane should change place in the image below. Right now it's 1/67 to spawn a fighter plane instead of a convoy.
B
14
S
5
G
1
Posts: 32
Reputation: 1,038

### » Thu Mar 17, 2016 10:25 am

thanks for all your help! I've been trying to figure this out for months! thanks! c;
B
6
Posts: 46
Reputation: 336

### » Fri Mar 18, 2016 3:26 pm

wait a second! everytime i type in to set randomspawn to (1,2,3,4) I get a syntax error! help
B
6
Posts: 46
Reputation: 336

### » Fri Mar 18, 2016 3:27 pm

oh wait, nevermind.
B
6
Posts: 46
Reputation: 336

Return to How do I....?

### Who is online

Users browsing this forum: facecrime and 18 guests