Moscow '41 Bonus Goals
Posted: Sun Oct 03, 2021 1:11 pm
by Flipp123
Hello together,
in Moscow '41 there is the bonus goal to hold all secondary objectives. In turn 23 I was holding all of the secondary objectives and I also moved in on the last primary objective.
The game then showed me a message, that I should try to also get the secondary objectives to change the outcome of the war (even though I was holding all secondary objectives at this time).
The only thing I could do was finishing all turns until turn 25, where the mission then ended in a victory.
Unfortunately there is no way to determine, if the victory also counted the secondary objectives (because the actual change in the campaign path happens a few scenarios later).
In this YouTube Video, the player also get's this messaage (
https://youtu.be/c3yYeGFad9A?t=5700), however when he captures the last primary objective he has still one secondary objective left.
However when he captures the last secondary objective and finishes his turn (23/25) the mission automatically closes for a victory:
https://youtu.be/c3yYeGFad9A?t=5730 .
Is this a bug or can I assume that the game actually recognized that I did all secondary objectives?
Re: Moscow '41 Bonus Goals
Posted: Mon Oct 04, 2021 4:45 pm
by nexusno2000
The following lua file is associated with the Moscow_2 scenario file.
Not all parts are equally interesting so let's focus on the cool bits:
There are 5 triggers in the file. One of the is "bonus message" which triggers if you control all main objectives. There is no such message to tell you you've captured all the bonus objectives.
There is also a counter which tells the scenario is over if you kill all AI units on the map. Hence the sudden stop when I killed the final inf there.
---
MOSCOW_2.lua
string_1 = NSLOCTEXT("scenario_common", "decisive_victory", "Herr General, by capturing all primary objectives you have achieved a remarkable success. Now you have a chance to win a truly decisive victory, a victory that might change the course of this war! To do this, secure all bonus objectives as well.")
function BonusMessageCondition()
return CountMainVHs() == 7
end
function BonusMessageEffect()
MessageBox(string_1)
end
VHs = {{10,2},{18,6},{14,9},{9,11},{12,11},{19,12},{14,13},{12,14},{3,16},{18,19},{12,28}}
MainVHs = {{10,2},{9,11},{12,11},{12,14},{3,16},{18,19},{12,28}}
function CountCapturedVHs()
local captured = 0
for _,vh in ipairs(VHs) do
local hex = world:GetHex(vh)
if hex.owner == 0 then
captured = captured + 1
end
end
return captured
end
function CountMainVHs()
local main = 0
for _,vh in ipairs(MainVHs) do
local hex = world:GetHex(vh)
if hex.owner == 0 then
main = main + 1
end
end
return main
end
core_units = {4,80,79,0,7,66,82,67,5,8,68,3,65,73,9,77,10,51,12,78,50,58,13,14,15,49,57,16,17,18,19,20,21,22,69,23,24,25,70,26,27,28,29,1,6,84,71,30,31,72,37,34,35,74,75,36,59,76,60,81,38,39,40,41,43,44,61,46,62,63,47}
function CountTheDead()
local dead = 0
for _,unit_id in ipairs(core_units) do
local unit = world:GetUnit(unit_id)
if (unit == nil) then
dead = dead + 1
end
end
return dead
end
function CustomSuccess(action)
if (action:GetActionClass() == "TurnsLimitAction" and campaign ~= nil and CountCapturedVHs() == 11) then
campaign["east1"] = true
return true
elseif ((action:GetActionClass() == "DeathAction" or action:GetActionClass() == "SurrenderAction") and campaign ~= nil and CountTheDead() == 71 and CountCapturedVHs() == 11) then
campaign["east1"] = true
return true
elseif (action:GetActionClass() == "CaptureFlagAction" and campaign ~= nil and CountTheDead() == 71 and CountCapturedVHs() == 11) then
campaign["east1"] = true
return true
elseif (action:GetActionClass() == "TurnsLimitAction" and campaign ~= nil and CountMainVHs() == 7) then
return true
elseif (action:GetActionClass() == "TurnsLimitAction" and CountCapturedVHs() == 11) then
return true
elseif (action:GetActionClass() == "TurnsLimitAction" and CountMainVHs() == 7) then
return true
elseif ((action:GetActionClass() == "DeathAction" or action:GetActionClass() == "SurrenderAction") and CountTheDead() == 71 and CountCapturedVHs() == 11) then
return true
elseif (action:GetActionClass() == "CaptureFlagAction" and CountTheDead() == 71 and CountCapturedVHs() == 11) then
return true
else
return false
end
end
function CustomFail(action)
return action:GetActionClass() == "TurnsLimitAction" and CountMainVHs() ~= 7
end
counterattack_units = {80,79,66,82,67,68,73,77,78,69,70,84,71,72,74,75,76,81}
function IsCounterattack()
return world.round == 15 or CountCapturedVHs() >= 8
end
function Counterattack()
for _, unit_id in ipairs(counterattack_units) do
local unit = world:GetUnit(unit_id)
if (unit ~= nil) then
local orders = Copy(unit.orders)
table.remove(orders, 1)
unit.orders = orders
end
end
end
location_hex1 = {12,28}
location_defender1 = world:GetUnit(46)
location_units1 = {61,62,63}
function LocationBypassed1()
return location_defender1 == nil or location_defender1.position ~= location_hex1
end
function TriggerLocation1()
for _, unit_id in ipairs(location_units1) do
local unit = world:GetUnit(unit_id)
if (unit ~= nil) then
local orders = Copy(unit.orders)
table.remove(orders, 1)
unit.orders = orders
else
return false
end
end
end
location_hex2 = {9,11}
location_defender2 = world:GetUnit(18)
location_units2 = {51,50,58,49,57,17,37,38}
function LocationBypassed2()
return location_defender2 == nil or location_defender2.position ~= location_hex2
end
function TriggerLocation2()
for _, unit_id in ipairs(location_units2) do
local unit = world:GetUnit(unit_id)
if (unit ~= nil) then
local orders = Copy(unit.orders)
table.remove(orders, 1)
unit.orders = orders
else
return false
end
end
end
function TurnLimitOffCondition()
return world.round == 26
end
function TurnLimitOffEffect()
for _, unit_id in ipairs(core_units) do
local unit = world:GetUnit(unit_id)
if (unit ~= nil) then
local orders = Copy(unit.orders)
unit.orders = {}
end
end
end