# SU.Entity.SetHealthRelative

## SU.Entity.SetHealthRelative(entityId, relativeHealth)

Setzt die relativen Lebenspunkte der angegebenen Entität.

#### Notiz

* Haben Entitäten keine Lebenspunkte (=0), werden sie ignoriert
* Der gegebene Relativwert (`relativeHealth`) wird auf \[0, 100] beschränkt
* `relativeHealth=0` setzt die Lebenspunkte zwar auf 0, löst aber **nicht** die Kill-Funktion aus (Entität ist danach quasi 1-Hit)
* `relativeHealth` im negativen Bereich (<0) wird ignoriert und die Funktion nicht ausgeführt (siehe Rückgabewert)

#### Parameter

* `entityId`: ID der Entität
* `relativeHitpoints`: neue relativen Lebenspunkte (siehe Notizen)

#### Rückgabewert

* Neue (**absoluten!**) Lebenspunkte
* -1: sonst / Fehler

#### Beispiel

<pre class="language-lua"><code class="lang-lua">local newHealth = SU.Entity.SetHealthRelative(entityID, relativeHitpoints)
<strong>
</strong><strong>local newHealth = SU.Entity.SetHealthRelative(1, 90)
</strong>-- Setzt EntityId 1 auf 90% Leben
dbg.stm(newHealth) -- neuer Lebenswert (absolut)
</code></pre>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.settlers-united.com/s4-lua-api-de/su-library-functions/su.entity/su.entity.sethealthrelative.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
