LUA Question: Adding Projects and WMDs to players

Joined
May 4, 2010
Messages
367
Does anyone know if it is possible to add projects or wmds to a player using lua functions? I've found functions to add units, civics, and techs, but haven't been able to find any for adding projects or wmds.
 
Not tested, but to force-start a project in a city you may be able to use this code (from an UI context, during the turn of the player for who/which you want to add the WMD)

Code:
    local tParameters = {};
    tParameters[CityOperationTypes.PARAM_PROJECT_TYPE] = projectHash;
    tParameters[CityOperationTypes.PARAM_INSERT_MODE] = CityOperationTypes.VALUE_EXCLUSIVE;
    CityManager.RequestOperation(city, CityOperationTypes.BUILD, tParameters);

you can get the hash using that:
GameInfo.Projects["PROJECT_BUILD_NUCLEAR_DEVICE"].Hash
GameInfo.Projects["PROJECT_BUILD_THERMONUCLEAR_DEVICE"].Hash

for finishing the project, you may try (from a gameplayscript context) :
City:GetBuildQueue():FinishProgress()
 
Thanks for the suggestion. I'll see if I can get it to work.

EDIT: I wasn't able to get it to work, but I did use that as a jumping off point to do something else. In the end, I set it to finish the progress of the Manhattan Project and the Nuclear Device project if it detects it is being built in a city belonging to a civilization that is supposed to have these.
 
Last edited:
Back
Top Bottom