Lua win conditions
Posted: Wed Apr 06, 2022 7:22 am
Hi all, super grateful for any help from people knowledgable about the Lua API please.
Background
I'm setting up a mission where one human and one AI start on an empty map with one MCV each.
Their MCVs appear via the Reinforcements.Reinforce() command, which works correctly.
The winning condition for the human is to eliminate the AI side, so in my Tick() function I have:
As soon as the world loads, this objective evaluates as completed, and the human player receives "mission accomplished".
This indicates that the MCV given to the AI side at the start of the mission is not counted when soviets.HasNoRequiredUnits() evaluates.
The question
Assuming this behaviour is by design, how can I implement a "kill all opposition" objective, such that the AI's MCV has to be killed before the objective is completed?
(Yes, this happens to also be the winning criterion for skirmish games, so it must be doable somehow!)
Background
I'm setting up a mission where one human and one AI start on an empty map with one MCV each.
Their MCVs appear via the Reinforcements.Reinforce() command, which works correctly.
The winning condition for the human is to eliminate the AI side, so in my Tick() function I have:
Code: Select all
Tick = function()
if soviets.HasNoRequiredUnits() then
player.MarkCompletedObjective(destroyBaseObjective)
end
end
This indicates that the MCV given to the AI side at the start of the mission is not counted when soviets.HasNoRequiredUnits() evaluates.
The question
Assuming this behaviour is by design, how can I implement a "kill all opposition" objective, such that the AI's MCV has to be killed before the objective is completed?
(Yes, this happens to also be the winning criterion for skirmish games, so it must be doable somehow!)