Using array for random spawner

The way I had set up the code previously, it only allowed for one planet to be spawned and only that one. Meaning that there was no variation, making the game stagnant. I watched a tutorial which showed how to add objects to the variable which I called “Item Spawner”. However I ran into a problem which would not allow me to add either planet onto it, even though the variable type was an actor class reference but it would not allow to select both actors.

Array Variable.JPG

using sequence and gate.JPGShane helped me out using his method, which consisted of using a sequence and a gate note attached to a delay of 2 seconds.

switch on int.JPGThis then allowed the sequence to switch on integer which allowed it to randomly pick between the two planets by using spawn actors.

Adding planets.JPGHowever, I then found out how to get the array variable to work. By deleting the planet variables from the side it allowed me to select the planets and add them to the item array. using array with ineger.JPGI then got the item array node and got the get node allowing me to attach a random integer in range node, which means that I can randomise the planets from what I selected in the array. Then I attached the get node into the class.

My next step is to add more planets to allow more variation. Though I could however have the material be randomly picked along with scale, instead of me individually using planet actors every time I want a different style or material. This would save time considerably and be a more efficient process.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s