Mod Tutorial: Part 2

I'm going to finish the tutorial on Code 1 right now, specifically because I expect Code 2's tutorials to take longer. This one will cover custom themes, music, running mates, and map colors.

Step 5: Running Mates

Depending on what your mod is like, you may want to add additional running mates than what the base candidate has. This is possible, sort of. I'm going to paraphrase a comment from /u/EmDay057 since it explains it perfectly.

"The first step is to duplicate an existing VP's code, preferably for the same candidate. Then, you start changing all the names, descriptions, etc. to the ones of the candidate you want to implement. During this phase, you have to change its Pk to a different value. (A PK is the code's way of identifying each value in a string of variables, such as a specific running mate, state, or candidate.)"

(IMPORTANT NOTE: Almost at the end of your code 1, you have a list of candidate and VP PK's. A random example):

{\"model\": \"campaign_trail.running_mate\", \"pk\": 48, \"fields\": {\"candidate\": 77, \"running_mate\": 81}}

You have to check that the pk you're assigning to the vp you want to implement is not already in those ones. A value higher than 300 should do it. Now, you have to change the candidate and VP's PK to the ones you have. For example, if you have a candidate with 185 PK and a vp with 439 PK, change the code above to this:

{\"model\": \"campaign_trail.running_mate\", \"pk\": 207, \"fields\": {\"candidate\": 185, \"running_mate\": 439}}

If everything goes right, next time you load the code, you'll have a new VP. Since this mod is only going to include 2 running mates, that means I am going to have to remove some running mates, which for me are the PKs of 48, 46, 50, 53, and 52. To remove running mates, simply delete any and all instances of their PK in the Code 1, specifically, each "model" portion of code. Make sure what you're deleting is the correct code, of course.

Step 6: Custom Themes

Many of you have likely noticed the special themes and banners made for certain mods, such as Viva Kennedy 1964 and 1848b. These are relatively easy to set up, and are obviously optional. Paste something like this at the bottom of your Code 1 as a template.

document.getElementById("header").src = ""
nct_stuff.themes[nct_stuff.selectedTheme].coloring_title = "#010a1c"
nct_stuff.themes[nct_stuff.selectedTheme].coloring_window = "#013766"
document.getElementsByClassName("game_header")[0].style.backgroundColor = nct_stuff.themes[nct_stuff.selectedTheme].coloring_title
$(".container")[0].style.backgroundColor = "#ac0e28"
document.body.background = "" 

"header" is the banner, and document.body.background is the image in the background of the theme. Below I'll explain each of the color codes and the other theme stuff here.

If you're looking for your mod to have multiple banners, then add this code to your Code 1, below where you added that template.

bannerlist=["", "", "", "", ""]
document.getElementById("header").src = bannerlist[Math.floor((Math.random() * bannerlist.length))] 

You can also add custom music, as I am sure some of you know. This mod won't have any music in it, but for the sake of explaining, I am showcasing a piece of the 2021 Virginia Gubernatorial Mod. I believe that this example has multiple songs combined into 1 MP3 file, if you're looking for multiple songs. Just put this in your Code 1, somewhere at the bottom.

campaignTrail_temp.musicOn = true
campaignTrail_temp.musicSrc = ""

There is a new "soundtrack" system created by DecstarG. His only request is that you properly credit him for its use.

You can open it in a new window. I felt it was too large to include on this page, but copy that and paste it in your Code 1 or 2, and edit it to your liking.

I assume your NEXT question might be "Well, that's nice and all, but how the hell do I make a good looking banner?". I don't really have the time or post length to go to a photoshop tutorial, so I'll tell you what I use. I use Pixlr, specifically X for more basic tasks and E to do more advanced stuff like drop shadows, add glows, etc. When removing background, I use whatever software you feel most comfortable with, of course. Pixlr is free, but unfortunately there is a daily limit for free users to save images. Snipping tool can mostly mitigate this but your pixel resolution may vary. As long as it looks good, it doesn't matter how you make the banner.

Code Code

For those curious - the font is Bebasneue (also known as Bebas Neue), I have size set to 60, curve set to 12, outline size set to 62, and outline direction at 305, in case you'd prefer a different colored logo. The banner dimensions are 819x248.

Changing the color for a theme is relatively easy. Just googling "Color Code Picker" gives you a color picker to get the Hex Code for any color you like. Here's a visual graph explaining which aspect changes what.


We can now see the changes I made even before the game begins. Personally, I like it a lot, but I may be biased. This is completely optional, of course, but I provided this tutorial for those who would like their mod to have extra swagger.


Step 7: Candidate Colors

When searching for a candidate, you will likely stumble across "color_hex", like so.

\"color_hex\": \"#FF0000\", \"secondary_color_hex\": \"#FFA0A0\"

As you may be able to tell, these 2 color does determine the color of the candidate's party on the polling map, with "color_hex" being the default, and "secondary_color_hex" being for the "lean margin" color. For 1876, I'm going to choose the Wikipedia Colors for my map.


Step 8: Credits

There's two ways of going about this. Option 1 is this:

campaignTrail_temp.credits = 'Astronomical#3005';

Slap this on as the last line of your code, and when you open the scenario, it'll state "This scenario was made by Astronomical#3005", for example. Of course, you can put your Discord tag, your Reddit username, or whatever here. It's important to credit yourself, in part because the development team only likes to add mods to the loader if we know for a fact the creator is okay with it.

There is a second credit system, one made by DecstarG. Just like the music system, all he asks is to be credited for this. You can open it in a new window. I felt it was too large to include on this page, but copy that and paste it in your Code 1, and edit it to your liking.

Step 9: Removing Unnecessary scenarios from the drop-down bar.

While it's not a game-changing feature, removing unused scenarios from the drop-bar on your mod saves players, and you (as developer) a lot of time. There's 2 steps to set this up properly. First, go to line that starts with campaignTrail_temp.temp_election_list in your Code 1.

campaignTrail_temp.temp_election_list = [{"id": 5, "year": 1896, "is_premium": 0, "display_year": "1876"}];

As you can see, the only year left on the list is the year of your scenario. Next, head over to the first line, and remove all unnecessary years from the campaignTrail_temp.election_json line as seen in the image below. Notice how the code starts with pk 5, which will be 1876?