> For the complete documentation index, see [llms.txt](https://code-after-sex.gitbook.io/script-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://code-after-sex.gitbook.io/script-documentation/cas-advanced-gang/playing/founding.md).

# Founding a gang

Found a gang in CAS Advanced Gang System: write the charter in the creator, pitch the leader's tent where you choose and set down the starting camp.

## The creator

`/creategang` opens the gang creator. Other scripts can open it too (see [Exports](/script-documentation/cas-advanced-gang/developers/exports.md#opengangcreator)). It has three parts:

1. **The charter.** Name, tag and motto.
2. **The ground.** How far the nearest camp is, and whether this spot is far enough from it.
3. **The order.** The structures a new camp needs, in the order they go down.

The server checks the charter again when you found:

| Field  | Rule                                                                                                                     |
| ------ | ------------------------------------------------------------------------------------------------------------------------ |
| Name   | 3 to `Config.GangNameMax` characters (24). Unique on the server, whatever the capitals.                                  |
| Tag    | 2 to `Config.GangTagMax` characters (8). Letters are upper-cased, and anything but A to Z and 0 to 9 is removed. Unique. |
| Motto  | Up to 60 characters. Left empty, the gang gets a default motto.                                                          |
| Ground | At least `Config.MinCampSpacing` (300 m) from every other camp.                                                          |
| Fee    | `Config.FoundingCost`, taken from the founder's own money. Free without a framework.                                     |

## Why the tent goes first

The last button in the creator doesn't build a camp. It writes the charter, lifts the view overhead and hands you the **leader's tent**. Wherever you pitch it becomes the centre of the camp, and `Config.CampBounds` is measured from it. So the founder picks the middle of their own camp, not wherever they happened to be standing.

The tent has no camp to sit in yet, so it gets its own limit: within `Config.FoundBounds` (20 m) of the founder. Push past it and the tool shows **OUT OF BOUNDS**, the confirm key stops working, and an arrow points back.

The claim, the fee and the tent are saved together. If the database refuses the gang, the fee is paid back and the founder is told.

## The rest of the starting camp

After the tent, the tool hands you each remaining structure in `Config.FoundingOrder`: the ledger table, then the campfire. When nothing is left, the ledger opens on a finished camp.

**ESC** leaves at any point. What's still owed stays marked in the placing tool, and **Place structures** sets it down later.

## After founding

The founder holds the top rank. From here the gang grows through the [roster](/script-documentation/cas-advanced-gang/playing/members.md), the [treasury](/script-documentation/cas-advanced-gang/playing/treasury.md) and the [camp tiers](/script-documentation/cas-advanced-gang/playing/upgrades.md).
