> For the complete documentation index, see [llms.txt](https://abpstudios.gitbook.io/abp-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://abpstudios.gitbook.io/abp-docs/abp-missions/scripting-references/script-exports.md).

# Script Exports

<pre class="language-lua"><code class="lang-lua"><strong>exports.abp_missions:StartRemoteMission(missionId, gameVariables, playerInitiator)
</strong></code></pre>

The **RemoteStartMission** function is an export function that allows you to start a mission remotely from another resource or client. It provides an interface to start a specific mission and handle the corresponding responses and actions.

**Important:** Setting the game variables **WILL REPLACE** the ones set within the mission file.

**Parameters:**

* `missionId`: The unique identifier of the mission you want to start.
* `gameVariables`: *(nil for optional)* An object that contains the game variables needed for the mission.
* `playerInitiator`: The playerServerId of the player who initiated the quest start request.

**Example**

<pre class="language-lua"><code class="lang-lua"><strong>exports.abp_missions:StartRemoteMission("test_mission", {
</strong>    position = vector3(120.0, 20.0, 75.0),
    distanceCheck = 5,
    secondsRemaining = 20
<strong>}, GetPlayerServerId(PlayerId()))
</strong></code></pre>

**When use custom game variables?**

Let's imagine that you want to create a shoplifting system, because each store is different, so you could configure the name, if it is for liquors or chocolates. Then you will make a list of temporary game variables that depending on the player's location will call one another.

Another example is, you want to make a variable mission where an objective is not always in the same place, so you make a table of variables and when you start the mission to play, it automatically selects the alternatives.

**Example**

```lua
local gameVariables = {
    {
        enemyPosition = vector3(0, 0, 0),
        enemyName = "Batman"
    },
    {
        enemyPosition = vector3(1, 1, 1),
        enemyName = "Superman"
    },
    {
        enemyPosition = vector3(2, 3, 3),
        enemyName = "Spiderman"
    }
}

local gameVariableToUse = gameVariables[math.random(1, #gameVariables)]

exports.abp_missions:StartRemoteMission("test_hero_mission", gameVariableToUse, GetPlayerServerId(PlayerId()))
```

**Why require playerInitiator?**

The playerInitiator is required to prevent malicious players from initiating missions for other players while away. (It's a small filter, although we are working on alternatives)


---

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

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

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

```
GET https://abpstudios.gitbook.io/abp-docs/abp-missions/scripting-references/script-exports.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

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