How to randomly display players on spawners at the start of the game?

0 favourites
From the Asset Store
five golem elements Sprites Sheet.Best for enemy or villain game characters.
  • Almost already everything has been said in the title but I would add that:

    I tried to spawn the players in this way by creating a family gathering all the spawners.

    I gave the instruction "PlayerX -> go to spawners (the familly)" but it doesn't work because all the players appear in the same place...


  • You can use 'system pick a random instance of spawner > set position to spawner'. To ensure they don't spawn on the same one again you can use a variable. 'Pick a random instance of spawner, where spawner.var=false > set position spawner, set spawner.var=true'

  • It's probably a bit silly but I don't know how to program 'Pick a random instance of spawner, where spawner.var = false> set position spawner, set spawner.var = true'.

    For the moment I have just managed to have each player spawned on 1 spawn but it sometimes overlaps.

  • It's not really clear why you're using a family. Are all the spawners separate objects or are they instances of one object?

  • Each spawner is an object

  • Add a family instance variable, maybe a bool is good enough.

    On the left conditions add pick a random instance of 'family', its under system.

    Then add another condition with it, family compare variable family.var=false

    Then on the right actions say : family spawn player, and also another action family set variable to true.

  • This is what I had tried to do just before but weirdly it does not work.

  • Let's see a screenshot of the events

  • Of course:

    (there is a "on start of the layout" on the top)

  • This won't pick correctly, notice you are setting the position to a random instance and the variable is in a sub event. It should be pick random instance with the variable condition attached as the same condition not as a sub event. Then the 2 actions appear on the right of this. It should look like one block event for each player.

  • Yes I had to try it first but its working less well (sometimes a player did not appear)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If there are enough spawners in the level with variable set to 0 then it should work. If a player doesn't spawn then it likely cannot find a spawner. If it's still not working please post a screenshot of the new event structure after making sure enough spawners are in the layout.

  • Now verify that the 3 of them have the variable set to 0, and that the 3 player objects are also in the level? Also that the 3 of them are in the family (kind of confirmed by checking the variable anyway)

  • The conditions are backwards. You need to pick the Spawner_var=0 first, then pick a random one of those.

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