# Firing Events from code

Events are useful to trigger things like VFX, menus, or even gameplay elements. Let’s look at the events that are fired from Health.cs on the prefab\_player. &#x20;

* OnPlayerDamaged -> ScriptableEventInt&#x20;
* OnPlayerHealed -> ScriptableEventInt&#x20;
* OnPlayerDeath -> ScriptableEventNoParam&#x20;

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXd8DGL3Bq9z-KX__LraZOOpeP-ZkBoKyLrIXIcFtHVtqtZYMIiBNfAZqsaQnnp6vSYD-HJ2BO8hozPlucENNhmfgh-zRWJdcitRle0pFIFIfwhVWOI9ZwH9szhsmVzHkvo_pwKvUYvwQcBPOSoC0N1d52Tr?key=npvPcHMgF_O4Om_5f5S8Bw" alt="" width="375"><figcaption></figcaption></figure>

It is simple to fire these events from code, you simply call the Raise() method. Here is an example in Health.cs:&#x20;

```csharp
private void OnDamaged(float value)
{
    if (_currentHealth <= 0f && !_isDead)
        OnDeath();
    else
        _onPlayerDamaged.Raise(Mathf.RoundToInt(value));
}

private void OnHealed(float value)
{
    _onPlayerHealed.Raise(Mathf.RoundToInt(value));
}

private void OnDeath()
{
    _onPlayerDeath.Raise();
    _isDead = true;
}
```
