Skip to content

Creating modules

You can also create your own modules that you can later use in different maps. To initialize a module, in an empty folder, type:

$ kw mod init

This command will automatically download the template module and unzip it into this folder, substituting the folder name for the name.

Next, you can add your own scripts, imports, and so on. Feel free to delete any unnecessary folders. Finally, all that's left to do is upload the finished product to one of the Git repository hosting services (Codeberg, GitHub, GitLab, etc.).

Everything is visible in Git. I'm a cheapskate, I don't want others stealing my map code!!!

You can make your repository private on all hosting services. Since the utility uses the gitpython library to clone repositories, it already requires authorization when cloning hidden repositories. So, you'll simply be asked for your website username and password to upload the module on your behalf.

Alarm!

And don't freak out, it's not me asking for your data, it's gitpython!!!!

Module Development

After creating a module, you'll see the following files and folders:

abilities/ imports/ items/ library.json scripts/ units/ terrain/ tools/
  • library.json contains information about your module. It contains the name, version (which will be used for updates), dependencies, etc.
  • abilities/ - folder containing ability .ini files
  • items/ - folder containing item .ini files
  • units/ - folder containing unit .ini files
  • terrain/ - folder containing terrain files (file format: https://xgm.guru/p/wc3/w3-file-format)
    • war3map.doo # scenery
    • war3mapUnits.doo # Units, buildings, and objects on the map
    • war3map.mmp # Minimap points
    • war3map.shd # Shadow map
    • war3map.w3c # Cameras
    • war3map.w3e # Terrain
    • war3map.w3r # Areas
    • war3map.wpm # Path map
    • war3mapMap.blp # Minimap
  • imports/ - folder containing files that will be imported later (icons, Models, etc.)
    • The path for all files will start with resource/kw/{module_name}/{file}
  • scripts/ - Folder with .vj or .zn scripts.
    • If you want to use AngelScript, create the AS folder and store all scripts there.
  • tools/ - Folder with .py files, which can add various functionality using the kuniwar library.

Checking a Module

  • Let's say you've written scripts, but you don't know if they contain errors. You can check this with the command:
$ kw mod check

This will generate the necessary files and compile everything into a single .j file. If there are any errors, jasshelper will report them.