Firing event randomly - problem
Fairly new to BP scripting but just when I think I'm getting somewhere, I get stuck! I am trying to do a fairly simple thing - to make a random sound (from a possible 3) fire on a random timed trigger.
tried many things but the example I am posting is after a fair bit of time has passed and I've gotten more and more convoluted, so apologies for the no doubt awful logic!
In summary, I am firing a custom event on Begin Play that runs a function. That function has a timer in it that fires randomly between 1 and 5 seconds (for testing). I can see at runtime that this happens, but in-game the event only fire once (plays one sound, once) and then not again, despite the function appearing to fire internally over and over correctly.
Can somebody tell me what I'm dong wrong and perhaps post a fix of my current logic or show me a simpler way of doing what I want to do please? Don't get too complex without visual aids because I'm not mega experienced as yet and it'll go over my head - probably :)
asked Aug 18 '15 at 12:06 AM in Blueprint Scripting
Ok for starters BeginPlay only fires ONCE when the map has loaded and gameplay has begun.
So you should put your random sound logic in a FUNCTION then fire that off with a SetTimer.
So connection should be BeginPlay-> SetTimer (Function->yourfunction/ Timer-> your choice or random/ Looping-> checked)
answered Aug 18 '15 at 12:39 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here