What function can I use to detect one time events?

Godot Version

4.6.3

Question

This is a somewhat general question, but is there any function that i could use to detect one time events instead of process? For example, if a boss’s health is 0, a function would trigger. I know this sounds dumb, but the problem is that process uses a lot of well, processing power, and I’m new to Godot, so I’d like to know any other functions which serve the same purpose.

I’m very new to Godot, so this probably sounds rather dumb.

You should use signals for things like that. The boss script can implement a custom signal which is emitted when the health goes below zero. You then connect a handling function to that signal. Note that checking if health went below zero in boss script doesn’t need to be done every frame. Implement a damage() function that’s called every time the boss receives damage, check only there and emit the signal accordingly.

Thanks, that works.