> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nmentities.net/llms.txt
> Use this file to discover all available pages before exploring further.

# My First Effect

> Give your mob personality: greetings, reactions and a dramatic death.

Your mob from [My First Mob](my-first-mob) exists, but it's silent. In this tutorial you'll give it personality: it will greet players, complain when hit, and go out with a bang. Along the way you'll learn the one line format that all of NMEntities' effects are built on.

## The idea

An effect is a small action your mob performs when something happens. Every effect is one line with up to three parts:

```text theme={null}
narrate "Hello!"   #onInteract   @target
```

Read it like a sentence: **what** happens (`narrate "Hello!"`), **when** it happens (`#onInteract`, when someone right-clicks the mob), and **who** it happens to (`@target`, the person who clicked).

That's the whole format. Everything else is learning more whats, whens and whos.

## 1. Make it greet

Open your mob's file and add an `effects:` list:

```yaml theme={null}
toast:
  model: toast
  base: zombie
  display: "&6Sir Toast"
  health: 40
  effects:
  - narrate "&7Sir Toast greets you!" #onInteract @target
```

Save, `/nme reload`, spawn a fresh one and right-click it. It talks!

> Changes never apply to mobs that are already in the world. After every reload, spawn a new one to see the difference.

## 2. Make it react

Add two more lines:

```yaml theme={null}
  effects:
  - narrate "&7Sir Toast greets you!" #onInteract @target
  - narrate "&cOw! How dare you!"     #onHurt     @target
  - lightning                         #onDeath    @self
```

Three different **whens**: right-click, taking damage, dying. And two different **whos**: the messages go to `@target` (whoever caused it), the lightning strikes `@self` (the mob's own position).

Reload, spawn, and go pick a fight with Sir Toast.

## 3. Make it fight back

Messages are nice, actions are better. Give him thorns:

```yaml theme={null}
  - damage{amount=2} #onHurt @target
```

New things here: `damage` is a mechanic that takes an option, and options go in curly braces right after the name: `{amount=2}`. That's 2 damage, one heart, to whoever hits him.

One more, a poison bite when he attacks:

```yaml theme={null}
  - potion{type=poison;duration=5s;level=1} #onAttack @target
```

Multiple options are separated by `;`. And notice `duration=5s`: times can be written naturally, `5s`, `2m`, or plain numbers for ticks.

## The full mob

```yaml theme={null}
toast:
  model: toast
  base: zombie
  display: "&6Sir Toast"
  health: 40
  effects:
  - narrate "&7Sir Toast greets you!"       #onInteract @target
  - narrate "&cOw! How dare you!"           #onHurt     @target
  - damage{amount=2}                        #onHurt     @target
  - potion{type=poison;duration=5s;level=1} #onAttack   @target
  - lightning                               #onDeath    @self
```

A mob that greets, retaliates, poisons and dies dramatically. Five lines.

## What you've learned

* Every effect is **mechanic + trigger + targeter**: what, when, who.
* Mechanics take options in `{key=value;key=value}` blocks.
* Times can be written as `5s`, `2m` or ticks.
* Reload, then spawn fresh: existing mobs keep their old behavior.

## Where to go next

You now know enough to explore the whole Effects section:

* [Overview](overview) formalizes what you just learned.
* [Triggers](triggers) and [Targeters](targeters) list every when and who.
* [All Mechanics](mechanics) is the full catalog of whats.
* And when you're feeling brave: [Building a Boss](building-a-boss) turns these same ingredients into a two-phase raid boss.
