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"

Loop thru array and remove items/actors


Here is what im trying to do:

  1. Create array of actors

  2. Loop thru it every second and check if actor is above pawn

  3. If it is, then delete actor

Here is my implementation in BP, but logic is wrong and it doesnt quite work as expected. I know more or less whats wrong, but dont know how to fix it. Any tips ?

Another way would be to create multibox above pawn and kill on overlap. Before I try this approach I want to know how to do this with loops and arrays.


alt text alt text

Product Version: Not Selected
loop1.jpg (135.5 kB)
untitled.gif (1.4 MB)
more ▼

asked Mar 04 '15 at 05:40 AM in Blueprint Scripting

avatar image

73 9 13 15

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

1 answer: sort voted first

You need to use a ForEachLoop instead of a ForLoop. It's pretty self-explanatory and straightforward to use. It would help you get rid of all the "Get" nodes

more ▼

answered Mar 04 '15 at 11:34 AM

avatar image

2k 62 24 111

avatar image tas Mar 04 '15 at 05:29 PM

I tried to iterate backwards this loop, to fix deletion of wrong actors. If I use ForEachLoop and iterate forward, I get similar result. Wrong one. Do you see the issue on the anim gif ?

avatar image alperenakyuz Mar 15 '15 at 10:23 PM

I see the problem: it's because you're removing indices while within the loop. When you remove an index the entire array shifts, that's why it's skipping one.

avatar image jeffvoigt Jun 11 '15 at 07:00 PM

Makes sense and I've done this plenty of times in code but how are we supposed to decrement the current index using blueprint?

(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