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] Create Improvement by lua of the map, how to?

Discussion in 'CivBE - Modding Help & Mod Creation' started by Progenitor Race, Jul 7, 2018.

  1. Progenitor Race

    Progenitor Race Chieftain

    Joined:
    Jul 7, 2018
    Messages:
    2
    How to create Improvement by lua of the map?

    There is a LUA's scripts for creating a separate maps. In those we can do like this:
    plot:SetPlotType(PlotTypes.PLOT_LAND);
    and this:
    plot:SetTerrainType(TerrainTypes.TERRAIN_PLAINS);
    and this:
    plot:SetFeatureType(FeatureTypes.FEATURE_FOREST);

    It's worked exactly expected.

    But if I try same for imrovements it's not worked:
    plot:SetImprovementType(ImprovementTypes.IMPROVEMENT_GOODY_HUT);



    [166622.967] Runtime Error: ***.lua:279: attempt to index a nil value
    stack traceback:


    Where is a mistake?
     
  2. Progenitor Race

    Progenitor Race Chieftain

    Joined:
    Jul 7, 2018
    Messages:
    2
    Problem solved with premaded vars. For Example

    local IGH = GameInfo.Improvements["IMPROVEMENT_GOODY_HUT"].ID;
    plot:SetImprovementType(IGH)
     
  3. Ryika

    Ryika likes cookies and milk.

    Joined:
    Aug 30, 2013
    Messages:
    8,658
    The problem is that ImprovementTypes does not exist. No need to predefine those variables, you can also just do:

    plot:SetImprovementType(GameInfo.Improvements["IMPROVEMENT_GOODY_HUT"].ID)

    Or alternatively:

    plot:SetImprovementType(GameInfoTypes.IMPROVEMENT_GOODY_HUT)
     
    Progenitor Race likes this.

Share This Page