All events have a single Trigger control output that starts the flow when they are triggered.
When events have value inputs, these are options that influence when the event will get triggered. For example, some events have a Target setting that determines which object is listening to the event. Most often, you'll leave this setting at its default value of Self
The value outputs on events are arguments that are passed fromthe event, giving you more information about what actually happened. For example, on the On Trigger Enter event, the other collider that was involved in the collision is an output:
There is a special type of event, the Custom Event, that you can use to trigger your very own events across graphs, along with their custom arguments.
Let's say we wanted create a custom event called On Damage that should get called to make the character lose health. This event should have one integer argument that indicates the amount of damage to inflict.
First, we can listen to the event by creating a Custom Event unit (under Events). We will set its name to On Damage. The field below the name is the argument count, which we will set to 1.
Note that as always, indices are zero-based, so the first argument is labeled Arg. 0.
To trigger the event from elsewhere, we must use the Trigger Custom Event unit, located right under the Custom Event unit in the fuzzy finder. We will configure it the same way, like a mirror. Make sure to type the name of the event in the exact same way, because it is sensitive to case and whitespace.
For example, if you were creating a flow machine on a boulder that could hit the player, you might want to use the force of the impact as the damage. Your trigger graph would therefore look something like this:
Notice we are using the collider that hit with the boulder as the target of our trigger. This means the On Damage event will be triggered on all machines attached to that collider.
Finally, you could use the damage value to subtract health from the receiver object, for example:
Custom events do not require a receiver and will not cause an error if there is no listener to handle them.