lua

  1. A

    [R&F] Modding Loyalty

    I would like advices and tips on how to mod Loyalty in order for it to use Culture and Tourism instead of Population. I have some knowledge of modding, and so far I see that it will either come down to some SQL changes or adding some gameplay scripts to override either the calculation of...
  2. C

    LUA Trait Help

    After battering my head against the wall trying to come up with a way to code my in LUA, I've hit an actual wall... From my limited knowledge of Lua, I cobbled together this 'pretty' piece of code: function CheckPlayerPeaceDeal(iPlayer) local pPlayer = Players[iPlayer] local...
  3. R

    radioactive contamination

    Does anyone know how to add it to a tile in Lua? I've looked through GameInfo.Features(), and GameInfo.Improvements(), and even GameInfo.Resources(). I also can't find any relevant functions in the TerrainBuilder table. (I'm making a map script.)
  4. F

    [Vanilla] Add yield to plot.

    Is it possible to add yields to a plot if the player has a specific trait? For example add +1 food and +1 production to desert tiles.
  5. F

    [Vanilla] Add a formal war?

    Is it possible to add a formal war? And if so, for a specific civilization? For example like India in R&F, where they can declare a "War of Territorial Expansion". So this is what I want to do: * Add a formal war which can only be used by a specific civilization * (lua) Can check if a...
  6. Bangra 7

    Creating a civ leader mod component based of Tropico mod.

    After downloading the Tropico MOD for BNW, I figured I'd edit the Presidente LUA script, to allow a unit class to be chosen. This UNITCLASS_LEADER, will feature different leaders for my fictional nations in the MOD, and I want to be able to let multiple nations use the script. Do I have to...
  7. F

    [vanilla] How to add a mission?

    This is my code, but it doesn't work! And yes, it's from this tutorial: https://forums.civfanatics.com/threads/dll-custom-missions-via-xml-and-lua.494531/
  8. F

    [vanilla] Execute code if a unit stands on a luxury resource.

    I'm trying to give the player horses if an unique unit is standing on a Deer plot. This is my code right now: local samiLeader = "LEADER_FEB_LARS" function scoutUnit(iPlayer) local player = Players[iPlayer] if GameInfo.Leaders[player:GetLeaderType()].Type ==...
  9. F

    [LUA] My lua script doesn't work!

    I simply get this error: [16495.250] Runtime Error: Assets\DLC\Expansion2\UI\InGame\InGame.lua:1262: attempt to index local 'addinFile' (a nil value) [16495.250] Runtime Error: Error loading Assets\DLC\Expansion2\UI\InGame\InGame.lua. * The LUA script is not imported as VFS. I've done this...
  10. seed.of.apricot

    Won't player:GetStats() work correctly on Firetuner?

    On Firetuner, I tried this: function() local listItems = {}; listItems[1] = Players[0]:GetCulture():GetCultureYield(); return listItems; end it returned some value. However, when I tried this: function() local listItems = {}; listItems[1] = Players[0]:GetStats():GetTourism()...
  11. sman1975

    [BNW] LUA Popup Question: Is it an error or is it not?

    Hello, Working on a simple popup window, and at some time in the past 10-15 changes/rebuilds, an odd message showed up in the database.log - I"m not sure when it started exactly, and the code actually works fine: [425562.593] Database::XMLSerializer (LUA/MercFunctions/MercFunctionPopup.xml)...
  12. Wichilie

    [MOD] GetWarmongerThreat always returns -1

    Hey, I'm working on an UA that gives a player's units a promotion based on the highest warmongering level out of everyone that player is at war with. This is what I have right now: -- AssignAntiWarmongererStrength -- Author: Wichilie -- DateCreated: 12/16/2017 11:19:53 PM...
  13. sman1975

    [BNW] LUA - Popup Management Problem

    Hello, I'm working on a function that cycles through all a player's units. For certain type of units, e.g. Mech Infantry, the function should pop up a window asking for an "Action A" or an "Action B" button to be pressed. Based on which button is pressed, a different function would be called...
  14. sman1975

    LUA - Popup Issue

    Hello, I'm working on a function that cycles through all a player's units. For certain type of units, e.g. Mech Infantry, the function should pop up a window asking for an "Action A" or an "Action B" button to be pressed. Based on which button is pressed, a different function would be called...
  15. P

    [BNW] (Help) Improvement granting free resource

    Does anyone know a way to make an improvement you build grant you a free resource that you haven't built on? As in you build a tile improvement, then that grants you 1 free luxury resource? Is there a LUA way to do it? I've been trying to get this done for days and it's driving me crazy. Any...
  16. sman1975

    Increasing Strategic Resources when a Building is Completed

    Greetings, Here is a bit of a headache in a mod I'm working on at the moment. Situation: 1. A player can construct a "Foundry" building - which provides 2 units of Iron. 2. The player later builds the "Ironworks" national wonder. 3. Would like for the existing Foundry buildings to now...
  17. pineappledan

    Coding help: disabling feature on tooltip

    I want to make a Unique improvement which does the following: +1:c5faith: for every belief on majority religion in City This is easily done with SQL by simply adding 1 faith to (Belief_ImprovementYieldChange) for each tenet individually, the problem is that the EUI tooltip for this improvement...
  18. Wichilie

    [BNW] Nil value error on event hook

    Hey! I've been trying to get a custom unit for a mod I'm making to have attack based on the current era. This is what I've got so far for the script: print("Loading AssignEraStrength.lua...") local iRequiredUnit = GameInfoTypes.UNIT_SHURIMAN_ASCENDED local iStrengthPerEra = 15 function...
  19. seed.of.apricot

    "Require" a lua package

    Currently I am planning to make a new mod that overwrites existing lua with my code and contains "require" to import a certain lua package. But I'm not sure if it is allowed to import another file in my lua code because it may cause a security vulnerability. e.g. local hogehoge =...
  20. F

    [Vanilla] Possible to check the players strategic resources?

    Is it possible to get the strategic resources of a civ or minor civ? And can you give strategic resources to them? (What I mean with strategic resources is horses, iron, aliminium, uranium etc.)
Back
Top Bottom