> 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-wedding/installation.md).

# Installation

Install the RedM Wedding & Marriage System on VORP Core or RSG Core. server.cfg order, the ring, invitation and certificate items, item images and updating.

## Before you start

You need:

* A RedM server running **VORP Core** or **RSG Core**.
* [oxmysql](https://github.com/overextended/oxmysql). Couples, bookings, invitations, guests and divorce cases are stored in MySQL.
* Your framework's inventory: `vorp_inventory` on VORP, `rsg-inventory` on RSG. Rings, invitations and certificates are inventory items.
* Access to `server.cfg`, your database and your inventory's image folder.

You do not need Node.js. The interface ships already built in `web/dist`.

## 1. Place the folder

Copy `cas-wedding` into your `resources` folder. Keep the folder name as it is.

{% hint style="info" %}
Keep the `web/dist` folder (the built interface) and the `stream` folder (the ring box, the venue props and the embrace animation). Without them the menus cannot open and the venue stays empty.
{% endhint %}

## 2. Add it to server.cfg

Start it **after** oxmysql and your framework:

```cfg
ensure oxmysql
ensure vorp_core
ensure vorp_inventory
ensure cas-wedding
```

On RSG Core:

```cfg
ensure oxmysql
ensure rsg-core
ensure rsg-inventory
ensure cas-wedding
```

## 3. Add the items

The script uses six items:

| Item                   | What it is                                         |
| ---------------------- | -------------------------------------------------- |
| `ring_diamond`         | Diamond Solitaire, an engagement ring              |
| `ring_gold`            | Golden Wedding Band, an engagement ring            |
| `ring_platinum`        | Platinum Band, an engagement ring                  |
| `ring_chain`           | Golden Chain Ring, an engagement ring              |
| `wedding_invitation`   | A sealed wedding invitation, printed by the couple |
| `marriage_certificate` | The certificate each spouse receives               |

All six must be **usable**. Using a ring proposes, and using an invitation or a certificate opens it.

### VORP Core

Run `install/vorp_items.sql` on your database. For Turkish item names, run `install/vorp_items_tr.sql` after it.

```sql
INSERT IGNORE INTO `items` (`item`, `label`, `limit`, `can_remove`, `type`, `usable`, `desc`) VALUES
('wedding_invitation', 'Wedding Invitation', 50, 1, 'item_standard', 1, 'A sealed wedding invitation.'),
...
```

{% hint style="warning" %}
vorp\_inventory reads the `items` table only when it starts. **Restart the server** after adding the items, or using a ring does nothing.
{% endhint %}

The invitation limit is 50 because a couple can print up to 50 copies at once (`Config.Invitations.MaxCopiesPerPrint`). vorp\_inventory refuses a print larger than the item's limit, so keep the two equal.

### RSG Core

Paste the contents of `install/rsg_items.txt` inside `RSGShared.Items` in `rsg-core/shared/items.lua`, then restart the server.

Invitations and certificates are `unique = true` there. Each copy carries its own guest name and wedding, and a unique item keeps them apart instead of merging them into one stack.

## 4. Copy the item images

Copy the six pictures in `install/images/` to your inventory's image folder:

| Framework | Folder                           |
| --------- | -------------------------------- |
| VORP Core | `vorp_inventory/html/img/items/` |
| RSG Core  | `rsg-inventory/html/images/`     |

## 5. Start the server

The five database tables are created on the first start:

| Table                     | Holds                                                                                                                         |
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `cas_wedding_relations`   | Every engagement and marriage: both characters, roles, ring, dates, certificate number, signatures, bond XP and claimed gifts |
| `cas_wedding_bookings`    | Ceremony bookings, their hour, price, receipt and status                                                                      |
| `cas_wedding_invitations` | Each couple's invitation designs, and how many were printed and given                                                         |
| `cas_wedding_guests`      | Who received each invitation and whether they opened it                                                                       |
| `cas_wedding_divorces`    | Divorce petitions, their case number, grounds, signature, hearing and status                                                  |

There is no SQL to import for them. `install/database.sql` holds the same schema, if you prefer to create the tables yourself. Watch your console. You should see:

```
[cas-wedding] Database ready.
```

If you see `No supported framework is running yet`, check the `ensure` order above, or set the framework by hand in `config.lua`:

```lua
Config.Framework = "vorp"   -- "auto" | "vorp" | "rsg"
```

## 6. Check it in game

1. Give yourself a ring (for example `ring_gold`) and stand beside another player.
2. Use the ring from your satchel. The proposal window opens with their name.
3. Write a line, choose **Kneel & Propose**, and have them accept.
4. Ride to the county clerk in Valentine. The clerk is marked on the map as **County Clerk - Weddings**. Hold **E** to open the booking calendar.

If the calendar opens with your partner's name, the install is done.

## Before going live

Three settings in `config.lua` are for building and testing. They ship in their live position:

| Setting                    | Ship as | Effect                                                                                                                       |
| -------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `Config.StaffOnlyCommands` | `true`  | The venue and setup commands need a permission. See [Permissions](/script-documentation/cas-wedding/commands.md#permissions) |
| `Config.DevTools`          | `false` | `/wedding_scan`, `/wedding_where`, `/wedding_seat` and `/propose_offset` do nothing                                          |
| `Config.Debug`             | `false` | No embrace or crowd diagnostics in the console                                                                               |

## Updating

1. Back up your `config.lua` and any language files you changed in `locales/`.
2. Replace the resource folder with the new version.
3. Put your changes back, or copy the new settings into your backup. New versions can add settings, and a setting missing from an old config can break a feature.
4. Restart the resource.

Engagements, marriages, bookings, invitations and divorce cases live in the database and are kept.

{% hint style="warning" %}
Restarting the resource ends any proposal, embrace or ceremony in progress. Bookings are kept. A couple whose ceremony was interrupted can begin again at the altar while their hour is still open.
{% endhint %}
