Unlock commanders by year, month, enemy etc.

A forum to discuss custom scenarios, campaigns and modding in general.

Moderators: Slitherine Core, The Lordz

Post Reply
Robotron
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2193
Joined: Tue Nov 23, 2010 3:35 pm

Unlock commanders by year, month, enemy etc.

Post by Robotron »

Just figured this out while tinkering with the code and thought it might be helpful for other modders:

How to unlock a specific commander by year in "commanders.lua":

add "year = xxxx" under "conditions" to unlock a commander at the start of a specific year. I'm sure there are ways to get more specific unlocking-dates, so feel free to improve on this and please post your results.

Example:

Code: Select all

		conditions =
		{	year = 1915,

		}
Last edited by Robotron on Thu Oct 29, 2015 6:14 pm, edited 1 time in total.
Robotron
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2193
Joined: Tue Nov 23, 2010 3:35 pm

Re: How to unlock specific commanders by date

Post by Robotron »

Managed to include new condition: "month" by modifying game_commanders.lua and then adding the new category to the production panel and english.txt

Code: Select all

 --Condition: month
  if data.commanders[i].conditions.month ~= nil then
   if game.date.month >= data.commanders[i].conditions.month then
   
      conditions[conditionCounter] = true
    else
      conditions[conditionCounter] = false
      conditions[0] = false
    end
    conditionCounter = conditionCounter + 1
  end
Attachments
commander.jpg
commander.jpg (16.58 KiB) Viewed 1741 times
Robotron
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2193
Joined: Tue Nov 23, 2010 3:35 pm

Re: How to unlock specific commanders by date

Post by Robotron »

Add "war = X," under "conditions" in commanders.lua to unlock the commander when faction "X" (X being the faction's ID from 1914.lua) is at war with the commander's faction ("war = 1," for France, "war = 2," for Britain etc.)
Clipboard02.jpg
Clipboard02.jpg (10.34 KiB) Viewed 1722 times

Code: Select all

	conditions =
		{
kills = {45, "ground"},
casualties = {45, "ground"},			
war = 4,
		
		}
Post Reply

Return to “Commander the Great War : Mods & Scenario Design”