Download

Getting Actor Variables From An Array?

Hello all,
I’m having a problem getting variable information from an array of actors. I want to add items into an array and pull up information from those items later. The problem is that when I try to get any of the actor’s variables it says the variable is not in scope. I thought maybe because I needed to cast the item in the array, but it just keeps failing the cast.


The strange thing is that if I look at the line coming off the first GET node it shows what actor is being referenced, but the item info is not in scope. Also, at the second GET node it will only print the item name if it’s the first item I pick up. Even though I’m referencing the same item in the array, I can’t get it to print the name on successive item pickups.

  1. On the left side, you are printing the name of the first item in your inventory array. The first time this code runs, this array will be empty, so you get an error. You probably meant to connect this wire differently:

  1. On the right side, you are always printing the name of the first item in the inventory array, while new items picked up are being added to the end. If you want to print the name of the last item added to the array, you should connect a “last index” node to the index pin of the “get” node.