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? Solved

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

  1. Protok St

    Protok St Chieftain

    Joined:
    Jul 7, 2018
    Messages:
    73
    Gender:
    Male
    Location:
    Univesrity of Planet
    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. Protok St

    Protok St Chieftain

    Joined:
    Jul 7, 2018
    Messages:
    73
    Gender:
    Male
    Location:
    Univesrity of Planet
    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,395
    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)
     
    Protok St likes this.

Share This Page