How to spawn in units mid-game?
Posted: Fri May 26, 2023 7:11 pm
Hi, I'm seeking help with spawning units mid-game. I've taken a look around the forums on this subject, scenario lua files and manual - haven't figured it out. Can someone lend me assistance?
Just trying to spawn in a single tank at turn 2 for now to get a general understanding of this.
What I have at the moment in my scenario's lua file is the following:
function OnNewRound(action)
if world.round == 2 then
player = 1 -- I input because this is player 1 in the game. I tried "0" as well as I see is written in other scenario lua files, but this doesn't work either.
zone = { {55,36} } -- this hex is currently empty in my scenario
units = { {"M4Sherman", "", 0, 1500} }
SpawnWave(player, zone, units)
if not world.round == 2 then return end
end
end
From looking at other scenarios' lua files, I guess I should also make a trigger in the editor with the function? The screenshot below is what I have input currently.

What should I do to get this to work?
Just trying to spawn in a single tank at turn 2 for now to get a general understanding of this.
What I have at the moment in my scenario's lua file is the following:
function OnNewRound(action)
if world.round == 2 then
player = 1 -- I input because this is player 1 in the game. I tried "0" as well as I see is written in other scenario lua files, but this doesn't work either.
zone = { {55,36} } -- this hex is currently empty in my scenario
units = { {"M4Sherman", "", 0, 1500} }
SpawnWave(player, zone, units)
if not world.round == 2 then return end
end
end
From looking at other scenarios' lua files, I guess I should also make a trigger in the editor with the function? The screenshot below is what I have input currently.

What should I do to get this to work?



