x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Help with Arrays

Hey guys, hope I can get some help with this.

alt text

I made this blueprint essentially to spawn enemies (actor blueprints) at certain locations. These locations are set using actors on the main level, then added to an Array. The Array is called to randomly get an actor from the Array's range, and spawn an enemy at that actor's location. This all works fine.

What I need help with is this: I want to call an actor from the Array at random, but then make it so that particular actor won't be called again until all of the other actors have been called randomly. Once all actors have been called, I'd like to "rinse and repeat", once again randomly calling actors from the Array and excluding them from further calls until the rest have all been called.

I hope what I'm asking makes sense. Cheers.

Product Version: UE 4.8 Preview
Tags:
clipboard02.jpg (237.7 kB)
more ▼

asked May 26 '15 at 12:45 PM in Blueprint Scripting

avatar image

Inject4
8 2 3 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hi Mate

What I would do, is make 2 arrays.

One with what is left and one with what has been done.

As you pull one from an array, remove it from 1st array and ad it to the 2nd array.

When the 1st array is empty, refill it with the 2nd array and go again.

Narg

more ▼

answered May 26 '15 at 12:54 PM

avatar image

Narghile
1.6k 71 35 106

avatar image Inject4 May 26 '15 at 01:57 PM

Hey Narg! I was thinking of something very similar to that, but wasn't 100% sure.

It seems to work properly so far, thanks a lot for the help! :)

avatar image Inject4 May 26 '15 at 04:24 PM

Also, if it is of any interest to you or perhaps anyone who comes across this post, here is a link to the game I am making, and that your help was put towards Narg.

It's called Starfire for the time being: https://youtu.be/7QGBYAAXbqo

avatar image RAVaught May 26 '15 at 06:36 PM

It's unfortunate but UE4 currently doesn't support some other basic structures that would make this easier. Narghile's method is the best unless you are comfortable with C++.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question