This thread is meant to serve two related purposes. The first is to provide a general Q&A thread for Lua and related topics. The second is to provide a link index for questions and their answers, as well as other resources. I'll edit this post periodically to add links to the questions and answers. This way, there is a convenient place to see if a topic has been addressed.
Don't worry about if a question has been addressed elsewhere, feel free to ask it here anyway. If you know of questions and answers elsewhere on the forums, it would be helpful to post a link in this thread, and I'll add it to the Q&A List. Also, if a question asked here turns out to require substantial coding and/or discussion, please move it to its own thread, or the Lua Scripting Possibilities thread, and provide a link. As a rule of thumb, I'd say after ~6 posts, strongly consider if the discussion should be moved elsewhere.
Questions and Answers
How do I convert my existing scenario to Lua, and take advantage of build option restrictions?
How do I add a wonder to a city?
(Delayed Action Module) How can a delayed action use information that is only available when the action is first delayed? (Question, Answer)
How do I move a city?
How do I add or remove a river?
How do I stop certain ground units from being airlifted?
What is the difference between civ.createUnit, civlua.createUnit, and gen.createUnit, and how do I know which one to use?
How do you add/remove an improvement (or wonder) from a city be it either when a specific turn is reached or when a city is taken?
How do I make nested menus?
How do I make an event fire if a unit is destroyed on a specific tile? (Question, Answer)
How do I add/remove pollution from a tile?
If the River/Road/Railroad/Alpine movement multipliers are different, which one is chosen?
What happens if I use Lua to give a unit a non-integer movement allowance?
Is there a way to set (or increase/decrease) the number of unhappy citizens via some sort of function? Suggestion 1. Suggestion2.
How can I have 2 (or more) sets of conditions for building an item, where only one set of conditions has to be true?
Links to Scripts and Resources
How can I copy my scenario to a larger map?
Download the Lua Scenario Template.
Don't worry about if a question has been addressed elsewhere, feel free to ask it here anyway. If you know of questions and answers elsewhere on the forums, it would be helpful to post a link in this thread, and I'll add it to the Q&A List. Also, if a question asked here turns out to require substantial coding and/or discussion, please move it to its own thread, or the Lua Scripting Possibilities thread, and provide a link. As a rule of thumb, I'd say after ~6 posts, strongly consider if the discussion should be moved elsewhere.
Questions and Answers
How do I convert my existing scenario to Lua, and take advantage of build option restrictions?
How do I add a wonder to a city?
(Delayed Action Module) How can a delayed action use information that is only available when the action is first delayed? (Question, Answer)
How do I move a city?
How do I add or remove a river?
How do I stop certain ground units from being airlifted?
What is the difference between civ.createUnit, civlua.createUnit, and gen.createUnit, and how do I know which one to use?
How do you add/remove an improvement (or wonder) from a city be it either when a specific turn is reached or when a city is taken?
How do I make nested menus?
How do I make an event fire if a unit is destroyed on a specific tile? (Question, Answer)
How do I add/remove pollution from a tile?
If the River/Road/Railroad/Alpine movement multipliers are different, which one is chosen?
What happens if I use Lua to give a unit a non-integer movement allowance?
Is there a way to set (or increase/decrease) the number of unhappy citizens via some sort of function? Suggestion 1. Suggestion2.
How can I have 2 (or more) sets of conditions for building an item, where only one set of conditions has to be true?
Links to Scripts and Resources
How can I copy my scenario to a larger map?
Download the Lua Scenario Template.
Last edited: