how to write mod / mod does nothing

For AI and campaign script related discussions and questions
Post Reply
Luckyturtledev
New user
Posts: 1
Joined: 07 Feb 2023, 21:12

how to write mod / mod does nothing

Post by Luckyturtledev » 07 Feb 2023, 21:27

hi, I have try to write my first mod for this game. But it looks like the mod is not working. I had create a simple test.js saved at `mods/4.3.3/autoload/test.js` for testing how the mod api works. If I start the a game I get a message "Mod: test.js", which make me assume that the mod was loaded successful.
But the mod does nothing.

Code: Select all

receiveAllEvents(true);

function eventStartLevel() {
  debug("hiiiiiiiiiiiiiiiiiiiii");
  console("hiiiiiiiiiiiiiiiiiii");
  receiveAllEvents(true);
}

funciton eventMenuBuild() {
  debug("hiiiiiiiiiiiiiiiiiiiii");
  console("hiiiiiiiiiiiiiiiiiii");
}
I did neither see a message at terminal nor at the ingame console.
Sadly I do not know what I am doing wrong. The scripting doc give some advice, how to write AIs or challenges, but not how to write scripts which should simple run at the background.

User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 930
Joined: 26 Sep 2016, 19:56

Re: how to write mod / mod does nothing

Post by Berserk Cyborg » 15 Feb 2023, 08:24

Mods are loaded as .wz files (really .zip) that point to a directory either inside data/base or data/mp depending on if the game is using a campaign or skirmish/multiplayer setting (this is your base.wz or mp.wz file with the installed game--never modify these directly but feel free to copy and mold them into a new mod). https://github.com/Warzone2100/warzone2 ... aster/data

You then follow the structure of those folders to where you need to mod something and either mod a file or create a new one. You can use my Cobra AI as an example of a non-campaign mod. Typically new files can be loaded inside rules.js found in either base/script or mp/multiplay/script.

I guess this depends on what you want to do with your mod.

Post Reply