I have in this funcion timers which should call another function when the time of the timer is over. But my problem is that the first one(at the false node of the branch) works with every time but the second one (at the other branch where the value of the variable is checked) dont work if the time i set is over 0.9 seconds. Any solution? I would be happy if anybody help me to solve this problem.
Hello AVARSStudios,
I’m not sure of the context for all of these nodes so I don’t know how it is being called and such but is it possible that the Set Timer by Function Name node is being called multiple times? This would cause the timer to reset and that would explain why a faster time would work while a higher one wouldn’t.
What I wanna do is that for special values the timer has another time. All nodes are for checking the value of the variable and then the timer with the special time(the time is different for every value) should start. So normally I need every node of this. Is there any other way?
In the screenshot that you provided in your original post, the only thing that can cause the timer to be set is if the variable is equal to 1. Due to how the execution pins are set up, none of those other checks matter as they never have anything coming from the True pins. Is this what you intend? It doesn’t seem to be correct.
Even if there is anything at the other true nodes it don’t work. To make it more easy for you to understand is that I tell you what happen on the function which is called by the timer.
The default value of the variable is 0. The function in the picture is checking the value and then the timer start. When the time is over the other function will be called by the timer. In this function the variable will set to a new value. Then it goes back to the other function and it check the variable again. The value of the variable is now 1. Then it checks again the value and the timer of the branch where the value is equal 1 will start a new timer which call the other function again and set the value again of the variable. This happen that often until the value of the variable is equal 5.
I understand what you’re trying to accomplish. It would be easiest to debug this locally however as I’m not sure of the scope of this blueprint, as in when the function is being called. Would it be possible for you to send me a copy of the project itself? If you wish to keep it private, you can send it to me on the forums through a private message. [Here is a link to my profile.][1]
This is some serious Blueprint spaghetti you’ve got going there.
I would suggest exploring SELECT function rather than these chained Branches. Why are only False nodes connected for execution? Lastly, typically TIMERS are used for repeat functionality. For example: Perform action X every Y seconds. However, yours do not have Looping toggled - which baffles me. If you don’t want to loop, why not use a simple function call followed by a DELAY?
Finally - your problem is not “Timer by function name dont work” - it’s “My spaghetti is out of control”
I just ran a couple of tests with the Set Timer by Function and it’s working correctly in my 4.10.
Last I tried it in BP in 4.8 it works fine.
But if your functions have any inputs they wont work with timers. Do they have inputs?
I will send it to you in the following days. Thank you for your help.
How is can send a private message?
You can send a private message by following the link I provided and then selecting “Send Private Message” under the “Epic Staff” logo under my name. If you don’t see this option, please ensure that you’re signed in. To actually send the file, it would be best to upload it to an external site such as Dropbox or OneDrive and provide the link.
Because of the size of the project i wasnt able to send it to you. I have made screenshots. Maybe they help you to find the problem. If not let me know this then i try to send the project by another way to you.
thx
Thank you for providing those screenshots, AVARSStudios.
It seems the problem is the timer that is set OnBeginPlay. You mentioned that the second “Set Timer by Function Name” node doesn’t work unless it is set to 0.9 or less, which is due to the 1 second on your initial “Set Timer by Function Time”, which is set to loop. This is causing the “Get Kopfschmerzen” to be called every second. This is fine for the first “Set Timer by Function Name” in the “Get Kopfschmerzen” function as it can’t be called twice due to the boolean that is set to cause that branch to fail.
The problem comes in when the integer variable is set to “1” and the second timer in the “Get Kopfschmerzen” function is called. The timer is set to 20 seconds, but then 1 second later, the function is called again by the initial timer, and that 20 seconds is reset. This loops indefinitely.
You’ll need to find a way to call this function without resetting the timers. You may want to use a boolean as you did with the first one.
Hope this helps!