> For the complete documentation index, see [llms.txt](https://docs.settlers-united.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.settlers-united.com/s4-lua-api-de/library-functions/buildings/buildings.addbuilding.md).

# Buildings.AddBuilding

## ~~`Buildings.AddBuilding(x, y, Spieler, Gebäude)`~~

**Diese Funktion sollte NICHT mehr verwendet werden (siehe unten).**\
**Stattdessen ⇒** [SU.Buildings.AddBuilding](/s4-lua-api-de/su-library-functions/su.buildings/su.buildings.addbuilding.md)

Platziert ein Gebäude für den genannten Spieler an den angegebenen Koordinaten.

**Achtung:** durch **fehlerhaftes Verhalten** wird das Gebäude platziert, auch wenn die Stelle eigentlich blockiert ist.\
**Achtung:** zusätzlich **stürzt das Spiel ab**, wenn sich an dieser Stelle bereits Siedler befinden, da diese dadurch danach bewegungsunfähig sind.\
\&#xNAN;**⇒ Diese Funktion sollte - wenn überhaupt - nur am Anfang im Script stehen**, wo noch keine Siedler und Warenstapel existieren / platziert wurden und später nicht mehr verwendet werden!

Sie funktioniert noch wie bisher, um Rückwärtskompatibilität zu gewährleisten.

#### Rückgabewert

Eindeutige Gebäude-ID oder 0 wenn nicht möglich

#### Beispiel

```lua
local buildingID = Buildings.AddBuilding(100, 100, 1, Buildings.GUARDTOWERSMALL)
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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/library-functions/buildings/buildings.addbuilding.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.
