1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  3. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  4. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  5. Dismiss Notice
  6. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

LUA Question: Adding Projects and WMDs to players

Discussion in 'Mod Creation Help' started by Barbarian King, Jan 27, 2018.

  1. Barbarian King

    Barbarian King Chieftain

    Joined:
    May 4, 2010
    Messages:
    311
    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.
     
  2. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    5,341
    Location:
    Illinois, USA
  3. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    7,453
    Location:
    France
    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()
     
  4. Barbarian King

    Barbarian King Chieftain

    Joined:
    May 4, 2010
    Messages:
    311
    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: Feb 5, 2018

Share This Page