lua

  1. P

    [TOT] [TOTPP] The General Library

    Edit: Go to this thread for updates to the General Library. The General Library is a collection of relatively basic functions with wide potential use. The standard usage will be gen.generalLibraryFunction(input1,input2) The General Library is currently under construction, so go to the last...
  2. AeonsOfTime

    Mod configuration file best practices?

    Hi all, I have a small mod with some configuration settings in a lua script. I would like to move these configuration settings to a separate file, so they can be easily edited without opening the main script. It can be another lua file, an xml file, or whatever other format that can be used...
  3. M

    Trait Start Promotions 2019-06-23

    A simple mod that allows granting a free starting promotion to a civilization’s first warrior (or warriors if you are using a mod that allows starting with more than one warrior). As built it grants Mystic Blade to the first Indonesian warrior, Buffalo Horns to the first Zulu warrior, and Desert...
  4. N

    [GS] Getting AI to use customized builder unit

    I made a builder identical to the vanilla Builder, except he only has 1 build charge. I gift him to players (human and AI) with a lua script. Everything is working fine, except the AI refuses to use the custom Builder unless he is both able to be trained in a city and cheaper than the vanilla...
  5. AzraelZephyrian

    [LUA] Does pUnit:GetPlot() work in Civ VI?

    See title. Feel free to ask me to remove this if I'm wasting space. Also, does "IMPROVEMENT" still exist as a valid type?
  6. americanslon

    Remove button from Action

    I making a mod where a button should show up based on the type of unit is selected. I "borrowed" some code to display the button from another mod: If correct unit is detected it calls two functions First: function CreateHurryProductionButton() hurryProductionIM:DestroyInstances()...
  7. americanslon

    LUA functions returning nil when not expected

    Some code local player = Players[playerId]; local unit = player:GetUnits():FindID(unitId); local plot = Map:GetPlot(unit:GetX(), unit:GetY()); local city = Cities:GetCityInPlot(unit:GetX(), unit:GetY()); This code gets triggered OnUnitSelectionChanged. The unit is currently at a city but no...
  8. T

    [BNW] display remaining moves on unit path

    I always forget how much movement points its going to cost to move in a forest hill, is this doable with lua only? i have no clue how to start. Community Patch has something of the sorts but it seems like there are massive pathfinding changes in the dll as well
  9. T

    [BNW] newbie to lua, what's wrong with this script?

    I'm using whoward's dll. I want to run an action when a great person is born, but it says "attempt to index local iUnit (a number value), isn't this the right way to ask? function TestGiveGPFaith(iPlayer, iUnit, iUnitType, iPlotX, iPlotY) print("unit spotted") if iUnit:IsGreatPerson()...
  10. S

    [BNW] Food & Production from city state trade routes

    Hey, I want to mod a social policy in the patronage tree to give Food and Production from city state trade route. My idea is to use the "TRAIT_GATEWAY_AFRICA" Trait to write my own trait with Food/Production instead of Gold/Culture. Next I need a .lua where every civ gain this trait when the...
  11. Chrisy15

    C15's CMM Troubleshooting Guides

    Archive of Troubleshooting articles written for the Civilization Modding Monthly since although publishing them there allows them to be presented to a wider audience, it's less useful for people searching for answers and for directing questioners. Some of these articles can , or may in some...
  12. clausewitz77

    How to change the name of a civilization during the game?

    I am pretty new to modding, but in Civ5, I had created a mod which changed the names of some civilizations when a new era had started. Let's say, Rome became Italy in the industrial era. I want to do the same in Civ6. I think I found out everything I need, except the most basic: How can I...
  13. S

    Is it possible to change each city yeild independently?

    I'm trying to introduce the next change in my mod: - cities yield per population is decreased greatly, - each district generates a yield of the corresponding type based on city population - you can build any number of districts of the same type for the city, their summed yield should be...
  14. killmeplease

    How to loop a city's buildings?

    city:GetBuildings() returns an object which i cant loop through like player:GetCities() it can say if the city has a particular building -- bs:HasBuilding(idx) but i want to get the full list...
  15. sman1975

    How to Force a Deal?

    Am working on a mod that really needs the ability to force an 'Open Borders' and/or a 'Peace Treaty' (of more than a turn) between two civs. Have researched this a lot, but all roads seem to lead to a dead end. I did find one thing that looked interesting...
  16. F

    Custom district invisible. HELP

    So I've made a replacement district, and everything works fine, but it is invisible! I guess I have to reference some of the models to the district, but how do I add for example the commercial hub model to my district, and is there any way I can make my own? Thanks.
  17. fertiliser

    [BNW] [Bugfixes] [Optimisation] Has it been done before?

    I have a reasonable amount of experience with modding Civ5, but have always avoided the DLL due to compatibility issues. This time around. there's an ambitious project on the horizon. It involves bugfixes and QoL, that may or may not have been done in the past. I'd like to make sure before I...
  18. J

    Did anyone ever want to introduce culture invasion system into Civilization 6?

    I have an idea, but I don't know how to realize it by lua. Could anyone give me some inspiration? Here is what I want to do. Culture and Tourism can increase the amount of loyalty gained from your cities to your cities or other ai's cities respectively. The coefficient of promotion is the ratio...
  19. sman1975

    LUA - Odd text error

    Hello, I'm working on a mod that adds a couple of customized civs. When I use the "GetCivilizationDescription()" method to pull the civ's name, the civ's Leader Name is returned. Same for GetCivilizationShortDescription, as well. I used SQLite Spy to look at the Localization database and see...
  20. F

    Units can move over mountains trait?

    Code: <Terrains> <Update> <Where TerrainType="TERRAIN_GRASS_MOUNTAIN" CivilizationType="CIVILIZATION_FEB_CARTHAGE"/> <Set MovementCost="5" Impassable="0" DefenseModifier="3" /> </Update> <Update> <Where...
Back
Top Bottom