How do I Make randomized enemies?

  • 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?

  • 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.

  • thanks for all your help! I've been trying to figure this out for months! thanks! c;

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • wait a second! everytime i type in to set randomspawn to (1,2,3,4) I get a syntax error! help

  • oh wait, nevermind.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)