Add Unique + Get Copy not working in this setup

Hello everyone!

I am trying to get this macro to work but can’t figure out how.

The concept is this. I have Object Array 1 and 2, Timehandle Array 1 and 2 as inputs.

For each Loop with Break adds them to the Appended Array and Appended Timehandle Array respectively. The Switch Boolean controls which arrays are selected by the Selection.

My understanding is that with the Get Array I could use the Object Array Index to create the Timehandle Array.

The problem is that while the Object Array gets set up correctly (the correct objects get affected in-game) the Timehandle Array always has a length of 1.

Thank you all in advance for any help!

Some more info I just discovered:

Add Unique leaves the array at length 1. With the Same setup Add to Array fixes the problem partially. ( the array reaches length 12 but it should only have 11).

I need to make Add Unique work because these arrays have some overlapping elements. And the Arrays end up getting

It’s not clear at all how many times that loop runs.

You could make your life a lot easier by just doing this with two loops :slight_smile:

Oh, it just runs two times. That is not the tricky part… It runs once with the switch on then once more with the switch off… And that works as intended.

I created a separate For each Loop and the Add Unique still behaves in the same manner. The Struct Array remains at Length 1.


1 Like

I think there is something shifty going on, because you’re calling the loop again, but the completed pin runs. I don’t know what sort of effect that has…

Ok, so I made a mess of the blueprint to test it, and still the Length remains 1. But your example did give me an idea as to what might be happening…

The Scructs I am trying to combine are promoted Variables of Timers… And at the moment of the ADD UNIQUE node, they are all at 0… Hence the final Length of 1.

If that is the case how would you go about achieving what I was trying? Basically, I want to be able to influence all those timers at once after I’ve created an Array of unique entries.

What’s in the struct? A timer and ?..

Yes, if all the structs ( or array elements ) are the same, you get 1. That’s what the node is for :slight_smile:

You’ll need to make the elements different before doing the ADDUNIQUE.

What I thought was that it would treat the structs as unique due to their names… Like Time Struct 1 has time 0, Time Struct 2 Has time 0. They are timerhandle structs so by having them in arrays I could Influence multiple timers at once with Pause Timer by Handle and other commands like this.

PS: In the image, 1s means Small not Seconds.

The names in your picture and names of references, they never make it into the array. The array is just a list of timer structs.

For sure, you can keep timers in an array, but using unique on them is not a great idea, because if you need 20 timers, you need 20, that’s it.

I ended up taking the Arrays and naming them by combining them into a Map with Strings. So String Number 1 = Data from Timerhandle 1 etc. This way, if I am right about how this works, this would give me the result I am looking for and I will be able to influence them separately. What do you think?

If you want the names to have an effect, then that would definitely be a route to take :slight_smile:

But you have no way of going from the variable name to the timer?

Why not just an array of timers?

Why not just an array of timers?

I don’t get it, isn’t that what I was doing? I promoted the Timers to Timerhandle Structs and tried to get them to an Array but since all their info is 0 they simply don’t get picked by ADDUNIQUE.

What I am trying to do is get an Array of Objects, damage them and then take their Associated Timers and Perhaps Pause Them.

So if Objects 1, 5, 10, and 15 are damaged I then need to Pause Timers 1, 5, 10, and 15.

By making the maps I assigned the Same name to Both Objects and Timerhandles.

So String Name 1= Timerhandle 1 etc

I know the image is very cramped but basically naming them allowed me to use the CONTAINS node… Am I going overboard? XD


The most obvious way to do this is to put the timers inside the objects, ie, they are blueprints.

But if you want to keep the timers separate, then why not make a map ( dictionary ) of actor reference to timer?

That way, you can access the map with the actor ref, and get an immediate grip on the timer.

1 Like

I’ve just managed to finish working on this Macro. Couldn’t have done it without your help! Everything works like clockwork now!

But if you want to keep the timers separate, then why not make a map ( dictionary ) of actor reference to timer?

I was about to choose your answer as the Solution but just because you picked my interest with this could you elaborate?

As I understand it you are suggesting that a new actor should be created and attached to the Pawn I am using so the actor will be holding the map with the Timers?

Nearly. If the timer is for the pawn, then you put a reference to the pawn in the map, together with it’s timer.

Does that make sense?

1 Like

Oh, yes! I see now. Thank you again for the help and your patience!

No worries :slight_smile:

Just make sure the map key is ‘actor object ref’, because then you can put anything in there:

1 Like