Editing Mod Developers Guide

Jump to: navigation, search

Warning: You are not logged in.

Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 2: Line 2:
  
 
This guide assumes that you know the Lua programming language.  If you've worked with other languages, such as Javascript, Lua should be very easy to learn.  Many tutorials are available on the internet if you search for them.
 
This guide assumes that you know the Lua programming language.  If you've worked with other languages, such as Javascript, Lua should be very easy to learn.  Many tutorials are available on the internet if you search for them.
 
Note that you must be a Warzone [[member]] to develop mods, as mods are a member feature.
 
  
 
== Getting started creating a mod ==
 
== Getting started creating a mod ==
  
There are two ways to load mod code into Warzone: Using the Standalone Client, or directly uploading from your editor.  Uploading from your editor is the preferred way since it allows for more rapid iteration.  However, it also requires an extension to your editor, which only exists for VS Code.  If you want to develop from an editor other than VS Code, or if you want to develop without an active internet connection, you should use the Standalone Client method.
+
To make your own mod, follow these steps:
 
+
=== Developing with the Standalone Client ===
+
  
 
# Open the page https://www.warzone.com/EnableModDevelopment to enable mod development for your Warzone account.
 
# Open the page https://www.warzone.com/EnableModDevelopment to enable mod development for your Warzone account.
Line 16: Line 12:
 
# Launch the Standalone Client, sign in.  Click the "Mod Development Console" button.  You can also use the hotkey Ctrl+Shift+M to bring up this dialog any time, and also note that this dialog can be docked to sides of your screen if you wish.
 
# Launch the Standalone Client, sign in.  Click the "Mod Development Console" button.  You can also use the hotkey Ctrl+Shift+M to bring up this dialog any time, and also note that this dialog can be docked to sides of your screen if you wish.
 
# Click the "Create New Mod" button and give your mod a name.
 
# Click the "Create New Mod" button and give your mod a name.
# Provide path to your folder with lua files that you downloaded in step 3.
+
# Provide path to your folder with lua files that you downloaded in step 2.
 
# Click Submit to create the mod.
 
# Click Submit to create the mod.
 
# From the single-player main menu, click "Custom Game", then scroll down and click Change Mods.
 
# From the single-player main menu, click "Custom Game", then scroll down and click Change Mods.
Line 23: Line 19:
  
 
Now you can make modifications to the lua code, press the "Reload code" button and try them out!  
 
Now you can make modifications to the lua code, press the "Reload code" button and try them out!  
 
=== Developing with direct upload from your editor ===
 
 
# Open the page https://www.warzone.com/EnableModDevelopment to enable mod development for your Warzone account.
 
# Install VS Code from https://code.visualstudio.com/
 
# Obtain the source code to an example mod, such as the Randomized Wastelands Mod from https://github.com/FizzerWL/ExampleMods/tree/master/RandomizedWastelandsMod.  Download the lua files to a folder on your device. (The easiest way is to use Github's "Download zip" button if you're not a git user)
 
# Download the Warzone Mod Helper VS Code extension VSIX file from https://github.com/FizzerWL/WarzoneModHelper/releases.  Install it by launching VS Code, pressing Ctrl+Shift+P, entering "Install from VSIX" and selecting the VSIX file you downloaded.
 
# (optional) Install the Lua IDE extension: https://marketplace.visualstudio.com/items?itemName=sumneko.lua
 
# Open the Mod Development Console at https://www.warzone.com/Mods/Develop
 
# Click the "Create New Mod" button and give your mod a name.  Ensure the "Development" box is checked.  After creating it, make note of your Mod ID.
 
# In VS Code, open the RandomizedWastelandsMod folder you downloaded earlier.  Open one of the lua files in this folder.
 
# Visit https://www.warzone.com/API/GetAPIToken and copy your API Token to the clipboard.
 
# In VS Code, press Ctrl+Shift+P and select "Upload Mod".  Enter your Mod ID you noted earlier, and paste your API Token when prompted.  Ensure it says "Mod updated successfully" in the bottom right corner.
 
# Now that your mod is updated, let's run it. Visit https://www.warzone.com/SinglePlayer?CustomGame=1 and click Change Mods.  You should see the mod you created here.  Check the box to turn it on and click Submit.
 
# If you've cloned the Randomized Wastelands mod, you'll also need to turn on wastelands if you want it to do anything.  You can also turn off fog to more easily see its effects.  Create the game, and see the wastelands be adjusted!
 
 
Now you can make modifications to the lua code, press and invoke the "Upload Mod" feature again to try them out!
 
  
 
Be sure to read the rest of this page for essential information on mod development.
 
Be sure to read the rest of this page for essential information on mod development.
 
== Video Tutorial ==
 
 
If you prefer to learn via video, check out this YouTube tutorial on how to make a mod:  https://www.youtube.com/watch?v=mwVDv5PXyrg
 
  
 
== Hooks ==
 
== Hooks ==
Line 75: Line 50:
 
Never assume any state will persist, unless specifically called out in the documentation.  For example, don't write to a global variable in one hook and access it in another.
 
Never assume any state will persist, unless specifically called out in the documentation.  For example, don't write to a global variable in one hook and access it in another.
  
If you try to in a single-player game, you may find that global state does persist.  However, don't be tempted to rely on this, since globals are always wiped in multi-player, and globals will also get wiped in single-player if someone saves and re-loads their game.  Therefore, ensure you code as if globals will never persist between hook calls, except where explicitly allowed.
+
If you try to in a single-player game, you may find that global state does persist.  However, don't be tempted to rely on this, since globals are always wiped in multi-player, and globals will also get wiped in single-player if someone saves and re-loads their game.  Therefore, ensure you code as if globals will never persist between hook calls, except where expliclty allowed.
  
 
== Data Storage ==
 
== Data Storage ==
Line 97: Line 72:
 
* [[Mod API Reference]]
 
* [[Mod API Reference]]
 
* [[Mod Backwards Compatibility]]
 
* [[Mod Backwards Compatibility]]
* [[Public Mods]]
+
* [[Promoted Mods]]
 
* [[Mod Hooks]]
 
* [[Mod Hooks]]
 
* [[Mod Game Data Storage]]
 
* [[Mod Game Data Storage]]
* [https://discord.gg/hqGkVXagyt Warzone Mod Makers Discord]
 
 
 
[[Category:Mod Developers Guide]]
 
[[Category:Mod Developers Guide]]

Please note that all contributions to Warzone Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Warzone Wiki:Copyrights for details). Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox