> For the complete documentation index, see [llms.txt](https://renownedgames.gitbook.io/ai-tree/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://renownedgames.gitbook.io/ai-tree/api/runtime/interval-service-node.md).

# Interval Service Node

Type description and basic instructions.

### Description

Interval Service Node is base abstract class for all service nodes that have specified tick frequency.

To create a custom interval service node you should inherit from Interval Service Node class and implement logic that is described below.

### OnTick

When inheriting from Task Node you have to override OnTick method.

```csharp
public class ExampleServiceNode : ServiceNode
{
    protected override void OnTick()
    {
        throw new NotImplementedException();
    }
}
```

* OnTick contains logic of service tick.
* OnTick gets called every time during node execution.

### How to set tick frequency

Interval Service Node has a set of fields for specifying tick frequency

```csharp
public abstract class IntervalServiceNode : ServiceNode
{
    [Title("Service")]
    [SerializeField]
    [Min(0.001f)]
    private float interval = .5f;

    [SerializeField]
    [Min(0f)]
    private float randomDeviation = .1f;
    
    ...
}
```

### Serialized fields

| Name            | Description                             |
| --------------- | --------------------------------------- |
| interval        | Time between ticks                      |
| randomDeviation | Random deviation of time between ticks. |

{% hint style="info" %}
To create custom service nodes in editor you should add [Node Content](/ai-tree/api/runtime/nodecontentattribute.md) attribute to your custom task node class.
{% endhint %}
