Programming Event Sprites

Credits: Nin0

General
A sprite can both be triggered by an event and target an event. You can find more about events here.

Template
(made for Lost Worlds, a mod created using a CodeWarrior version of the Newer Code)     

      

         

Explanation
The above sprite triggers different events depending on the number of players in the level. In line 65 you can see the necessary code for an event triggered sprite while line 93 toggles an event and 95 sets one to active.

As Aboods more sprites mod was used, there are no hooks for a yaml, you can simply add the cpp to a new yaml with.

The  used in line 65 is part of. The value of the  is. In Reggie you can set  with nybble 3-4 and   with nybble 1-2.

Usually  is for triggering events and   for targeting events. This allows us to use the settings for other things that actually can be considered settings. As can be seen in the above example, it doesn't matter whether you use a value from the settings of the sprite or the  or even use   and   directly, but take note that ,   and   only are set after the sprite enters the   function while the settings are already set when the sprite is being created using the   function.