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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How would I add a value to each element making it larger based on Array size?

Have a foreach loop on an array and would like to have a variable incremented for each individual array element but can't figure out where to do this at. When attempting to do it in the foreach loop it does to each item in the array. How do I go about adding a value to each element making it larger based on the array element.

Product Version: Not Selected
more ▼

asked Jul 11 '14 at 02:58 AM in Blueprint Scripting

avatar image

6 3 4 7

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

1 answer: sort voted first

Let me see if I understadn your question: Case1: You have an array of n elements. YOu are doing a for-each on this array. You want to increment a varibale (whcih is not a memerb of the array)in each loop iteration?

If this si your question, you can create an Int variable. Within the loop body, add 1 to this variable.

OR Case2: In each iteration you want to increment the array element in taht iteration. eg:

before: [1, 3, 5, 6, 9]

after: [2, 4, 6, 7, 10]

In this case you must add 1 to the curernt elemnt in question. You will get this as an output pin in the for-each loop.

Sorry if I mis-undertood.

more ▼

answered Jul 11 '14 at 03:18 AM

avatar image

3.4k 154 51 271

avatar image otaku0424 Jul 12 '14 at 02:19 AM

Are you talking about the Array Index int pin on the foreach block?

To clarify, say I have 5 elements in my array and am updating them in the foreach loop. One of the values is location. I want to within the loop have the value larger. So element 0 will be at 10, element 1 will be at 20, element 2 will be at 30 and so on.

avatar image otaku0424 Jul 12 '14 at 02:49 AM

From the foreach loop pulling from the array index pin did what I was looking for, thank you mindfane ^_^

(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