Page 1 of 1

Unlock commanders by year, month, enemy etc.

Posted: Thu Oct 22, 2015 7:17 pm
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,

		}

Re: How to unlock specific commanders by date

Posted: Wed Oct 28, 2015 3:11 pm
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

Re: How to unlock specific commanders by date

Posted: Thu Oct 29, 2015 5:36 pm
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 1864 times

Code: Select all

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