Hey guys I have absolutely zero experience with LUA. I opened up the "Defense of the Reich" scenario (again) and tried to make some sense of it but didn't get far... and what I want to do is slightly different I think.
Anyways, here is an image of the Multiplayer scenario I am working on (click to enlarge):
There are 3 cities on the far east and west of the map... I want specific victory hexes in those cities to act as "factories" and spawn X unit every X amount of turns after checking ownership of the flag/hex owner.
I'd really appreciate some help. I think this map will be epic.
-- Create the unit
-- 1. Create and execute purchase action, use unit type, transport type and overstrength as parameters
local create_action = world:MakePurchaseAction(owner, "Grenadier", "", 0)
create_action.auxiliary = false -- spawn core units
create_action.cost = 0 -- don't take money for units we generate
world:Exec(create_action)
-- 2. Create and execute deploy action, place the unit in the hex we've picked.
local unit = world:GetUnit(create_action.id)
deploy_action = world:MakeDeployAction(unit, {4,12}) -- here go to the editor select ConfigureHexes and select the hex where you want the unit to be spawned, note it and enter the coordinates here {x,y} example here is {4,12}
world:Exec(deploy_action)
you could do this a lot more automated, look at the defenderofthereich.lua file. Scenarios/fictional... folder at your install.