> For the complete documentation index, see [llms.txt](https://rtx-dev.gitbook.io/rtxdev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rtx-dev.gitbook.io/rtxdev/ghost-hunting.md).

# Ghost Hunting

Documentation for RTX Ghost Hunting, the FiveM Ghost Hunting Script for ESX, QBCore and QBox: installation, configuration, commands, exports and FAQ.

{% embed url="<https://www.youtube.com/watch?v=VSlB9Xv4kHI>" %}

## Purchase

[Purchase this resource](https://rtx.tebex.io/package/7710806)

**RTX Ghost Hunting** turns any building on your FiveM server into a haunted house. A team takes a case from the ghost hunter, walks into a house with the power out and has to work out **which of 10 ghosts** lives there. They find its room with the thermometer and the EMF reader, collect evidence with the spirit box, the camera, the writing book and the silhouette projector, mark it in a shared journal, photograph the ghost and get back out alive. The lower their sanity, the more the ghost does - until it starts hunting them. A team that knows the ghost can also banish it for good with the **exorcism**, an optional rite where the ghost fights back.

Outside the house the team can have a **field base**: a tent with live monitors, an evidence board, camera feeds and a rack every tool is taken from. Or leave it out and hunt the classic way, it is one line in the config.

7 houses are ready to play, every other house is built **in game** with the location creator. Every ghost, event, object and reward is in the config, and everything the team sees is synchronized between the players.

***

## Features

* **Co-op investigations** - a team with a leader, invites, a lobby and its own HUD, or hunt alone
* **10 ghost types** - every one with its own evidence and its own behaviour, and you can add your own
* **6 types of evidence** - EMF level 5, freezing temperature, orbs on camera, spirit box, ghost writing, projector silhouette
* **Investigation tools** - thermometer, EMF reader, spirit box, camera with night vision and zoom, flashlight, writing book, silhouette projector
* **Three ways to play** - classic, with a field base, or the full base where the team sets the tent up and takes every tool from the rack
* **Field base** - a tent outside the house with three live monitors, a laptop, an evidence board and an equipment rack
* **Camera feeds** - video cameras on tripods and head cams, watched from the monitors with night vision and zoom
* **Equipment shop** - sanity pills, crucifix, incense, salt, motion sensor, talisman, video camera and head cam, packed in the lobby
* **The ghost fights back** - it switches motion sensors off, kicks salt apart and blows out the incense
* **The exorcism** - optional. Draw the seal, light the candles and read the verse in the ghost's own rite while it fights back. Banish it for a bigger reward, or make it angry
* **The ghost comes close** - at low sanity it drags, hoists, chokes, pins or possesses a hunter, and the false teammate waits in the house
* **Sanity** - drains while you are inside, faster in the ghost's room and alone; the lower it is, the more active the ghost
* **21 ghost events** - thrown objects, slamming doors, knocks, footsteps, whispers, flickering lights, the ghost showing itself, walking past, blowing the fuse and more
* **Hunts** - exit doors lock, lightning hits, the ghost walks the house looking for the team; hide in a wardrobe or get caught, with several endings
* **8 jumpscares** with a cinematic camera, and **hallucinations** at low sanity, including fake hunts
* **Haunted objects** - ghost board, tarot cards, voodoo doll, music box, Bloody Mary mirror, phone, radio, TV, coffin, cursed teddy, old diary, fuse box, rats, rocking chair
* **Interactive houses** - lamps, light switches, candles, bulbs that burst, wardrobes to hide in
* **Shared journal** - evidence, all ghosts, what happened, objectives, equipment, haunted items, photos and the team
* **Hunter's Handbook** - a guide for your players, built into the game
* **Plays well with your server** - your HUD, the inventory hotbar and your weather script step aside during a hunt, and the hunt plays at midnight
* **Anticheat hooks** - every script camera, spectating and teleport tells your anticheat first
* **3 difficulties** - Easy, Normal and Nightmare, or your own
* **Bonus objectives** - picked at random every run, each with its own reward
* **Rewards** - money and items, itemised in the investigation report
* **Leaderboard** - solved, hunts, fastest solve and money earned
* **Spectating** - a caught player watches his team
* **House mode or city mode** - a ghost hunter at every house, or a case board in the city and a drive to the house
* **7 houses ready to play** - Old House, Michael House, Hospital, Slaughterhouse, Franklin House, FIB and Manor House
* **In-game location creator** - rooms, ghost spots, doors, barriers, objects, lights, the place of the base tent, IPL interiors, no config editing, no restart
* **Two interface styles** - paper case files or a dark modern interface
* **Access control** - open to everybody, or only a job, an ACE, groups, single players or an item
* **Own instance for every team**, or one team per house that everybody can see
* **Fully synchronized**
* **18 languages**
* **ESX, QBCore, QBox and standalone**

***

## Requirements

| Resource                             | Required                                                                                                                       |
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ |
| `rtx_ghosthunting`                   | Yes - the script, the tool models, the haunted objects, the base and the exorcism kit are inside it                            |
| OneSync                              | Yes - every team hunts in its own routing bucket                                                                               |
| `oxmysql`                            | No - recommended. Houses and the leaderboard are saved in the database. Without it they are saved in files inside the resource |
| `screenshot-basic`                   | No - only for photos in the journal and photos of the houses on the case board                                                 |
| `ox_inventory` / framework inventory | No - only for reward items and the access item                                                                                 |
| Ambulance script                     | No - `wasabi_ambulance`, `qb-ambulancejob` and `esx_ambulancejob` are picked up on their own                                   |

***

## Installation

{% stepper %}
{% step %}

## Add the resource

Place `rtx_ghosthunting` into your resources folder and add it to your `server.cfg`, after your framework, your inventory and `oxmysql`:

```
ensure rtx_ghosthunting
```

{% hint style="warning" %}
Keep the `stream` folder and the `data` folder. The `stream` folder holds the tools, the haunted objects and the base, the `data` folder holds the houses the script comes with and your own when you use file storage.
{% endhint %}
{% endstep %}

{% step %}

## Framework

Open `config.lua`, section 1:

```lua
Config.Framework = "esx" -- "esx", "qbcore" or "standalone"

Config.Frameworks = {
	esx = {
		resource = "es_extended",
		newversion = true,
		getsharedobject = "esx:getSharedObject"
	},

	qbcore = {
		resource = "qb-core"
	}
}

Config.Inventory = {
	system = "ox", -- "ox" for ox_inventory, "framework" for the one your framework ships with
	qbnewversion = false -- QBCore with system = "framework" only. true for the newer qb-inventory
}
```

| Framework          | Value          |
| ------------------ | -------------- |
| ESX                | `"esx"`        |
| QBCore / QBox      | `"qbcore"`     |
| Standalone / other | `"standalone"` |

{% hint style="info" %}
In standalone mode nothing is paid out, unless you fill in `AddMoneyRTX` in `server/other.lua`. Use the ESX and QBCore parts in the same file as reference.
{% endhint %}
{% endstep %}

{% step %}

## Storage

```lua
Config.Storage = {
	mode = "database", -- "database" or "file"
	resource = "oxmysql"
}
```

With `"database"` the tables `rtx_ghost_locations` and `rtx_ghost_stats` are created on their own - **nothing to import**. See [Storage](#storage).
{% endstep %}

{% step %}

## Pick how a hunt plays

`config.lua`, section 2:

```lua
Config.Mode = "full" -- "classic", "base" or "full"
```

`"classic"` is the hunt without a tent, `"base"` adds the field tent with its monitors, `"full"` has the team set the tent up and take every tool from the rack inside. See [The Base](#the-base).
{% endstep %}

{% step %}

## Admins

The location creator belongs to whoever your `server.cfg` gives `ghostcreator.use` to:

```
add_ace group.admin ghostcreator.use allow
```

Framework groups, a builder job and single players by identifier can be allowed too, see [Permissions](#permissions).
{% endstep %}

{% step %}

## Play, or build your own house

7 houses are ready to play as soon as the resource runs. For your own, walk into any building and type `/ghostcreator`. See [Location Creator](#location-creator).
{% endstep %}
{% endstepper %}

***

## How an Investigation Works

{% stepper %}
{% step %}

## Take the case

Walk up to the ghost hunter and press `E`. The lobby opens: pick the difficulty, invite the players standing nearby, pack some equipment and start.
{% endstep %}

{% step %}

## Set up the base

With `Config.Mode = "full"` the tent stands outside as an outline. One hunter sets it up, and everybody takes his tools from the rack.
{% endstep %}

{% step %}

## Walk in

The power is out, every player has a flashlight. The HUD shows the house, the room you stand in, the time left, your sanity, the objectives and your team.
{% endstep %}

{% step %}

## Find the ghost's room

It is the cold one, and the EMF reader reacts there.
{% endstep %}

{% step %}

## Collect evidence

Every ghost leaves exactly 3 of the 6 kinds. Mark what you found in the journal - every mark is shared with the team, and ghosts that no longer fit are ruled out.
{% endstep %}

{% step %}

## Name the ghost

Name the ghost in the journal and **photograph it** when it shows itself.
{% endstep %}

{% step %}

## Banish it (optional)

Follow the ghost's rite with the exorcism kit and banish it for good. See [The Exorcism](#the-exorcism).
{% endstep %}

{% step %}

## Survive

The lower the team's sanity, the more the ghost does. Below a point it hunts. Hide in a wardrobe, or be caught.
{% endstep %}

{% step %}

## Get out

Go back to the ghost hunter and end the investigation. The report shows what the ghost really was, what the team found and what everybody is paid.
{% endstep %}
{% endstepper %}

| Key       | Action                                                                   |
| --------- | ------------------------------------------------------------------------ |
| `E`       | Talk to the ghost hunter, use things in the house, end the investigation |
| `G`       | Use the tool in hand - ask the spirit box a question, raise the camera   |
| `X`       | Put the tool away                                                        |
| `F`       | Flashlight                                                               |
| `J`       | Journal                                                                  |
| `H`       | Night vision while looking through the camera or watching a camera feed  |
| `Y` / `N` | Accept / decline a team invite                                           |
| `U`       | Start or stop watching the team after being caught                       |
| `F7`      | Hide or show the HUD card                                                |
| `DELETE`  | City mode: hold to drop the case on the way to the house                 |

With `Config.Mode = "classic"` or `"base"` every tool has its own key:

| Key             | Action                                                                                |
| --------------- | ------------------------------------------------------------------------------------- |
| `1` `2` `3` `4` | Thermometer, EMF reader, spirit box, camera                                           |
| `B`             | Put the writing book down, or pick it up                                              |
| `K`             | Put the silhouette projector down, or pick it up                                      |
| `5` `6` `7`     | Equipment held in the hand: pills, crucifix, incense, whichever you packed            |
| `8`             | Put the exorcism kit down in front of you                                             |
| `O` / `L` / `I` | Pour salt / put the motion sensor up / stand the video camera up, or pick it up again |

With `Config.Mode = "full"` the bar at the bottom of the screen is an inventory:

| Key                     | Action                                                                                                                                                                                                  |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `1` to `0`, `-` and `=` | The slots, always in the same order: thermometer, EMF reader, spirit box, camera, writing book, projector, then the equipment. The key takes a tool out and puts it away, or puts down what is put down |
| `E`                     | Take the piece you are looking at from the rack, pick up what lies in the house                                                                                                                         |
| `R`                     | Put the piece you are looking at back on the rack                                                                                                                                                       |

Looking through the camera: `LMB` takes a photo, `RMB` lowers it, the mouse wheel zooms.

***

## Evidence & Tools

Every ghost leaves exactly **3 of these 6**. Two found pieces leave a couple of ghosts, the third one names it.

| Evidence                 | How the team finds it                                                                     |
| ------------------------ | ----------------------------------------------------------------------------------------- |
| **EMF level 5**          | The EMF reader near the ghost. Every ghost moves it to 2, 3 or 4 - only level 5 counts    |
| **Freezing temperature** | The thermometer in the ghost's room. The room cools down slowly, below 0° counts          |
| **Orbs on camera**       | Orbs float around the ghost, visible only through the camera. They come and go            |
| **Spirit box answers**   | Ask a question close to the ghost. A ghost that talks answers some of them                |
| **Ghost writing**        | Put the writing book down in the ghost's room and wait. It writes a word into it          |
| **Projector silhouette** | Put the silhouette projector down. The ghost walks through the laser dots as a silhouette |

Writing and the silhouette never come together - finding one rules out the other.

```lua
Config.Tools = {
	exclusive = true, -- true = every tool can only be held by one player at a time, so the team has to split them up

	thermometer = {
		ambient = 18.0, -- What a room far from the ghost reads, in celsius
		start = 10.0, -- What the ghost's room reads when the team first walks in
		cooltime = 90 -- Seconds the ghost's room takes to cool down to the ghost's mintemp
	},

	emf = {
		outside = 1,
		room = 2,
		near = {2, 4}, -- Levels the reader jumps between close to the ghost. Every ghost does this
		nearfive = 0.15, -- Chance an EMF 5 ghost pushes the reader to 5 while you stand close to it
		spikefive = 0.7 -- Chance an EMF 5 ghost hits 5 when something happens in its room
	},

	spiritbox = {
		range = 6.0, -- Metres from the ghost a question has to be asked from
		chance = 0.3, -- Chance a ghost that talks actually answers
		cooldown = 6
	},

	camera = {
		personal = true, -- true = every player has his own camera, even with exclusive on
		range = 12.0,
		nightvision = true,
		zoom = {enabled = true, max = 4.0, steps = 8}
	}
}
```

`Config.Temperature = "celsius"` or `"fahrenheit"` only changes what the thermometer shows.

### Spirit box

Every question the player can ask and the answers the ghost can give are in `Config.SpiritBox`, each with its own voice file. `{room}` in an answer is replaced by the name of the ghost's room.

### Writing book and projector

```lua
Config.Book = {
	enabled = true, -- false takes the book and the writing evidence out of the game
	delay = 60, -- Seconds the book has to lie there before the ghost can write in it
	texts = {"GET OUT", "LEAVE", "MINE", "HELP ME", "I SEE YOU", "DIE", "BEHIND YOU", "NOT ALONE"}
}

Config.Projector = {
	enabled = true, -- false takes the projector and the silhouette evidence out of the game
	range = 7.0, -- How far the dots reach, in metres
	points = 180, -- How many laser dots it projects
	color = {70, 255, 110},
	ghostcolor = {255, 40, 40}, -- The dots turn this colour while the ghost walks through them
	delay = 45,
	cooldown = 60
}
```

The orbs are in `Config.Orbs`, the flashlight in `Config.Flashlight`.

***

## Equipment Shop

Extra equipment the team packs in the lobby before the hunt starts. It is theirs for that one hunt only - nothing is kept afterwards and no inventory is needed. The shop is optional: with `Config.Shop.enabled = false` the lobby has no shop at all.

| Item              | How it is used                             | What it does                                                                                                                                 |
| ----------------- | ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
| **Sanity pills**  | Held, `G` swallows them                    | Give back some sanity                                                                                                                        |
| **Crucifix**      | Held                                       | Close to the ghost a hunt does not start. Anywhere else it may still save the player holding it when the ghost reaches him. Then it burns up |
| **Incense**       | Held, `G` lights it                        | Keeps the ghost from hunting for a while. Lit during a hunt it blinds the ghost for a few seconds                                            |
| **Salt**          | Poured on the floor, three piles in a pack | The ghost leaves a footprint when it walks through, and it is written into the journal                                                       |
| **Motion sensor** | Mounted on a wall or put on the floor      | Its light turns red, it beeps and the team is told the room                                                                                  |
| **Talisman**      | Worn                                       | Saves the player once when the ghost catches him                                                                                             |
| **Video camera**  | Stands on a tripod in a room               | The team watches that room from the monitors in the base                                                                                     |
| **Head cam**      | Worn on the head                           | The team sees what that hunter sees                                                                                                          |

{% hint style="info" %}
The video camera and the head cam are only sold at a house that has a base. They are watched from its monitors, see [The Base](#the-base).
{% endhint %}

```lua
Config.Shop = {
	enabled = true, -- false and there is no shop at all
	shared = true, -- The team shops together: it does not matter who pays, one hunter can buy for the whole team
	free = "auto", -- true = everything is free, false = always charged, "auto" = free only on standalone
	account = "money", -- "money" = cash, "bank", or any other account your framework has
	refund = true, -- A player who leaves the team before the hunt starts gets his money back

	items = {
		pills = {enabled = true, price = 350, limit = 1, team = 4, off = {}, sanity = 30.0},
		crucifix = {enabled = true, price = 600, limit = 1, team = 2, off = {}, range = 5.0, save = 0.5},
		talisman = {enabled = true, price = 1500, limit = 1, team = 1, off = {"nightmare"}}
		-- ...
	}
}
```

| Option    | What it does                                                            |
| --------- | ----------------------------------------------------------------------- |
| `enabled` | `false` takes the item out of the shop                                  |
| `price`   | What one piece costs                                                    |
| `limit`   | How many of them one hunter can carry                                   |
| `team`    | How many of them the whole team can buy together, `0` for no team limit |
| `off`     | Difficulties it is not sold on, like `{"nightmare"}`                    |

Every item has its own numbers in the same block: how much sanity the pills give back, how close the crucifix works, how long incense lasts, how many piles are in a pack of salt, how far a motion sensor sees.

With `shared = true` one hunter can buy for the whole team, up to the `team` limit. At a house with a base everything waits on the rack and a hunter still carries no more than `limit` at a time, so he walks back for the next one. At a house without a base, what he bought for the others is handed to them at the start. With `shared = false` nobody can buy more than `limit` himself.

The money is taken by `RemoveMoneyRTX` and given back by `RefundMoneyRTX` in `server/other.lua`. Standalone has no money, so the equipment is free there until you put your own payment in.

### The ghost fights back

Now and then the ghost goes for a piece of equipment within its reach: it switches a motion sensor off (it stays dark until a player picks it up and mounts it again), kicks a fresh pile of salt apart, or blows out the incense. Never during a hunt.

```lua
Config.Shop.tamper = {
	enabled = true,
	chance = 0.008, -- Chance every second, while there is something for it to go for
	cooldown = 75, -- Seconds it leaves the equipment alone afterwards
	after = 30, -- Seconds a sensor, a pile or burning incense is safe after it was put down or lit
	range = 10.0, -- Metres from the ghost a sensor or a pile has to be within
	sensor = true,
	salt = true,
	incense = true
}
```

Some ghosts deal with the equipment in their own way: one never steps in salt, one is not seen by motion sensors, one needs the crucifix much closer. See [Ghosts](#ghosts).

***

## The Base

A field tent outside the haunted house: a desk with three monitors and a laptop, an evidence board and an equipment rack. It is optional, and one line decides how much of it a hunt uses:

```lua
Config.Mode = "full" -- "classic", "base" or "full"
```

| Mode        | How a hunt plays                                                                                                                                                                                                   |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `"classic"` | No tent anywhere. Every hunter has his tools from the start, and what the team bought in the shop is handed out when the hunt begins                                                                               |
| `"base"`    | A field tent stands ready at the house, with live monitors, the evidence board and the camera feeds. The hunt itself does not change: tools and equipment are still handed out at the start                        |
| `"full"`    | The team sets the tent up itself, and every tool and every piece of equipment lies on the rack inside and has to be taken from there. The bar at the bottom of the screen becomes an inventory with numbered slots |

{% hint style="info" %}
`"full"` needs the equipment shop (`Config.Shop.enabled`), the rack is where the shop delivers.
{% endhint %}

### Where the tent stands

Every house has its own place: `/ghostcreator`, open the house, **Base tent**. Point at the ground outside the house and turn the arrow to where the open front should look. The whole base is put together around that point on its own.

A house without a place has no tent, and everything is handed out at the start there, whatever `Config.Mode` says. The 7 houses the script comes with all have one.

### Setting it up

With `"full"` the tent stands at its place as a see-through outline when the hunt starts. One hunter walks up and presses `E`: the tent rises from the ground, the furniture settles in piece by piece, the equipment lands on the rack and the screens boot up. It is packed up again when the investigation ends.

```lua
Config.Base.build = {
	enabled = true, -- false and the base stands at the house all the time, for everybody
	time = 5, -- Seconds the tent takes to rise. 0 sets it up at once
	distance = 3.5, -- How close to the middle of the place a hunter has to stand, in metres
	alpha = 85, -- How solid the see-through tent is before it is set up, 30 to 255
	color = {255, 140, 40} -- Colour of its outline and of the frame around it, false for neither
}
```

### The rack

Thermometers, EMF readers, spirit boxes, cameras, the writing book, the projector and everything bought in the lobby really lie on the rack. Look at a piece and press `E` to take it, `R` puts it back. The pile belongs to the whole team, so anybody can take what somebody else paid for.

* A hunter walks in with nothing but his flashlight
* He carries **six pieces** at a time, tools and equipment together, and never two of the same
* A pack of salt is one piece, however many piles are left in it
* The head cam is worn and takes up no room
* What a hunter carried goes back on the rack on its own when the ghost takes him or he leaves

```lua
Config.Base.equipment = {
	enabled = true, -- false hands everything out at the start, the way it is without a base
	carry = 6, -- Pieces one hunter can carry at a time, tools and equipment together, 0 for no limit
	free = {"headcam"}, -- These take up no room
	shoplimit = true, -- A hunter cannot carry more of one thing than its `limit` in Config.Shop

	tools = {
		enabled = true, -- false and everybody simply has the tools, only the shop equipment waits on the rack
		count = 0, -- How many of each tool lie there. 0 puts out one for every hunter in the team
		carry = true -- false and tools never count into `carry`, a hunter can take one of each on top
	}
}
```

Where every kind of piece lies on the shelves is `Config.Base.equipment.slots`.

### Monitors and the evidence board

| Screen             | What it shows                                                                                                                       |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
| **Left monitor**   | The video cameras and head cams the team has set up                                                                                 |
| **Middle monitor** | The ghost's activity from 0 to 10, with a graph of the last three minutes. A hunt always shows 10                                   |
| **Right monitor**  | The pulse and the sanity of every hunter. A racing pulse is a hunter losing his nerve, a flat line is a hunter the ghost took       |
| **Laptop**         | The motion sensors and when each one went off                                                                                       |
| **Evidence board** | A page out of the journal: the evidence the team has marked, the ghosts that are still possible, the objectives and the last photos |

Everything on the screens follows `Config.Language`.

```lua
Config.Base.screens = true -- false leaves every screen the way the models come

Config.Base.activity = {
	fade = 25, -- Seconds after which the activity drops to half when the ghost stays quiet
	scale = 1.6 -- How fast it climbs
}
```

### Camera feeds

Walk up to a monitor and press `E` to look through a video camera or a head cam. You hear what happens around the camera, not around the tent, and orbs show on a feed like through the hand camera. A caught player can watch too.

| Key                | Action                   |
| ------------------ | ------------------------ |
| Left / right arrow | Switch between the feeds |
| Mouse              | Turn a video camera      |
| Mouse wheel        | Zoom                     |
| `H`                | Night vision             |
| Backspace          | Step back                |

```lua
Config.Base.feeds = {
	enabled = true, -- false also takes the video camera and the head cam out of the shop
	caught = true, -- A caught player can use the monitors as well
	distance = 1.8,
	orbs = true,
	night = true,
	timecycle = "scanline_cam_cheap", -- GTA timecycle modifier laid over a feed, "" for a clean picture
	strength = 1.0
}
```

### Pieces and layout

`Config.Base.props` leaves single pieces out (the desk, the rack, the monitors, the laptop, the board), `Config.Base.layout` moves every piece inside the tent and `Config.Base.lights` sets the lantern, the glow of the screens and the lamp on the evidence board.

***

## Ghosts

10 ghosts are included. Every hunt picks one at random.

| Ghost           | Evidence                         | Behaviour                                                     |
| --------------- | -------------------------------- | ------------------------------------------------------------- |
| **Poltergeist** | EMF 5, Orbs, Writing             | Throws whatever it can reach, several things at once          |
| **Banshee**     | Freezing, Orbs, Silhouette       | Picks one victim and hunts nobody else                        |
| **Shade**       | EMF 5, Freezing, Writing         | Does nothing while two or more players are in its room        |
| **Wraith**      | EMF 5, Spirit box, Silhouette    | No footsteps when hunting, whispers a lot                     |
| **Demon**       | Freezing, Spirit box, Writing    | Hunts early and often, may not stop until it takes someone    |
| **Revenant**    | Orbs, Spirit box, Silhouette     | Slow until it sees you, then very fast                        |
| **Phantom**     | Freezing, Spirit box, Silhouette | Seeing it costs sanity, almost invisible when hunting         |
| **Mare**        | Freezing, Orbs, Writing          | Puts out the lights, blows the fuse, hunts sooner in the dark |
| **Yurei**       | EMF 5, Orbs, Silhouette          | Drains sanity fast, plays with the doors                      |
| **Changeling**  | EMF 5, Spirit box, Writing       | Always shows orbs it does not have, lies on the ghost board   |

### Adding your own ghost

Everything is in `configs/ghosts.lua`. Copy a ghost, give it a new name and change what it leaves and how it behaves:

```lua
["poltergeist"] = {
	enabled = true, -- false leaves it out entirely
	label = "Poltergeist",
	description = "Loud and restless. Throws whatever it can reach.",
	image = "img/ghosts/poltergeist.webp", -- Picture in the journal, inside html/
	lore = "It feeds on noise and chaos.",
	emf = true, -- EMF level 5
	mintemp = 4.0, -- Below 0 is the freezing evidence
	orbs = true,
	spiritbox = false,
	writing = true,
	projector = false,
	huntfear = 25, -- Average team sanity in % below which it can start hunting
	huntspeed = 1.0,
	eventmultiplier = 1.25, -- How often it does anything at all
	throwmultiplier = 3.5,
	targetslone = false,
	events = {burst = 2.0}, -- How much more often it picks a single event
	weight = 1.0 -- How likely it is to be picked
}
```

| Option                              | What it does                                                                                                                                  |
| ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `forced`                            | One evidence that is never hidden, whatever the difficulty                                                                                    |
| `fake`                              | One evidence the ghost does not have but shows anyway                                                                                         |
| `targetslone`                       | Goes after the player furthest from the rest of the team                                                                                      |
| `onlytarget`                        | Picks one victim on its first hunt and hunts nobody else                                                                                      |
| `groupshy`                          | No events and no hunts while two or more players are in its room                                                                              |
| `silenthunt`                        | No footsteps while it hunts                                                                                                                   |
| `hiddenhunt`                        | Almost invisible while it hunts                                                                                                               |
| `sighthunt`                         | Slow while it cannot see its target, fast once it can                                                                                         |
| `relentless`                        | Chance a hunt against a player with no sanity does not stop until somebody is caught                                                          |
| `huntcooldown`                      | Shorter or longer break between two hunts                                                                                                     |
| `drain`                             | How fast sanity drains while it is around                                                                                                     |
| `seenfear`                          | Extra sanity lost every time a player sees it                                                                                                 |
| `darkhunt`                          | Hunts sooner while the fuse is blown                                                                                                          |
| `lightsout` / `lightsoutany`        | Puts out the lights more often, in its room or in the whole house                                                                             |
| `ghostboardcost` / `ghostboardlies` | Cheaper questions on the ghost board, or wrong answers                                                                                        |
| `nosalt`                            | Never leaves a footprint in salt (Wraith)                                                                                                     |
| `nosensor`                          | Never sets off a motion sensor (Phantom)                                                                                                      |
| `crucifixrange`                     | Multiplies the range of the crucifix. The Demon needs it twice as close, the Banshee is stopped from further away                             |
| `incense`                           | Multiplies how long incense holds it back. Half as long on the Revenant, longer on the Yurei                                                  |
| `pacing`                            | How often it paces around its room, which is what steps in salt and trips sensors. The Poltergeist never stands still, the Shade hardly moves |
| `tamper`                            | How often it goes for the team's equipment                                                                                                    |
| `equipment`                         | A sentence about all that, added to its page in the journal while the shop is on                                                              |
| `rite`                              | The acts of its exorcism, in their order. See [The Exorcism](#the-exorcism)                                                                   |
| `grabs`                             | How it may lay hands on a hunter. See [When the Ghost Comes Close](#when-the-ghost-comes-close)                                               |

{% hint style="warning" %}
No two ghosts may leave the same 3 evidences, and every ghost should leave exactly 3. The server checks both when it starts and prints what is wrong into the console.
{% endhint %}

The ghost's body, how see-through it is, its glow and how it moves between rooms are in `Config.Ghost`. `models` takes any ped, one is picked at random every hunt.

***

## Sanity

Every player has his own sanity. It starts full and drains for as long as he is inside - faster in the ghost's room and when he is alone. Scares cost sanity to the players close enough to live through them. Standing next to a light that is on calms a player down.

The lower the team's average, the more the ghost does. Below the ghost's own `huntfear` it can start a hunt, and it goes after the players with the least sanity first.

```lua
Config.Fear = {
	start = 100.0,
	drain = 0.16, -- Lost every second just for being in the house
	ghostroom = 0.3, -- Extra per second in the ghost's room
	alone = 0.15, -- Extra per second with nobody else close
	alonedistance = 8.0,
	spiritbox = 3.0, -- Lost every time the ghost answers the spirit box
	scare = 2.0, -- Lost on every scare event the team lives through
	jumpscare = 5.0,
	radius = 10.0 -- Scares only cost sanity to players this close
}
```

***

## Ghost Events

The ghost does something every few seconds - from `slowest` at full sanity to `fastest` at none. `weight` is how likely each event is compared to the others, `0` turns one off.

| Event        | What happens                                                                                                   |
| ------------ | -------------------------------------------------------------------------------------------------------------- |
| `flicker`    | The lights flicker for everybody inside                                                                        |
| `slam`       | A door bangs shut                                                                                              |
| `creak`      | A door slowly swings open on its own                                                                           |
| `throw`      | Something near the ghost flies off a shelf - throwables from the creator and loose things already in the house |
| `burst`      | Several things fly one after another                                                                           |
| `knock`      | Three knocks, heard from where the ghost is                                                                    |
| `footsteps`  | Footsteps walk from the ghost towards one player                                                               |
| `whisper`    | One player hears a whisper right next to his ear                                                               |
| `lights`     | A lamp or candle goes out                                                                                      |
| `radio`      | A radio switches itself on                                                                                     |
| `tv`         | A TV switches itself on                                                                                        |
| `phone`      | A phone starts ringing                                                                                         |
| `manifest`   | The ghost shows itself in its room - the moment for the camera                                                 |
| `walk`       | The ghost walks out of its room and fades away                                                                 |
| `apparition` | One player sees it standing somewhere it should not be                                                         |
| `power`      | The ghost blows the fuse. Every lamp goes out until somebody turns the power back on at the fuse box           |
| `critters`   | The rats near the ghost scatter                                                                                |
| `rocking`    | A rocking chair starts rocking on its own                                                                      |
| `jumpscare`  | One player with low sanity gets a jumpscare                                                                    |
| `mimic`      | The false teammate - the ghost stands in the house looking like another hunter                                 |
| `grab`       | The ghost lays hands on one player, see [When the Ghost Comes Close](#when-the-ghost-comes-close)              |

```lua
Config.Events = {
	slowest = 50, -- Seconds between events at full sanity
	fastest = 16, -- Seconds between events at no sanity left
	first = 40, -- Seconds after the first player walks in before the ghost does its first thing

	list = {
		flicker = {weight = 22, duration = 2500},
		throw = {weight = 30, force = 9.0, radius = 7.0, world = 0.6, maxsize = 1.2},
		jumpscare = {weight = 7, fear = 65, cooldown = 75}
		-- ...
	}
}
```

### Jumpscares

8 types, each with its own sound, timecycle, screen effect and camera: `face`, `behind`, `dark`, `rush`, `stepper`, `drop`, `side` and `crawler`. Every one ends with a sting - the camera snaps onto the ghost's face and zooms in. All of it is in `Config.Jumpscares` and `Config.JumpscareCinematic`.

### Hallucinations

Below `sanity` a player starts seeing and hearing things that are not there. Only he notices them: knocking behind him, footsteps, a whisper, the ghost at the edge of his view, the room swaying, his lights flickering - and **fake hunts** that look real and cannot catch him.

```lua
Config.Hallucinations = {
	enabled = true,
	sanity = 35,
	interval = {35, 80},
	hunt = {enabled = true, sanity = 20, chance = 0.2, duration = 12}
}
```

***

## Hunts

When the team's sanity is low enough the ghost goes after one of them. Lightning hits, the lights go mad, the exit doors lock, and after a few seconds the ghost appears and walks the house. Whoever it catches is out of the investigation.

* **Hide** in a wardrobe - a ghost cannot find a hidden player
* Flashlights flicker while the ghost is close, and its footsteps get louder
* Candles are blown out and lamps flicker when it walks past
* A caught player gets one of several endings, is put outside and can [spectate](#spectating)
* With `Config.Voice` on, a player talking close to the ghost becomes its target

```lua
Config.Hunt = {
	chance = 0.35, -- Chance every event tick that a hunt starts once sanity is below the ghost's huntfear
	duration = 22, -- Seconds a hunt lasts
	cooldown = 60, -- Seconds before the next one can start
	catchdistance = 1.3,
	lockexits = true, -- Doors marked "exit" in the creator lock for the whole hunt
	grace = 3, -- Seconds between the hunt starting and the ghost appearing
	pace = 1.4, -- 1.0 walks, 2.0 runs, 3.0 sprints
	caughtreward = 0.5, -- A caught player still gets this share of his reward
	kill = false, -- true = a caught player really dies and your framework's death takes over
	lockout = true, -- true = a caught player cannot get back in
	relentless = {enabled = true, sanity = 0, maxtime = 120}
}
```

### Barriers

For doorways with no real door. Mark the opening in the creator and nobody gets through it while the ghost hunts.

```lua
Config.Barriers = {
	enabled = true,
	onlyhunt = true, -- false = the barriers hold the team in for the whole investigation
	push = 0.55,
	notify = true
}
```

***

## When the Ghost Comes Close

At low sanity some ghosts lay hands on a hunter. The ghost can drag him across the floor by the leg, hang him from the ceiling, lift him by the throat, pin him to a wall or walk into him and possess him. It costs sanity, not health, and the whole team sees it.

* Only a ghost with the grab under `grabs` in `configs/ghosts.lua` can do it
* How often it comes is `grab` in `Config.Events.list`. The lower the sanity, the more likely it gets
* The grabs themselves are `drag`, `hoist`, `choke`, `pin` and `possess` in `Config.Jumpscares`

```lua
Config.Grabs = {
	enabled = true, -- false and no ghost ever lays hands on anybody
	camera = true, -- The camera steps out of the hunter while the ghost holds him
	shared = true, -- The rest of the team sees the ghost holding him
	alpha = {190, 230} -- How see through the ghost is while it holds a hunter
}
```

### The false teammate

With two hunters or more, the ghost sometimes takes the shape of another hunter. It stands with its back turned on an apparition point or a ghost spot. Walk up to it or watch it for too long and its head turns all the way round. Then it is gone, or it comes for you. Only one player sees it, and a photo of it counts as a photo of the ghost. It is `mimic` in `Config.Events.list`.

### Apparitions and endings

What the ghost does when it shows itself is in `Config.Apparitions`. It can crawl across the ceiling, crawl on hands and toes, or stand in a corner with its face to the wall. Every act and walk has a `weight`, 0 turns it off.

A hunter caught in a hunt gets one of several endings, not always the same scene:

```lua
Config.Hunt.death.styles = {"lunge", "drop", "stepper", "dark", "choke"}
```

### Scared hunters

During a hunt, and when sanity is very low, hunters walk and run the way scared people do.

```lua
Config.Scared = {
	enabled = true,
	hunt = true, -- During a hunt, for every hunter inside the house
	sanity = 15, -- And all the time below this sanity. 0 turns it off
	rite = true -- And near the seal while the ghost burns in it
}
```

***

## The Exorcism

The exorcism is optional. A team that knows which ghost it is can banish it for good, and is paid more for it.

{% stepper %}
{% step %}

## Mark the ghost

Mark the ghost in the journal. Its page shows its rite: the order of the bell, the holy water and the cross.
{% endstep %}

{% step %}

## Put the kit down

Put the exorcism kit down near the ghost's room. With `Config.Mode = "full"` it lies on the rack. Otherwise the team has one from the start, on key `8`.
{% endstep %}

{% step %}

## Draw the seal

Take the chalk out of the kit and draw the seal on the floor of the ghost's room.
{% endstep %}

{% step %}

## Light the candles

Carry the candles to the marks on the edge of the seal and light them.
{% endstep %}

{% step %}

## Follow the rite

Use the bell, the water and the cross at the seal in the ghost's order. After every act a hunter reads the verse from the book.
{% endstep %}

{% step %}

## Banish it

The last verse banishes the ghost. The house goes quiet for the rest of the hunt.
{% endstep %}
{% endstepper %}

**The ghost fights back** while the rite runs. It blows candles out, throws the reader away from the seal, pulls hunters closer and hunts after every verse but the last. A hunter standing in the burning seal cannot be taken while a candle burns.

**One wrong act**, or the last candle out, and the rite fails. The ghost is enraged for the rest of the hunt: it hunts earlier and does more.

The journal has an **Exorcism** tab that explains every step during the hunt. The rite of every ghost is `rite` in `configs/ghosts.lua`:

```lua
rite = {"bell", "cross", "bell"}
```

```lua
Config.Exorcism = {
	enabled = true, -- false takes the kit, the journal tab and the handbook pages away
	attempts = 1, -- Rites one team may begin in one hunt
	needguess = true, -- The team has to mark a ghost in the journal before the first act counts
	reward = 2.0, -- The reward is multiplied by this when the ghost was banished
	quiet = true, -- A banished ghost is gone for the rest of the hunt

	kit = {count = 1, chalk = 2},
	candles = {count = 4, solo = 3, blow = 10},
	verse = {time = 22, hunt = true},
	gusts = {enabled = true, from = 2},
	pulls = {enabled = true, from = 1},

	fail = {
		hunt = true, -- A failed rite starts a hunt on the spot
		huntfear = 25, -- An enraged ghost hunts this much earlier, in % of sanity
		events = 1.5
	}
	-- ...
}
```

Everything else, from the seal and the candles to the music and the look of the scene, is commented in `config.lua`, section 17.

***

## Haunted Objects

Everything is placed in the [Location Creator](#location-creator) and set up in `configs/objects.lua`. Each object is spawned for the team only, for as long as the investigation runs.

| Object                                   | What it does                                                                                                                                         |
| ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Ghost board**                          | Ask a question and the planchette spells the answer for the whole team. Every question costs sanity. Leave without "Goodbye" and the board is cursed |
| **Tarot cards**                          | Draw cards until the deck is empty. Every card does something different, good or bad                                                                 |
| **Voodoo doll**                          | Every use pushes a random pin in and forces the ghost to react. The heart pin starts a hunt                                                          |
| **Music box**                            | Wind it up by hand with the mouse. The tune plays through the house and the ghost hunts when it ends                                                 |
| **Mirror**                               | Whisper "Bloody Mary" three times. The ghost writes on the mirror in blood and is angry for a while                                                  |
| **Old phone**                            | The ghost makes it ring. Pick it up and a voice whispers the name of the ghost's room                                                                |
| **Radio**                                | Plays and lures the ghost - it does things more often                                                                                                |
| **TV**                                   | Static on the screen. The ghost switches it on by itself. Works with TVs already in the map too                                                      |
| **Coffin**                               | A gamble: a clue or a jumpscare                                                                                                                      |
| **Cursed teddy**                         | Squeeze it and it laughs. Near the ghost, the ghost shows itself                                                                                     |
| **Old diary**                            | Reading it reveals one piece of the ghost's evidence                                                                                                 |
| **Fuse box**                             | The house's power. Too many lights on and the fuse blows by itself                                                                                   |
| **Rats**                                 | Scatter squeaking when a player or the ghost comes near                                                                                              |
| **Rocking chair**                        | Starts rocking on its own when the ghost is near                                                                                                     |
| **Wardrobe / hiding point**              | Climb in and watch the room through the gap in the doors                                                                                             |
| **Lamp / light / light switch / candle** | The team switches them on, the ghost switches them off. Bulbs can burst                                                                              |
| **Throwable**                            | Something small the ghost throws                                                                                                                     |
| **Apparition point**                     | A spot where the ghost is seen standing                                                                                                              |

Every object has `uses`, `cooldown`, `fear` and `distance`, and its own options below that.

### Tarot cards

```lua
Config.Tarot = {
	enabled = true,
	deck = 10, -- Cards in the deck
	cards = {
		tower = {weight = 20},
		wheel = {weight = 20, amount = 25.0}
		-- ...
	}
}
```

| Card                 | What it does                                               |
| -------------------- | ---------------------------------------------------------- |
| The Tower            | The ghost does something right away                        |
| The Wheel of Fortune | Burns green or red - the player gains or loses sanity      |
| The Fool             | Pretends to be another card. Nothing happens               |
| The Devil            | A jumpscare hits the player                                |
| Death                | A hunt starts and goes after this player                   |
| The Hermit           | The ghost is bound to its room and cannot hunt for a while |
| The Sun              | Sanity fully restored                                      |
| The Moon             | Sanity drops to zero                                       |
| The High Priestess   | Brings a caught teammate back, or spares the next one      |
| The Hanged Man       | The player is taken by the ghost                           |

The card art is in `html/img/tarot`. Who revives the player for The High Priestess is `Config.Ambulance`.

### Ghost board

14 questions are included: is it here, how old it is, is it close, how many of you are inside, does it know your name, what it wants, is it angry, when it will hunt, **where it is**, and "show yourself". Each has its own cost, and each can be changed, switched off or added in `configs/objects.lua`.

```lua
ghostboard = {
	questions = 8, -- How many questions the board answers before it burns out. "Goodbye" is free
	costgrow = 0.2, -- Every question already asked makes the next one cost 20 % more
	lowsanity = 20, -- A player below this sanity who asks makes the planchette fly off and the ghost hunt him
	cursehunt = true, -- true = leaving the board without "Goodbye" starts a hunt on that player
	silence = 0.2, -- Chance the ghost ignores a question
	annoy = 0.25 -- Chance the ghost gets annoyed after answering and does something around the board
}
```

### Lights

```lua
Config.Bulbs = {
	enabled = true,
	switch = 0.05, -- Chance a bulb bursts the moment a player switches it on
	ghost = 0.3, -- Chance the ghost bursts a bulb instead of only switching it off
	fear = 2.0
}
```

`fusebox.overload = 3` in `configs/objects.lua` - the fuse blows when more electric lights than this are on at once.

***

## The Journal

Opened with `J`. Every mark is shared with the whole team.

| Page              | What is on it                                                                                                                                                |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Evidence**      | Mark what the team found. Ghosts that do not fit are ruled out. Every ghost has its own page with its picture, evidence and behaviour. Pick your answer here |
| **What happened** | Everything the ghost did, with the time and the room                                                                                                         |
| **Objectives**    | The objectives and the bonus objectives with their rewards                                                                                                   |
| **Equipment**     | What every tool does                                                                                                                                         |
| **Extras**        | What the things from the shop do. Only while the shop is on                                                                                                  |
| **Base**          | What everything in the tent is for. Only at a house with a base                                                                                              |
| **Exorcism**      | Every step of the rite, during the hunt. Only while the exorcism is on                                                                                       |
| **Haunted items** | What every object in the house does                                                                                                                          |
| **Photos**        | Every photo the team took, with the room and the time                                                                                                        |
| **Team**          | The players and their sanity                                                                                                                                 |

```lua
Config.Journal = {
	style = "paper", -- "paper" = an old notebook with handwriting and photos, "classic" = the dark panel
	photos = {
		enabled = true,
		resource = "screenshot-basic",
		size = 800,
		quality = 0.6,
		max = 12 -- Photos kept in the journal, the oldest go first
	}
}
```

***

## Hunter's Handbook

A guide for your players, built into the game. It opens like a book in the middle of the screen and explains the job, the controls, the tools, the evidence, every ghost, sanity, hunts, the haunted objects, the equipment, the base, the tarot cards, the ghost board, the exorcism and the grabs.

| How it opens     |                                                                                                                      |
| ---------------- | -------------------------------------------------------------------------------------------------------------------- |
| `/ghosthandbook` | Anywhere, a hunt does not have to be running                                                                         |
| Book button      | At the top of the lobby window                                                                                       |
| Key              | None by default. Players bind one in **Settings > Key Bindings > FiveM**, or set a default in `Config.Keys.handbook` |

`ESC` or the X closes it, and it opens again on the page the player left. The pages follow your config: the shop, the base, the rack, setting the tent up and the exorcism are only in it when they are switched on.

**Translating the handbook.** Its texts are in `html/languages/handbook_en.json`. Copy the file to `handbook_<code>.json` in the same folder (for example `handbook_de.json`) and translate it. The book follows `Config.Language` and takes anything missing from the English file.

```lua
Config.Handbook = {
	enabled = true, -- false and it is not available at all: no command, no key, no button
	lobby = true -- A button with a book at the top of the lobby window opens it
}
```

***

## Difficulty

The leader picks one in the lobby. Every value is a multiplier on the normal settings.

```lua
Config.Difficulty = {
	enabled = true, -- false hides the choice and every hunt uses default
	default = "normal",
	levels = {
		{id = "easy", time = 1.25, drain = 0.7, events = 1.25, huntspeed = 0.9, huntduration = 0.85, huntfear = -5, evidence = 3, reward = 0.75},
		{id = "normal", time = 1.0, drain = 1.0, events = 1.0, huntspeed = 1.0, huntduration = 1.0, huntfear = 0, evidence = 3, reward = 1.0},
		{id = "nightmare", time = 0.8, drain = 1.5, events = 0.75, huntspeed = 1.15, huntduration = 1.2, huntfear = 10, evidence = 2, reward = 1.6}
	}
}
```

| Value                        | What it changes                                                      |
| ---------------------------- | -------------------------------------------------------------------- |
| `time`                       | The time limit                                                       |
| `drain`                      | How fast sanity drains                                               |
| `events`                     | The time between two things the ghost does                           |
| `huntspeed` / `huntduration` | How fast the ghost hunts and for how long                            |
| `huntfear`                   | How much sooner it starts hunting                                    |
| `evidence`                   | How many of its 3 evidences the ghost gives. The rest never shows up |
| `reward`                     | The money at the end                                                 |

Add as many levels as you like. Their names and descriptions are in `html/languages/en.json` under `difficulty`.

***

## Rewards & Bonus Objectives

```lua
Config.Rewards = {
	account = "money", -- "money" = cash, "bank", or any other account your framework has
	base = 500, -- For ending the investigation at all
	correct = 750, -- For naming the right ghost
	photo = 400, -- For a photo of the ghost
	fast = 300, -- For ending within fasttime minutes
	fasttime = 8,
	wrongpenalty = 0.5, -- The base reward is multiplied by this when the team named the wrong ghost

	items = {
		-- {name = "pumpkin_candy", count = 1, chance = 1.0}
	}
}
```

A banished ghost multiplies the reward by `Config.Exorcism.reward`, see [The Exorcism](#the-exorcism).

Every run `count` bonus objectives are picked at random and shown in the HUD. Objectives that cannot be done in this house are never picked.

```lua
Config.Bonus = {
	enabled = true,
	count = 5,
	list = {
		evidence = {weight = 10, reward = 400}, -- Mark every piece of evidence correctly
		board = {weight = 8, reward = 200}, -- Get an answer from the ghost board
		hide = {weight = 5, reward = 250}, -- Hide in a wardrobe while the ghost is hunting
		photo_mirror = {weight = 6, reward = 250} -- Photograph the writing on the mirror
		-- ...
	}
}
```

27 objectives are included: using every haunted object, hiding during a hunt, surviving a hunt with the whole team, naming the right ghost with nobody caught or with high sanity, and photo objectives - the rocking chair while it rocks, the music box while it plays, the ghost board while it moves and the writing on the mirror.

Five of them are about the equipment: stop a hunt with a crucifix, get a footprint in salt, catch the ghost on a motion sensor, hold it back with incense and photograph a footprint. They are only picked when somebody on the team packed that item.

The payout itself is `GiveRewardRTX` in `server/other.lua` - rewrite it for your own rewards.

***

## House Mode & City Mode

```lua
Config.Hunter = {
	mode = "house", -- "house" or "city"
	model = "s_m_m_scientist_01",

	city = {
		points = {
			vector4(308.14, -906.18, 28.36, 67.0)
		},
		arrivedistance = 12.0,
		traveltime = 15, -- Minutes the team has to reach the house. 0 for no limit
		waypoint = true,
		handin = 60 -- Minutes a finished report can still be handed in for its reward
	}
}
```

| Mode      | How it works                                                                                                                                                                                                                                                                                                               |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `"house"` | A ghost hunter stands outside every haunted house. The team is put together there, hunts and ends the investigation with him                                                                                                                                                                                               |
| `"city"`  | The ghost hunters stand in the city. A player picks a house from the **case board** with its photo and story, puts a team together and takes the case. Everybody gets a waypoint, the hunt starts on its own once the whole team is at the house, and the reward is paid when the report is brought back to a ghost hunter |

Blips for the houses and the ghost hunters are in the same section.

***

## Teams, Time & Instances

```lua
Config.Team = {
	maxplayers = 4, -- Players in one team, the leader included. 1 lets people hunt alone
	minplayers = 1,
	invitedistance = 15.0,
	invitetime = 30
}

Config.Session = {
	timelimit = 20, -- Minutes a team has before the ghost wins by default
	cooldown = 10, -- Minutes a player waits before he can start or join another hunt. 0 for none
	instanced = true,
	blackout = true, -- The power is out while the team is inside
	midnight = true, -- The team sees midnight while the hunt runs
	photorequired = false, -- true = the investigation cannot be ended until the ghost has been photographed

	leave = {enabled = true, distance = 120.0, grace = 10} -- A player who goes too far from the house drops out
}
```

| `instanced` |                                                                                                                                       |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| `true`      | Every team hunts in its own routing bucket. Any number of teams can hunt the same house at once and nobody else sees them             |
| `false`     | One team per house at a time, and everybody else sees them in there. Players close to the house see the ghost too, see `Config.Watch` |

### Midnight

`Config.Session.midnight` is on by default. The team sees midnight while the hunt runs, so a hunt started in the day still has a night sky behind the windows. Only the team sees it. When the hunt ends, the clock jumps to the time it would be now and your time script carries on. The server console says so when the resource starts.

Set it to `false` and Ghost Hunting never touches the time. The house is dark inside anyway, thanks to the blackout.

`Config.Hours` limits when hunts can start, on the game clock or the real one. Every house can have its own hours in the creator.

***

## Who Can Play

Off by default, so everybody can.

```lua
Config.Access = {
	enabled = false,

	ace = {enabled = false, permission = "ghosthunting.play"},
	jobs = {enabled = false, list = {"paranormal", "police"}},
	groups = {enabled = false, list = {"vip", "admin", "superadmin"}},
	identifiers = {enabled = false, list = {}},

	item = {enabled = false, name = "ghost_ticket"} -- An item every player has to carry. It is not taken away
}
```

A player gets in if he matches **any** of the enabled parts. The whole check is `CanPlayerStartHuntRTX` in `server/other.lua`.

***

## Spectating

A caught player watches his team while he waits outside. Left and right arrow switch between teammates, `V` switches between first and third person, Backspace stops.

```lua
Config.Spectate = {
	enabled = true,
	auto = true, -- true starts watching right after he is put outside
	firstperson = false
}
```

Spectating tells your anticheat first, see [Anticheat](#anticheat).

***

## Leaderboard

Opened from the lobby with the trophy button. Every finished hunt is counted per player: **solved, hunts, fastest solve and money earned**.

```lua
Config.Leaderboard = {
	enabled = true,
	top = 10
}

Config.Identifier = "framework" -- "framework" = every character counts on its own. "license", "discord", "steam" or "fivem" = one for all characters
```

***

## Location Creator

```
/ghostcreator
```

Opens the list of every haunted house. From there you can make a new one, edit one, teleport to it or delete it. Saving makes a house live for everybody - **no restart**.

### The house

| Part                  | What it is                                                                                                                                                                   |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Name** and **blip** | What the players see                                                                                                                                                         |
| **Ghost hunter**      | Outside, next to the front door. The team gathers here and comes back here to finish                                                                                         |
| **Base tent**         | Where the field tent stands. Point at the ground outside and turn the arrow to where the open front should look. Without it the house has no base, see [The Base](#the-base) |
| **House outline**     | The whole house from above, roof included. Inside it the power is out and the ghost can get you. Outside the team is safe                                                    |
| **IPL interior**      | For houses with no real door to the street. Place the entrance and the inside point, the team teleports in and out                                                           |
| **Look inside**       | How dark it is inside. Standard, Dim, Dark, Pitch black, Cold, Faded, or your own from `Config.Looks`                                                                        |
| **Hunting hours**     | Follow the config, any time, or its own hours                                                                                                                                |
| **About the house**   | Its story and a photo for the case board                                                                                                                                     |

### Rooms

At least two rooms, every room with at least one ghost spot.

* **Draw a room** - click the corners of the floor, then set the floor and the ceiling
* **From interior** - take the rooms straight from the interior by their room ID, nothing to draw. Several can be **merged** into one room
* **Add spots** - the places in that room the ghost can live on

### Doors and barriers

Aim at a door and click.

| Door       |                                            |
| ---------- | ------------------------------------------ |
| **Exit**   | Locks while the ghost hunts                |
| **Slam**   | The ghost bangs it shut and swings it open |
| **Locked** | Stays shut for the whole investigation     |

**Barriers** are for openings without a door - two corners on the floor and nobody gets through while the ghost hunts.

### Objects

Click an object and it shows up in front of you with a **gizmo**. The arrow keys switch the model where there is a choice. Lamps, candles and light switches have a live **light editor** - brightness, reach, colour and a spot beam, shown as you set them.

Wardrobes come in five models: the classic armoire, a dark wooden one, a worn white one, a metal locker and the armoire of the game itself. A model the game cannot load where the house stands is skipped and the next one is used.

### Free camera

Press `C` in any placing mode to fly the camera and aim from it.

```lua
Config.Creator = {
	raydistance = 25.0, -- How far away the laser can place a point
	defaultheight = 3.2, -- Height of a new room
	freecam = {enabled = true, key = 26, label = "C", speed = 2.0, maxdistance = 80.0},
	photo = {enabled = true, resource = "screenshot-basic", size = 960, quality = 0.75}
}

Config.Limits = {
	objects = 150,
	rooms = 32,
	spots = 12, -- Ghost spots in one room
	doors = 40,
	barriers = 20,
	points = 48 -- Corners of one room or of the house outline
}
```

{% hint style="info" %}
A photo of a house taken in the creator is saved into `html/img/locations` and shows up after the resource is restarted.
{% endhint %}

Houses can be written by hand too, in `configs/locations.lua`. Most servers never open it.

### Houses that come with the script

7 houses are ready to play: **Old House, Michael House, Hospital, Slaughterhouse, Franklin House, FIB** and **Manor House**. They are kept in `data/default_locations.json`, their photos in `html/img/locations`, and every one of them has a place for the base tent.

**Manor House** is made for the **Blackwood Manor** map by **Molo Modding**. It shows up on its own when the map is running.

They show up in the creator like any other house. Edit one and your version is saved and used from then on, delete one and it stays deleted. `defaults = false` in `Config.Storage` starts with no houses at all.

### Moving houses to another server

`ghostexport` in the **server console** writes every house the server has into `data/exported_locations.json`, in the shape of `data/default_locations.json`.

***

## Interface & Interaction

```lua
Config.Language = "English"
Config.InterfaceColor = "#ff7a1a" -- Accent colour of the whole interface
Config.HudPosition = "top-left" -- "top-left", "bottom-left" or "top-right"
Config.Currency = "$"
Config.CurrencySuffix = false -- true = 100 $ instead of $100
Config.InteractionSystem = 5

Config.Style = {
	menus = "paper", -- The lobby, the ghost hunter, the results and the leaderboard
	headshots = true -- Portraits of the players in the lobby, the journal and the results
}
```

| `InteractionSystem` | Prompt                                         |
| ------------------- | ---------------------------------------------- |
| `1`                 | Custom interaction                             |
| `2`                 | 3D text                                        |
| `3`                 | GTA Online style help                          |
| `4`                 | Floating help text                             |
| `5`                 | RTX prompt, matching the rest of the interface |

### Two styles

| Value       | Look                                                                                 |
| ----------- | ------------------------------------------------------------------------------------ |
| `"paper"`   | Old case files, a paper journal with handwriting and photos, a report on a clipboard |
| `"classic"` | Clean dark panels, like the HUD                                                      |

`Config.Style.menus` and `Config.Journal.style` are set separately, so any mix works. The HUD, the tools and the creator always stay dark.

### Prompts in the house

```lua
Config.WorldPrompts = {
	enabled = true, -- Prompts drawn in 3D over the object itself
	hint = true, -- A small dot over every usable object nearby, so the team can find them in the dark
	hintdistance = 6.0,
	walls = true -- Nothing shows and nothing can be used through walls or closed doors
}
```

### Your own HUD

While a player is in an investigation, the rest of your server's interface steps aside. Most HUDs need one line in `hide` and one in `show`. jg-hud, ZSX\_UIV2, 17mov\_Hud and CodeM mHud are already filled in:

```lua
Config.OtherHud = {
	enabled = true,
	radar = true, -- true hides the minimap during the investigation
	hide = {
		{export = "jg-hud", func = "toggleHud", args = {false}},
		-- ...
		-- {event = "yourhud:client:toggle", args = {false}},
		-- {export = "yourhud", func = "HideHud"}
	},
	show = {
		{export = "jg-hud", func = "toggleHud", args = {true}},
		-- ...
		-- {event = "yourhud:client:toggle", args = {true}},
		-- {export = "yourhud", func = "ShowHud"}
	},
	hotkeys = {
		enabled = true,
		list = {
			{resource = "ox_inventory", state = "invHotkeys", value = false},
			{resource = "qb-inventory", state = "inv_busy", value = true},
			-- ...
			{export = "tgiann-inventory", func = "SetFastSlotsEnable", args = {false}, restore = {true}}
		}
	}
}
```

**The hotbar.** The number keys pick the ghost hunting tools, so your inventory's hotbar is switched off during the investigation and comes back afterwards. ox\_inventory, qb-inventory, ps-inventory, lj-inventory and tgiann-inventory are filled in. Every line is only used when that inventory runs.

### Your weather script

Weather scripts keep switching the street lights back on. `Config.OtherWeather` pauses the weather script for each player in a hunt, and syncs it again afterwards. Filled in: qb-weathersync, qbx\_weathersync, vSync, av\_weather, cs\_weather, eternity\_tiempo, night\_natural\_disasters and weathersync. Only the scripts you run are used.

{% hint style="info" %}
Renewed-Weathersync and cd\_easytime are not paused, because pausing them moves the clock. The power is kept out for the team instead (`Config.OtherWeather.lights`).
{% endhint %}

```lua
Config.OtherWeather = {
	enabled = true,
	check = 2, -- Seconds between checks that the script stays paused
	lights = {keep = true, interval = 0},
	list = {
		{resource = "qb-weathersync", keeptime = true,
			pause = {{event = "qb-weathersync:client:DisableSync"}},
			resume = {{event = "qb-weathersync:client:EnableSync"}, {server = "qb-weathersync:server:RequestStateSync"}}},
		-- ...
		-- {resource = "yourweather", pause = {{event = "yourweather:client:pause", args = {true}}}, resume = {{event = "yourweather:client:pause", args = {false}}}},
	}
}
```

It all runs through `HideOtherHudRTX`, `ShowOtherHudRTX`, `PauseWeatherRTX` and `ResumeWeatherRTX` in `client/other.lua`.

Notifications are `Notify()` in `client/other.lua`, where your own notification system goes.

### Keys

```lua
Config.Keys = {
	interact = 38,
	interactlabel = "E",

	slots = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "MINUS", "EQUALS"}, -- The inventory bar with Config.Mode = "full"

	thermometer = "1",
	emf = "2",
	spiritbox = "3",
	camera = "4",
	holster = "X",
	use = "G",
	camerafilter = "H",
	flashlight = "F",
	journal = "J",
	book = "B",
	projector = "K",
	gear1 = "5", -- The first item held in the hand (pills, crucifix or incense)
	gear2 = "6",
	gear3 = "7",
	ritekit = "8", -- Put the exorcism kit down in front of you
	salt = "O",
	sensor = "L",
	videocam = "I",
	tableback = "R", -- Put the piece you are looking at back on the rack
	accept = "Y",
	decline = "N",
	spectate = "U",
	dropcase = "DELETE",
	hud = "F7",
	handbook = "" -- The Hunter's Handbook. "" for no default key
}
```

With `"classic"` and `"base"` every tool and every piece of equipment has its own key. The held items fill `gear1` to `gear3` in the order pills, crucifix, incense with what the player took into the hunt, so the keys never skip a number. With `"full"` everything a hunter carries has a slot in the bar and `slots` are its keys.

{% hint style="info" %}
Everything a player presses during a hunt is a key mapping. Every player can rebind it in **Settings > Key Bindings > FiveM**.
{% endhint %}

***

## Sounds

Every sound the resource makes is in `Config.Sounds`. Put a file into `html/sounds` and write its name there.

```lua
Config.Sounds = {
	jumpscare = {file = "jumpscare", volume = 1.0},
	whisper = {file = "whisper", volume = 1.0},
	hunt = {file = "hunt", volume = 1.0}
	-- ...
}

Config.Ambient = {
	enabled = true, -- Music inside every haunted house
	file = "sounds/ambient.mp3",
	volume = 0.16,
	huntvolume = 0.05, -- The music ducks to this while the ghost hunts
	mutegta = true -- Silences the city outside while inside the house
}

Config.SoundDistance = {
	near = 1.5,
	curve = 2.0,
	walls = true, -- A sound behind a wall or a closed door is quieter and muffled
	wallvolume = 0.45,
	stereo = 0.8 -- How far left or right a sound can pan
}
```

{% hint style="info" %}
A sound left as `""` or a file that is missing is made by the interface itself, so everything works without a single file.
{% endhint %}

***

## Storage

```lua
Config.Storage = {
	mode = "database", -- "database" or "file"
	resource = "oxmysql",
	defaults = true, -- false and the houses the script comes with are not loaded
	defaulttents = true -- A house of ours that you changed in an older version takes the tent place from ours
}
```

| Mode         | Where houses and the leaderboard live                                                                              |
| ------------ | ------------------------------------------------------------------------------------------------------------------ |
| `"database"` | The tables `rtx_ghost_locations` and `rtx_ghost_stats`, created on their own. Houses survive updating the resource |
| `"file"`     | `data/locations.json` and `data/stats.json` inside the resource. Keep a copy when you update                       |

If `"database"` is set but `oxmysql` is not running, the files are used until it is. On the first start with an empty database, everything already in the files is copied over on its own. Another database resource is a few lines in `DatabaseQueryRTX` in `server/other.lua`. `install.sql` holds the same two tables, for servers that would rather set the database up by hand.

The houses the script comes with are not in your storage. They are read from `data/default_locations.json` on every start, next to your own. Only a house of ours that you edit or delete is saved, as your version of it.

***

## Commands

| Command          | Who                                         | What it does                                           |
| ---------------- | ------------------------------------------- | ------------------------------------------------------ |
| `/ghostleave`    | Everybody                                   | Walk out of a running hunt. The team carries on        |
| `/ghosthandbook` | Everybody                                   | The Hunter's Handbook                                  |
| `/ghostcreator`  | Admins                                      | The location creator                                   |
| `ghostexport`    | Server console                              | Writes every house into `data/exported_locations.json` |
| `/ghostdebug`    | Admins, only with `Config.DebugMode = true` | Test command for the middle of a hunt                  |

```lua
Config.Commands = {
	creator = "ghostcreator",
	leave = "ghostleave",
	handbook = "ghosthandbook",
	export = "ghostexport",
	debug = "ghostdebug"
}
```

Rename any of them, or set it to `""` and it is never registered.

### Testing

`Config.DebugMode = true` prints what the server decides into the server console (hunts, events, saves). While it is on, players who may use the creator also get `/ghostdebug` with one word after it. Leave it off on a live server.

| Word                            | What it does                                                                                                                                                                    |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `sensor`                        | Sets off every motion sensor                                                                                                                                                    |
| `salt`                          | The ghost walks through the nearest pile                                                                                                                                        |
| `here`                          | The ghost passes where you stand                                                                                                                                                |
| `pace`                          | The ghost paces around its spot                                                                                                                                                 |
| `tamper`                        | The ghost goes for a piece of equipment right now                                                                                                                               |
| `hunt`                          | A hunt the ghost starts on its own, so a crucifix or incense can stop it                                                                                                        |
| `forcehunt` / `stophunt`        | A hunt on you that nothing stops / ends the hunt                                                                                                                                |
| `calm`                          | Clears the incense and the wait between hunts                                                                                                                                   |
| `sanity 20`                     | Sets your sanity                                                                                                                                                                |
| `give`                          | Hands you every shop item again                                                                                                                                                 |
| `info`                          | The ghost, its room, how far it is and what you carry                                                                                                                           |
| `hud`                           | Hides everything the resource draws on the screen and the radar, for taking pictures. The same word again brings it back                                                        |
| `showcase`                      | Dresses a hunt up for a picture: cameras and motion sensors in the house, a full team, a moving activity graph and a rack with equipment for four. `showcase off` takes it away |
| `rite` / `ritekit` / `riteskip` | Tests the exorcism. `ritekit` puts an open kit at your feet                                                                                                                     |
| `ghost` / `room`                | Picks the ghost and its room                                                                                                                                                    |
| `scare` / `grab` / `mimic`      | A jumpscare, a grab or the false teammate right now                                                                                                                             |

`Config.DebugDelay` is the time between typing a word and it happening, so the camera can get ready. `Config.DebugNotify = false` keeps the notifications off a recording.

***

## Permissions

```lua
Config.CreatorPermissions = {
	ace = {enabled = true, permission = "ghostcreator.use"},
	groups = {enabled = false, list = {"admin", "superadmin", "god"}},
	job = {enabled = false, name = "builder"},
	identifiers = {enabled = true, list = {}}
}
```

A player can use the creator if **any** enabled part says yes:

* he has the ACE `ghostcreator.use`
* his ESX group / QBCore permission is in `groups`
* he has the builder job
* one of his identifiers is in `identifiers`

***

## Language

Every line of text is open source: notifications in the `language` folder, the whole interface in `html/languages`. 18 languages are included:

English, German, Spanish, French, Czech, Polish, Portuguese, Italian, Russian, Turkish, Korean, Dutch, Chinese, Romanian, Hungarian, Thai, Japanese, Arabic

```lua
Config.Language = "German"
```

Anything missing in a language falls back to English. The Hunter's Handbook has its own file, see [Hunter's Handbook](#hunters-handbook).

***

## Open-Source Files

This product is protected by the Escrow System. You can still configure almost everything:

| File                          | What is in it                                                                                                                       |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `config.lua`                  | Everything configurable, fully commented                                                                                            |
| `configs/ghosts.lua`          | Every ghost type, its evidence, its behaviour, its rite and its grabs                                                               |
| `configs/objects.lua`         | Everything the creator can place, with its models and what it does                                                                  |
| `configs/locations.lua`       | Houses written by hand (optional)                                                                                                   |
| `data/default_locations.json` | The houses the script comes with                                                                                                    |
| `language/*.lua`              | Notification texts                                                                                                                  |
| `html/languages/*.json`       | Interface texts and the Hunter's Handbook                                                                                           |
| `client/other.lua`            | Notifications, prompts, death check, hiding your HUD, the hotbar, pausing your weather script, voice check, revive, anticheat hooks |
| `server/other.lua`            | Money, the payment for the shop, items, jobs, groups, access check, creator check, rewards, database, Discord logs, anticheat hooks |
| `html`                        | The interface                                                                                                                       |

### Discord logs

Switched on in `server/other.lua`, in `LogsRTX`. Started investigations, caught players and finished investigations with the ghost, the answer, the time and the reward. The webhook lives there too - never put it in `config.lua`, that file is sent to every player.

### Death and revive

How a dead or downed player is detected is `IsPlayerDownRTX()` in `client/other.lua` and `Config.Death`, open for your own ambulance script. A player who dies in the house any other way counts as caught.

***

## Anticheat

A hunt uses things an anticheat can see as cheating: script cameras, spectator mode and teleports. Each one tells your anticheat first, and again when it is over.

```lua
-- server/other.lua
function OnSpectateRTX(playersource, ondata, kinddata) end

-- client/other.lua
function OnSpectateRTX(ondata, targetdata, kinddata) end
```

`ondata` is `true` right before it starts and `false` right after it ends.

| Kind       | What it is                                                                                                                                                                                                                            |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `camera`   | Any script camera: jumpscares, grabs, the catch scene, the Ghost board, the music box, the camera zoom, the camera feeds, spectating and the creator's free camera. It fires before the camera is created, and `false` once it is off |
| `feed`     | The camera feeds at the base. The server checks the player is in the hunt, calls the hook, and then the feed opens                                                                                                                    |
| `spectate` | A caught player watching his team. The server checks he is in the hunt and caught, calls the hook, and then spectating starts. On the client it fires again with the teammate's server id every time he switches                      |

If the player disconnects in the middle of one, the server calls it with `false`.

**Teleports.** Houses built in an IPL move the team between the entrance and the inside spot. The server calls `OnTeleportRTX(source, kind, coords)` before the player is moved. On the client `BeforeTeleportRTX` and `AfterTeleportRTX` fire around it.

{% hint style="success" %}
Put your anticheat's allow / bypass call into `OnSpectateRTX` and `OnTeleportRTX` in `server/other.lua`. Allow it on `true` and take it back on `false`. A teleport is over at once, so a few seconds are enough.
{% endhint %}

***

## Exports & Events

### Client exports

```lua
exports.rtx_ghosthunting:IsHunting() -- true while the player is in an investigation
exports.rtx_ghosthunting:IsCreatorOpen()
exports.rtx_ghosthunting:LeaveInvestigation() -- leaves the lobby or the investigation
exports.rtx_ghosthunting:ShowNotify(text, title, type)
```

### Server exports

```lua
exports.rtx_ghosthunting:IsPlayerHunting(source)
exports.rtx_ghosthunting:GetLocations() -- every haunted house
exports.rtx_ghosthunting:GetInvestigation(source) -- {location, members, alive, inside, hunting, difficulty} or nil
exports.rtx_ghosthunting:KickFromInvestigation(source) -- takes a player out of his lobby or investigation
exports.rtx_ghosthunting:EndInvestigation(source) -- ends the investigation of that player's team, counted as lost
```

### Server events

```lua
AddEventHandler("rtx_ghost:server:investigationStarted", function(source, location) end)
AddEventHandler("rtx_ghost:server:caught", function(source) end)
AddEventHandler("rtx_ghost:server:investigationFinished", function(source, result) end)
AddEventHandler("rtx_ghost:server:teleport", function(source, kind, coords) end) -- IPL houses, for your anticheat
AddEventHandler("rtx_ghost:server:spectate", function(source, on, kind) end) -- a script camera, a feed or spectating, for your anticheat
```

`result` holds `reason`, `location`, `locationid`, `ghost`, `ghostid`, `guess`, `guessid`, `correct`, `photo`, `alive`, `minutes`, `reward`, `breakdown` and `bonus`.

### Client events

```lua
AddEventHandler("rtx_ghost:client:investigationStarted", function(location) end)
AddEventHandler("rtx_ghost:client:investigationEnded", function(result) end)
AddEventHandler("rtx_ghost:client:hunt", function(started) end) -- true when the ghost starts hunting, false when it stops
AddEventHandler("rtx_ghost:client:caught", function() end)
AddEventHandler("rtx_ghost:client:hiding", function(hidden) end)
AddEventHandler("rtx_ghost:client:house", function(inside) end) -- walking into and out of the house
AddEventHandler("rtx_ghost:client:otherHud", function(hidden) end)
AddEventHandler("rtx_ghost:client:otherWeather", function(paused) end)
AddEventHandler("rtx_ghost:client:spectate", function(on, target, kind) end)
AddEventHandler("rtx_ghost:client:teleport", function(when, coords) end) -- "before" and "after"
```

***

## Updating

Replace every file of the resource except the ones you changed yourself. With file storage keep `data/locations.json` and `data/stats.json`, your houses and the leaderboard are in them. Nothing has to be done to your houses. Restart the whole server afterwards, not only the resource - new models are streamed and players have to reconnect to get them.

### From 1.2.x to 2.0.0

Files that have to be replaced:

* `fxmanifest.lua`, `client/main.lua`, `server/main.lua`, `shared/main.lua`, `configs/tools.lua`
* the `html` folder and the `language` folder - `html/languages/handbook_en.json` is new
* the `stream` folder - the models of the exorcism kit and the seal are new
* `data/default_locations.json`

Files you probably changed. Take the new one and put your settings back in, or keep yours and add what is new:

| File                 | What is new                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `config.lua`         | The whole `Config.Exorcism`, `Config.Grabs`, `Config.Apparitions`, `Config.Scared` and `Config.OtherWeather` blocks, `hotkeys` in `Config.OtherHud`, `midnight` in `Config.Session` is now `true`, `drag`, `hoist`, `choke`, `pin`, `possess` and `crawler` in `Config.Jumpscares`, `grab` and `mimic` in `Config.Events.list`, `styles` in `Config.Hunt.death`, `ritekit` in `Config.Keys` and in `Config.Base.equipment.slots`, the `rite...` sounds in `Config.Sounds` |
| `configs/ghosts.lua` | `rite` and `grabs` on every ghost                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `client/other.lua`   | `PauseWeatherRTX`, `ResumeWeatherRTX`, the hotbar part of `HideOtherHudRTX` / `ShowOtherHudRTX`, and `OnSpectateRTX`                                                                                                                                                                                                                                                                                                                                                      |
| `server/other.lua`   | `OnSpectateRTX`                                                                                                                                                                                                                                                                                                                                                                                                                                                           |

With your old `config.lua` the script keeps working, but the new features stay off until their blocks are in it.

### From 1.1.x to 1.2.0

Files that have to be replaced:

* `fxmanifest.lua`, `client/main.lua`, `server/main.lua`, `shared/main.lua`, `configs/tools.lua`
* the `html` folder and the `language` folder
* the `stream` folder - the tent and everything in it, the two cameras, the book, the salt box, the talisman and four wardrobes are new
* `data/default_locations.json` - Manor House and the tent places of the other houses

Files you probably changed. Take the new one and put your settings back in, or keep yours and add what is new:

| File                  | What is new                                                                                                                                                                                                                                                                                                       |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `config.lua`          | `Config.Mode`, the whole `Config.Base` block, `Config.Shop.shared`, `videocam` and `headcam` in `Config.Shop.items`, `slots`, `tableback` and `videocam` in `Config.Keys`, `export` in `Config.Commands`, `defaulttents` in `Config.Storage`, `written` in `Config.Book`, the `base...` sounds in `Config.Sounds` |
| `configs/objects.lua` | `wardrobe`: four new models in `models`, and `headings`                                                                                                                                                                                                                                                           |

With your old `config.lua` and nothing added the script runs the way 1.1.x did. The base only shows up once `Config.Mode` and `Config.Base` are in it.

A house has a tent once its place is set: `/ghostcreator`, open the house, **Base tent**. If you changed one of the houses the script comes with, your version is the one that is used. Where ours has a tent place and yours has none yet, yours takes it over on its own (`Config.Storage.defaulttents`). Move it or remove it in the creator like any other.

### From 1.0.x to 1.1.0

Files that have to be replaced:

* `fxmanifest.lua`, `client/main.lua`, `server/main.lua`, `shared/main.lua`, `configs/tools.lua`
* the `html` folder and the `language` folder
* the `stream` folder - the models of the equipment are new

| File                 | What is new                                                                                                                                                                                                                                |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `config.lua`         | The whole `Config.Shop` block, `gear1`, `gear2`, `gear3`, `salt` and `sensor` in `Config.Keys`, `debug` in `Config.Commands`, `pills`, `incense`, `salt` and `sensor` in `Config.Sounds`, five equipment objectives in `Config.Bonus.list` |
| `configs/ghosts.lua` | `nosalt`, `nosensor`, `crucifixrange`, `incense`, `pacing`, `tamper` and `equipment` on eight of the ghosts                                                                                                                                |
| `server/other.lua`   | `RemoveMoneyRTX` and `RefundMoneyRTX`, right below `AddMoneyRTX`                                                                                                                                                                           |

With your old `config.lua` and nothing added the script runs the way 1.0.x did, the shop only shows up once `Config.Shop` is in it.

***

## Troubleshooting

<details>

<summary>The tools or the haunted objects are invisible</summary>

The `stream` folder is missing or was renamed. Put it back and restart the whole server, not only the resource - streamed models are only picked up by players who connect after the restart. The same goes for the tent, the new equipment and the exorcism kit after an update.

</details>

<details>

<summary>The creator says I am not allowed</summary>

Check the ACE in `server.cfg` and `Config.CreatorPermissions`. Any one enabled part is enough.

</details>

<details>

<summary>There is no tent at a house</summary>

The house has no place for it yet. Open it in `/ghostcreator` and set **Base tent**. Check `Config.Mode` too: with `"classic"` there is no tent anywhere.

</details>

<details>

<summary>The video camera and the head cam are not in the shop</summary>

They are only sold at a house that has a base, because they are watched from its monitors. `Config.Base.feeds.enabled = false` takes them out as well.

</details>

<details>

<summary>A hunter cannot take anything else from the rack</summary>

He carries `Config.Base.equipment.carry` pieces at a time, tools and equipment together, and never more of one thing than its `limit` in `Config.Shop`. `R` puts a piece back.

</details>

<details>

<summary>Manor House does not show up</summary>

It needs the Blackwood Manor map by Molo Modding (`molo_blackwoodmanor_horror_version_map`). Start the map and the house shows up. If the map folder has another name on your server, change it after `"requires"` in `data/default_locations.json`.

</details>

<details>

<summary>The equipment costs nothing</summary>

`Config.Shop.free = "auto"` hands everything out for free on standalone, which has no money. Set it to `false` once your own payment is in `RemoveMoneyRTX` in `server/other.lua`.

</details>

<details>

<summary>A house cannot be saved</summary>

A house needs a ghost hunter, a house outline (or an IPL interior) and at least two rooms, every room with at least one ghost spot. The creator shows what is still missing.

</details>

<details>

<summary>The houses are gone after an update</summary>

File storage keeps the houses inside the resource folder. Use `Config.Storage.mode = "database"`, or keep `data/locations.json` and `data/stats.json` when you replace the folder.

</details>

<details>

<summary>There is no Photos page in the journal</summary>

Photos need `screenshot-basic` running. Without it, or with `Config.Journal.photos.enabled = false`, the page is left out.

</details>

<details>

<summary>The house stays too bright with the power out</summary>

Some interiors have lights of their own. Pick a darker look for that house in the creator, under **Look inside**.

</details>

<details>

<summary>Nobody is paid on standalone</summary>

Standalone has no money system. Fill in `AddMoneyRTX` in `server/other.lua`.

</details>

<details>

<summary>My HUD stays on screen during an investigation</summary>

Add its hide and show event or export to `Config.OtherHud`.

</details>

<details>

<summary>A dead player is not counted as caught</summary>

Your ambulance script uses a death state the script does not know yet. Add its state bag to `Config.Death.statebags`, or its check to `IsPlayerDownRTX()` in `client/other.lua`.

</details>

<details>

<summary>My anticheat flags the cameras or spectating</summary>

Every script camera, every camera feed and spectating call `OnSpectateRTX` first. Put your anticheat's bypass in it in `server/other.lua`, see [Anticheat](#anticheat).

</details>

<details>

<summary>The street lights come back on during a hunt</summary>

Your weather script switches them on again. Add it to `Config.OtherWeather.list`, or check that its line is there and the resource name matches.

</details>

<details>

<summary>The time is different after a hunt</summary>

With `Config.Session.midnight` the clock jumps to the time it would be now when the hunt ends, and your time script carries on. Set it to `false` and Ghost Hunting never touches the time.

</details>

<details>

<summary>The exorcism kit or the grabs are missing</summary>

Check `Config.Exorcism.enabled` and `Config.Grabs.enabled`. With an old `config.lua` the blocks are not in it at all. The grabs also need `grabs` on the ghost in `configs/ghosts.lua`.

</details>

<details>

<summary>My anticheat flags the teleport into an IPL house</summary>

Every teleport runs through the server first. Allow it in `OnTeleportRTX` in `server/other.lua` and in `BeforeTeleportRTX` / `AfterTeleportRTX` in `client/other.lua`.

</details>

<details>

<summary>The ghost is a wrong or missing model</summary>

`Config.Ghost.models` takes any ped model that exists on your server. Check the name, and that an addon ped is started before `rtx_ghosthunting`.

</details>

## Support

If you need help with installation, configuration or have any questions regarding this resource, feel free to contact us on our Discord server:

[Join our Discord](https://discord.gg/rtxdev)
