Creating A Mod

## Create the Mod in the Launcher

To Create a basic mod, open the Black Ops 3 Mod Tools Launcher.

Then select the white page (new) icon.

Then this screen will pop up. Select "Mod" for the Template, and name your mod.

This will create the mod as 4 parts: core\_mod, mp\_mod, cp\_mod, and zm\_mod.

You can then open the Mod Folder in your file explorer.

## Copying Files that Load with the Game

The way that we can load our own code into the game is by overriding a script that already gets loaded, and adding our own code to it. In this example we will be making a mod for zombies.

1. Look for 2 or 3 files with the same name that exist in `YOUR\_ROOT/share/raw/scripts/{gamemode}/`, such as /share/raw/scripts/zm/gametypes/zclassic.gsc and zclassic.csc. Note: It's important to use a file that includes both a GSC and CSC version to allow you to add GSC and CSC code to your mod.
2. Copy the files to the directory that was created with your mod (`/mods/{mod\_name}/`). In our zclassic.gsc example, our folder structure should now look something like this:

## Overriding to Use These Files

Now that we have copied the files, we need to tell Black Ops 3 to instead use our custom files instead of the ones stored in /share/raw/scripts.

The way we do that is by telling it where to look with the .zone file.

We will add these two lines into the zm\_mod.zone file in `/mods/{mod\_name}/zone\_source/`

```
scriptparsetree,scripts/zm/gametypes/zclassic.gsc
scriptparsetree,scripts/zm/gametypes/zclassic.csc

```
Our .zone file now looks something like this:

## Creating A Place for Your Code

Now that we've told Black Ops 3 to use these files instead of the defaults, we can start adding our own code to the mod!

Lets create a file in `/mods/{mod\_name}/scripts/zm/` called `our\_mod.gsc`.

In this file, we can add the following lines:

```
#using scripts\codescripts\struct;
#using scripts\shared\audio\_shared;
#using scripts\shared\callbacks\_shared;
#using scripts\shared\clientfield\_shared;
#using scripts\shared\scene\_shared;
#using scripts\shared\util\_shared;
#using scripts\shared\system\_shared;

#insert scripts\shared\shared.gsh;
#insert scripts\shared\version.gsh;
#insert scripts\zm\\_zm\_utility.gsh;

#using scripts\zm\\_load;

#namespace our\_mod;

REGISTER\_SYSTEM\_EX( "our\_mod", &\_\_init\_\_, &\_\_main\_\_, undefined )

function \_\_init\_\_(){

}

function \_\_main\_\_(){
 level waittill("initial\_blackscreen\_passed");
 IPrintLnBold("Hello World!");
}

```

What this code does is tell Black Ops 3 that this file will be using all the scripts from anything starting with `#using`, as well as use constants from anything starting with `#insert`. `#namespace our\_mod` tells Black Ops 3 that whenever in code that "our\_mod" is referenced, it should look in files with that namespace. This is useful when calling functions that you don't want in your main file.

`REGISTER\_SYSTEM\_EX( "our\_mod", &\_\_init\_\_, &\_\_main\_\_, undefined )` tells Black Ops 3 to run the `\_\_init\_\_()` function and the `\_\_main\_\_()` function when the script is used. This will be important later when we include it in the `#using` section of `zclassic.gsc`.

Finally, the 2 functions `\_\_init()\_\_` and `\_\_main\_\_()` are what code actually gets executed when the file is used. In our case, we dont need to initialize anything, so our `\_\_init\_\_()` function is empty, but for testing purposes, we will `waittill` the initial blackscreen is passed, and then print out "Hello World!" to all the players in the game.

## Telling Black Ops 3 to Use Your File

So we have told black ops 3 to use our zclassic files instead of its defaults, so what we can do now is in our `zclassic.gsc`, put

```
#using scripts\zm\our_mod;

```

This will tell Black Ops 3 to use our file when it loads up `zclassic.gsc`, then executing our init and main functions, thus executing our code.

There is one more thing we need to do before this works however, and that is include it in our `.zone` file.

In our .zone file, we can add the line:

```
scriptparsetree,scripts/zm/our_mod.gsc

```

under our other scriptparsetree lines. This will tell Black Ops 3 where to look when it encounters the `#using` in `zclassic.gsc`.

## Running Your Mod

To run your mod, first you must link your mod. In the mod tools, check mark the mod you want to use, and select `Link` on the right hand side. Then select `Build` to build it.

Now that we've linked the code, we can run it by checking off `Run`, and selecting `Build`. This will run the game with the selected mod activated.

When you get into your map, you should be greeted with the text "Hello World!" at the top after the initial blackscreen. (Don't mind the other text on the screen as its from my map itself).

## Linking in Other Languages (Not English)

Black Ops 3 needs to link differently depending on what language your game is in / what country you come from. **This will prevent people that have non linked languages from playing with the mod.** To fix this, you must go into your Mod Tools Launcher, and select `Edit` and go to options.

You can then select whatever language you need, and then re-link and run your map.

Make sure to link for "All" when you publish your mod, so everyone can play!