# 基础修改

## Basics

This guide assumes you have basic understanding with programming and know how to use developer environments. Listed below are tools useful for exporting file formats

If you'd like a more lengthy set of tutorials covering many topics. Look at:

{% content-ref url="<https://github.com/R2Northstar/NorthstarWiki/blob/main/docs/modding/modding/tutorials/modding-tutorials.md>" %}
<https://github.com/R2Northstar/NorthstarWiki/blob/main/docs/modding/modding/tutorials/modding-tutorials.md>
{% endcontent-ref %}

> TODO: Actually link tools

### Tools

* RSPNVPK
* Cra0 VPK Tool (Titanfall VPK Tool)
* Legion by DZXTPorter

## Quick start

In order to get started with making your mod, create a folder in `R2Northstar/mods`. While it isn't required, it is best practise by mod authors to follow the naming scheme "Author.ModName", such as "Northstar.Client".

After making this folder, inside it add a folder named `mod` and a file named `mod.json`.

Provided is a template `mod.json`, for a detailed list of values read [Cheatsheet](https://github.com/R2Northstar/NorthstarWiki/blob/main/docs/modding/modding/cheatsheet.md)

```json
{
    "Name": "My.Mod",
    "Description": "Woo yeah wooo!",

    "LoadPriority": 0,
    "ConVars": [],
    "Scripts": [],
    "Localisation": []
}
```

Inside the `mod` folder, existing files found in the engine's virtual file system will be overwritten and new files can be added. If you need to define new Squirrel files (.nut/.gnut) they *must* be declared in the `"Scripts"` array in `mod.json`. An example for this might be:

```json
    "Scripts": [
        {
            "Path": "path/to/my.nut",
            "RunOn": "( CLIENT || SERVER ) && MP"
        },
        {
            "Path": "path/to/my_second.nut",
            "RunOn": "( CLIENT || SERVER ) && MP",
            "ClientCallback": {
                "Before": "ClientPreMapspawnThing",
                "After": "AfterMapspawnClientThing"
            },
            "ServerCallback": {
                "Before": "ServerPreMapspawncrap",
                "After": "ServerAfterMapspawnWoo"
            }
        }
    ]
```

> TODO: Create and link Squirrel VM documentation

`"Path"` indicates where the script is, `"RunOn"` is the Squirrel VM context (see [Squirrel VM](https://github.com/R2Northstar/NorthstarWiki/blob/main/docs/modding/modding/getting-started.md)) as an expression, and `"ClientCallback"` and `"ServerCallback"` specify a function call that can be `"Before"` and/or `"After"` map-spawn.


---

# Agent Instructions: Querying This Documentation

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

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

```
GET https://r2northstar.gitbook.io/r2northstar-wiki/chinese/modding-and-development/getting-started/getting-started.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

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