# Adding and removing effects

To add or remove effects, simply append to the StatusEffectRequests buffer. The request will be automatically evaluated, and the stacks and duration will be handled by a custom system.

Note that the equivalent of predicate and event based durations are stored by an event ID. If you are using Status Effects with custom predicate and events you will need to create your own systems that manage them. It will need to query all StatusEffects buffers, iterate through them, and decrement duration accordingly for specifically effects with event and predicate timing.

{% code overflow="wrap" fullWidth="true" %}
```csharp
            var entity = EntityManager.CreateEntityQuery(typeof(ExamplePlayer)).GetSingletonEntity();
            var requests = EntityManager.GetBuffer<StatusEffectRequests>(entity);
            // Add
            requests.Add(new StatusEffectRequests(MyStatusEffectData.Id));
            // Add with stack count
            requests.Add(new StatusEffectRequests(MyStatusEffectData.Id, stacks: 5));
            // Add with duration
            requests.Add(new StatusEffectRequests(MyStatusEffectData.Id, duration: 3));
            // Add with a predicate
            requests.Add(new StatusEffectRequests(MyStatusEffectData.Id, eventId: MyEventId));
            // Add with an event
            requests.Add(new StatusEffectRequests(MyStatusEffectData.Id, duration: 3, eventId: MyEventId));

            // Remove all
            requests.Add(new StatusEffectRequests(StatusEffectRemovalType.Any));
            // Remove with stack count
            requests.Add(new StatusEffectRequests(StatusEffectRemovalType.Any, stacks: 5));
            // Remove specific data
            requests.Add(new StatusEffectRequests(StatusEffectRemovalType.Data, id: MyStatusEffectData.Id));
            // Remove specific name
            requests.Add(new StatusEffectRequests(StatusEffectRemovalType.Name, id: MyComparableName.Id));
            // Remove specific group
            requests.Add(new StatusEffectRequests(StatusEffectRemovalType.Group, group: MyStatusEffectData.Group));
```
{% endcode %}
