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"

Variables in arrays

I'm currently figuring out switch mechanism for equipment, weapons etc, and I'm not sure how arrays work. My question is that if u store let's say "firstweaponmagazine" in array and then call it later when it already changed by reloading will it call the proper variable or just the value it had in the moment of storing it in the array? If it doesnt work this way is there a way to achieve this? Also is it possible to make array of arrays?

Product Version: Not Selected
Tags:
more ▼

asked Dec 23 '14 at 12:45 PM in Blueprint Scripting

avatar image

Skrzeku
50 3 8 14

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

What you store in an array is a reference to a variable. Not a value. This means it will always be the current value no matter where you changed it.

This also means you have to check if it's valid at all as it could be destroyed by the time you try to get it from the array.

If you want to have the variable at a specific moment you will have to create a new variable for this.

And no. As of yet multidimensional arrays (an array of arrays) is not possible right now in blueprint.

I hope this helps.

Cheers

more ▼

answered Dec 23 '14 at 12:54 PM

avatar image

Erasio
5.9k 291 86 293

avatar image Belven Dec 23 '14 at 12:57 PM

Looks like we answered at the same time.

(comments are locked)
10|2000 characters needed characters left

Hey, So something like this will store pointers to the objects, this means each variable stored in them will be update, i.e. the latest version of the variable. TArray myArray;

And I don't see why this wouldn't work: TArray> myArrayOfArrarys;

Hope that helps.

more ▼

answered Dec 23 '14 at 12:56 PM

avatar image

Belven
90 19 35 46

(comments are locked)
10|2000 characters needed characters left
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