1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    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 Lazy Wannabe Artista

    Joined:
    Aug 30, 2013
    Messages:
    9,398
    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