2.2) EzNPC Guide - Kuborros/FP2Lib GitHub Wiki
Using this method, all you need to add an NPC to the game is a .json file, and an AssetBundle with the NPC within.
JSON file structure
{
"UID":"some.creative.unique.name.that.wont.conflict",
"name":"Name",
"author":"Author",
"scene":"Location Name",
"bundlePath":"path/to/asset.bundle",
"species":1,
"customSpecies":"",
"home":1,
"customHome":"",
"dialogue":8
}
JSON contents explanation
- UID: Unique name of your character mod - this string is used internally to keep track of them, and is not visible to the outside. Pick something that will not likely conflict with names picked by others. One good option is something like:
author.character
. - name: Name of your character, as shown in the text boxes, and in the list of NPC.
- author: Name of the mod author.
- scene: Name of the location your character should be spawned at. In most cases it's the scene name, to be sure you can always check it in Unity Explorer/Editor. Name of current scene is kept in
FPStage
object. - bundlePath: Relative (to the game .exe) path to an AssetBundle which contains your NPC. Most mods put their bundles into
mod_overrides
andModFiles
folders, and their subfolders. Typical value would be something likemod_overrides/mynpcassetbundle.assets
. - species and home: Numeric ID of the character species and their home city - for species and home ID consult list at the bottom of this page.
- customSpecies: If empty, the values set above are used to display the species. If set, this string is shown instead.
- customHome: If empty, the values set above are used to display the home of the character. If set, this string is shown instead.
- dialogue: How many lines of dialogue does your character uses - needs to be equal or higher to amount set in the Prefab, otherwise major issues will occur.
For sake of making it simple, any bundle loaded in this method can only have one NPC GameObject prefab and assets they need.
Multiple prefabs will get ignored (but then you can just write your own mod that registers each npc instance separately using RegisterNPC()
)
Internal ID's
Species ID's are as follows:
0: "Unknown"
1: "Cat"
2: "Bird"
3: "Bear"
4: "Panda"
5: "Red Panda"
6: "Monkey"
7: "Dog"
8: "Deer"
9: "Fox"
10: "Rabbit"
11: "Dragon"
12: "Bat"
13: "Boar"
14: "Otter"
15: "Raccoon";
16: "Goat"
17: "Hedgehog"
18: "Reptilian"
20: "Mouse"
21: "Ferret"
22: "Plant"
23: "Robot"
24: "Pangolin"
Number 19 is missing within the game's code, and is therefore an invalid ID.
Home ID's are:
0: "Unknown"
1: "Shang Tu"
2: "Shang Mu"
3: "Shuigang"
4: "Parusa"