Evening all, I have a question/problem I’d like to pose to everyone in hopes of a solution or potential ideas, to get my think tank working!
So here it is:
I have created a (very) basic blue print of movement of an actor or in this case a trap that hits my player actor, once the player enters the “play” volume it begins the overlap and activates the trap movement, once they leave it reverses back to its original position. I plan to have several of these in one area however the problem I have is how to set them off individually or at complete random.
Do I set a delay on certain duplicates to start (which seems very long winded) or use the “random” nodes inside of blueprint? I’ve pulled off a few random nodes but to be completely honest I can’t see if they are affecting anything.
Any help is appreciated. I’ll leave a screen cap of my current blueprint.
This is not a good idea. If there is only 1 unfired trap left out of 50 then finding it will take a lot of random trial and error.
It would be better to have two arrays. One all-traps array, which is copied into an unfired-traps array. Whenever a trap fires, it is removed from the array.
You just pick a random in the index range of the unfired array.
Each access will guarantee to return an unfired trap. No branching, no comparison needed.
When the unfired traps array is empty, just duplicate it again from the all-traps array.
I don’t understand what it is your trying to do exactly. So some traps are set to fire at random intervals while others are set to fire when triggered by the player? If that’s the case, just have the RNG inside the constructor to determine if its an “interval based” or “trigger based” trap?
I feel like I’m completely misunderstanding you though…
Thanks for getting back so quickly guys! I’ll try the methods you told me here and let you know how it goes!
Apologies I should have made it a little clearer, I have a room set with a certain amount of traps (haven’t decided how many) and I wish to create a volume so when the player enters it, It will activate my trap blue print causing these traps to pop out of the wall at random intervals, instead of one after the other. I hope this has cleared up some of your confusion!
Well, you can bake the RNG into the traps for an almost identical effect. Just have the trigger volume contain an event dispatcher that “activates” all the traps in the room, having them all count down from their respective randomized delays.
The previously mentioned ideas are also very good and will accomplish the desired effect