• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

Missions, actions, and commands

I know Unit:GetUnitAIType() will return UNITAI_EXPLORE for units like the AI starting warrior, but I don't know how to set it as there's no Unit:SetUnitAIType() available from Lua. I don't really know how those are set initially, but it's probably a combination of the Unit_AITypes and Unit_Flavors table entries.

The automated exploration from the Unit Panel seems to use Game.HandleAction(actionID) but since there are no other parameters, that probably only works on the currently selected unit. :(
 
This worked for me in Beyond Earth:
Code:
        if unit ~= nil and unit:GetUnitType() == GameInfo.Units["UNIT_EXPLORER"].ID then
            -- The last parameter has to be set to 1 for some reason; 0 didn't work
            unit:DoCommand(CommandTypes.COMMAND_AUTOMATE, 1);
        end
 
Back
Top Bottom