Problem with Insert values to Array

Hey everyone. I have a problem with the following script:

The goal of this is to store the float values from the “Get Mouse Position” function into the float arrays over . This is actually part of a bigger script, but to keep this short - the event is executed via a looping timer every 0.1 seconds. The timer goes off (after passing a branch is true check from a whole other part of the script) once a key input is executed, and is cleared once the key is released. Minus One is just that, a variable with the value of -1. The location value gets work just fine, checked that via a “float to string - print string”.

I’ve been tweaking this for quite a while now, but I’m just not seeing what is wrong (probably something blatantly obvious, but hey… :)) - the values just refuse to add to the array. Any ideas?

Hi Catfish,

Is there a reason why you are not using “ADD”, example of how I add staff to an array, this is a struct array, but same thing. Just a thought.

There is one above.

Print string is your friend. The first thing you should do is put a print string right after the event to see if it is actually running. If it is, try add like said. If you are worried about making an array that could grow to big, you could always check its length before adding a new entry.

Hey, guys, thanks a lot for the suggestions. To the “any reason” question - i really couldn’t tell you, I guess because I assumed I need to specify everything and this just seemed the better pick. Will try using Add and report on results.

Still not seeing where the logic went bad though. I checked every element I could with it - everything seems to work. If any of you happen to find out the reason behind the problem - please let me know, really curious.

Nope, add didn’t solve it for me, unfortunately. I’m pretty sure the array function (be it add or insert) is the culprit though. Hey, , do you mind posting a screenshot of your array details? At this point I’m narrowing the problem down to some loose parameter that I didn’t set up properly.

No, I mean the details tab. Oh, and maybe class defaults

I’m also starting to suspect that i simply cannot store such data in this character class. Will look into this now.

Okay, stupid-stupid-stupid, but learned a lot :slight_smile: Here is where the problem was:

so i’m derping around setting up logic for character interaction with the world

  1. The two arrays I was manipulating were stored in the Character class
  2. At some point in setting up the logic I stupidly duplicated these arrays in the target Pawn class instead of referencing the Character class and getting them from the reference getter

So basically everything was working from the start, but I just didn’t connect the nodes between classes. The lesson here, children, is be attentive when you code :slight_smile:

Gentlemen, thank you for your patience and have a bag of likes :slight_smile: