GameSalad

Spawning Actors at Random every 2 seconds in a repeat cycle

Hi,

First time writing in the forum.

I am currently working on windows.

I have 4 different actors that I would like to spawn separately at random every 2 seconds.

I have tried watching YouTube tutorials but can’t find a clear tutorial on how to do it.

For example create a random appearance as per list below.

Actor 1
Actor 2
Actor 1
Actor 3
Actor 1
Actor 4

How can I achieve this?

Thanks

Comments

  • SocksSocks London, UK.Posts: 12,711Member
    edited May 16

    Make an attribute, let's call it 'X'.

    Timer
    --Every 2 seconds
    ----Change X to random (1,4).

    When X is 1
    --Spawn Actor 1

    When X is 2
    --Spawn Actor 2

    When X is 3
    --Spawn Actor 3

    When X is 4
    --Spawn Actor 4

  • aidanshaw92aidanshaw92 Posts: 17Member

    Thanks, ill give this a go and let you know how I get on> @Socks said:

    Make an attribute, let's call it 'X'.

    Timer
    --Every 2 seconds
    ----Change X to random (1,4).

    When X is 1
    --Spawn Actor 1

    When X is 2
    --Spawn Actor 2

    When X is 3
    --Spawn Actor 3

    When X is 4
    --Spawn Actor 4

  • aidanshaw92aidanshaw92 Posts: 17Member
    edited May 16

    Im also fairly new to game salad, so still picking up the processes.

    I have created an Integer attribute called 'X'

    Timer
    -- Every 2 seconds
    --- Change Attribute
    ---Game.X to Random(1,4)

    Where do I put in 'when x is 1'

    Thanks

    @Socks said:
    Make an attribute, let's call it 'X'.

    Timer
    --Every 2 seconds
    ----Change X to random (1,4).

    When X is 1
    --Spawn Actor 1

    When X is 2
    --Spawn Actor 2

    When X is 3
    --Spawn Actor 3

    When X is 4
    --Spawn Actor 4

  • MusicBoutiqueMusicBoutique Posts: 65Member
    edited May 16

    You might find this video helpful - it will cover the whole process.

    ps: create an actor - call it for example spawner. inside the spawner create all the rules mentioned by @Socks (when x is 1 -- spawn actor 1 etc...)
    then place the 'spawner' actor anywhere on your game scene.

  • aidanshaw92aidanshaw92 Posts: 17Member
    edited May 16

    Thanks, That worked perfectly!

    @MusicBoutique said:

    You might find this video helpful - it will cover the whole process.

    ps: create an actor - call it for example spawner. inside the spawner create all the rules mentioned by @Socks (when x is 1 -- spawn actor 1 etc...)
    then place the 'spawner' actor anywhere on your game scene.

Sign In or Register to comment.