In my game, I have a lava leak, which periodically drips lava. To make this work, I decided to make it so that the lava droplet only spawns during a specific frame during the animation (Topmost code above the group):
However, when testing, occasionally, the lava droplet doesn’t spawn at all. The lava leak just plays the dripping animation without spawning anything. There’s no pattern to this or anything. It’s just that the lava leak just randomly has a chance to not drip lava for no apparent reason.
Is this a bug or a framerate issue? Is there a solution or a workaround?
I would like for the lava leak to ALWAYS create a lava droplet when the animation frame of it’s dripping animation (Animation 1 in this case) is 4, no matter what. Is there a way to FORCE the code to work properly?
“occasionally, the lava droplet doesn’t spawn at all.” I think this coul it be because the second subcondition is executed but the first doesn’t return true, same for the third subcondition, try addind a second foreach and a variable to control the first foreach return like
Oh, and try to move all the events of lava drop up the lavaleak events too.
---- if instance_variable_of_lavaleak = 1
– Do more actions…
– Timer “drip” of lavaleak
Change animation of lavaleak =1
Set variable instance_variable_of_lavaleak _drop = 1
Thanks, but it didn’t work. I’m not sure if I typed it correctly or not, but this is what I got:
Nothing changed, still the same issue.
Also, the lava drop events need to be their own events because their code is going to be reused for other things that spawn lava drops (This way I don’t have to retype their code for each object that spawns them). The lava drops also currently have an issue for now, which I addressed on another post here, so they aren’t finished yet.
No but you’re repeating the foreach inside a foreach, you need to move outside the second and third subconditions
Only leave the timer and variable assign, inside the first foreach
Create a second foreach with the conditions you want and add The creation of the lavadrop
Create a third foreach and add conditions and actions you want, and reset the timer and the object variable if is needed.
Once you have all separated is going to be easy to detect which is causing the issue,
Okay, I made For Each events for each condition, but nothing changed
It didn’t work. The same issue still persists, but now there’s a new problem with the new code.
After some time has passed, all of the lava leaks in the level will just suddenly freeze during their dripping animation, being unable to drip any more droplets.
At this point, I’m assuming that my problem might actually be a bug.
On your third screenshot, I would try to replace the “Trigger once” by an object variable check.
Okay, I removed the trigger once and edited the events a bit more. However, the leaks are now spawning several lava droplets at once instead of a single droplet. How can I make the leak spawn only one drop each time?
(Note: Adding the variable change underneath the create action will just break the code. The droplet will drip once, and then stop forever. Adding the animation change under the create action will make the droplets drip every time like I want, but the timers will combine and mess each other up.)
(Edit: Additionally, I removed all the dripping variable conditions and actions and tested it, and it didn’t make a difference. It’s not any better or any worse, so the variables might not be necessary)
Below create lavadrop, set dripping to 2 so that it only gets triggered once.
Ah, okay. Thanks for the help ^^