Modding Custom Campaign
Revision as of 03:00, 30 September 2026 by Knightlord07 (talk | contribs)
This is an tutorial how to make your own custom campaign & how does this work (This page under WIP)
Introduction
This is just basic info how to make your own custom campaign work.
You can edit the campaign in-game map editor there will be a tab called edit campaign so you can use it to make your custom campaign.
Editing Campaign
You can edit your own campaign in map editor via by menu & editing campaign tab, during the in-game editing campaign you can add in maps, enable & disable maps, variables, remove any maps (Unless you made a mistake that is) & last map that will mark as the end of the campaign itself.
This is file under .JSM
var Constructor = function() { // campaign
this.getCampaignName = function() { //campaignName
return qsTr(""); //This is your campaign name
}; //campaignName
this.getAuthor = function() { // campaignAuthor
return qsTr("Your Name"); // this is Your name
}; // campaignAuthor
this.getDescription = function() { // campaignDescription
return qsTr(""); //This is the description
}; // campaignDescription
this.getCurrentCampaignMaps = function(campaign) { // campaignMaps
var variables = campaign.getVariables();
var ret = ["maps/"]; // campaignMapsFolder that is targeting whatever folder you targeting
return ret;
}; // campaignMaps
this.mapFinished = function(campaign, map, result) { // campaignMapFinished This is where your campaign ended
var variables = campaign.getVariables();
var mapVar = variables.createVariable(map.getMapName());
mapVar.writeDataBool(result);
}; // campaignMapFinished
this.getCampaignFinished = function(campaign){ // campaignFinished
var variables = campaign.getVariables();
var wonCounter = 0;
return false;
} // campaignFinished
// campaign
};
Constructor.prototype = BASECAMPAIGN;
var campaignScript = new Constructor();World Map
This is under WIP
Custom Music
This is an interesting/special feature if you want to make your campaign look unique or special.
this.changeMusic = function(music)
{
audio.clearPlayList();
audio.addMusic(music);
audio.playMusic(0);
};
this.changeMusic("maps/your map name/your music/music name.mp3"); // temporary
/*
if
{
this.changeMusic("maps/your map name/your music/music name.mp3");
}
*/
//This allow you to hover your mouse into that campaign tab before click it
campaignScript.changeMusic("maps/your map name/your music/music name.mp3"); // temporary
//This allow you to use this music during in-game campaign level select
If you want to change music at certain level you can do that code is under this word here
var victoryCountVar = variables.createVariable("Victory Count");
var victoryCount = victoryCountVar.readDataInt32();
if (victoryCount >= 2)
{
campaignScript.changeMusic("maps/YOUR NAME.camp/YOUR MUSIC FOLDER/YOUR MUSIC.mp3");
}
else if (victoryCount >= 1)
{
campaignScript.changeMusic("maps/YOUR NAME.camp/YOUR MUSIC FOLDER/YOUR MUSIC.mp3");
}
else
{
campaignScript.changeMusic("maps/YOUR NAME.camp/YOUR MUSIC FOLDER/YOUR MUSIC.mp3");
}
This code only for this.getCurrentCampaignMaps = function(campaign)
And this is the last piece of code to change the music around
this.mapFinished = function(campaign, map, result)
{
var variables = campaign.getVariables();
var mapVar = variables.createVariable(map.getMapName());
mapVar.writeDataBool(result);
if (result)
{
mapVar.writeDataBool(true);
//Checking what mission you are playing on & it will detect once you clear the certain level the music will change & put +1 on victory count
switch (map.getMapName())
{
// Main missions
case "MAPNAME HERE":
// Secret missions
case "MAPNAME HERE":
var victoryCountVar = variables.createVariable("Victory Count");
victoryCountVar.writeDataInt32(victoryCountVar.readDataInt32() + 1);
break;
}
}
};