Hello everyone, i’m making puzzle game and i want to make hint mechanic which marks one random puzzle element as “clicked”. I want to get one random puzzle from all actors of the type and i made something like this:
It kinda works but, i can get the same puzzle more than one time. Is there any way that i can force it to give me different puzzle everytime? For example: There is 10 puzzle on level, I use hint first time, it works fine everytime, but when i use hint second time, there is a chance that the “Hint2” Event applies to the same puzzle for which the first hint was used.
On the left side there is only trigger and “Hint2” event is changing mesh, marking puzzle as clicked, adding points to score etc. I think it doesn’t really matter.
I would be really greatful for every tip and answer. Have a good day everyone!
Since the array is randomised, you can get Next element instead of a random one. Once you have the element (Print - your Hint goes here), increase the iterator.
PS. For some reason i had to sign -1 value to Iterator, if it’s 0 and i want use hint for last actor it doesn’t work, but anyway your help was huge for me.
Yes, I’m increasing it after getting the element. To be honest i don’t even know why it works like that. I’m begginner to blueprints. When iterator is set to 0 i’m actually getting 2nd element from array. When iterator is set to -1 im getting first element from array. I even set it to -2 to just find out what will happen, and then i’m not getting any element from array. As i said i’m just learning and i bet you’re 100% right about all this, but in my case it just works like that.
The first index you’re going to pull from the array is equal to the int. If the int is 0, you’re pulling 0. The int is increased later on. Here the array has 4 elements - 0,1,2,3
You are right! I think i know what happened in my case. After increasing iterator value I made custom event which was using object from “GET”. But when the event was executed the interator value was already increased so i ended up with actually using 2nd element instead of 1st. You were totally right, i messed up with order. When i moved my event before increasing interator it works fine with interator set to 0. I really appreciate all Your time to help me. You are so kind and helpful