C++/Lua Request Thread

I think I'm in need of some lua for my upcoming Confederate States mod (the civ's ID is CIVILIZATION_CSA, since I reckon you need that). I need their Unique Improvement (IMPROVEMENT_ANTEBELLUM) to yield +1 Production while at war somehow, and for their Unique Ability, for all non-ranged units to get a unique promotion (PROMOTION_CSAREBELYELL) for 3 turns after the outbreak of war with another major civilization.
 
Could someone do a bit of code to move the MaxPlayerInstances, MaxTeamInstances, and MaxGlobalInstances columns from the UnitClasses and BuildingClasses tables to the Units and Buildings tables? I want to make unique units that are limited where the default units are not and vice versa.
Thank you!
 
I would like to gratefully and respectfully request a small city state mod. I've been trying to do it myself, but things just aren't working out for me with very very limited Lua knowledge.

I would like a small notification window that shows all pertinent info with CS's. Very much like what the Diplo button shows, except I want it to also show turns until losing alliance, be able to click on a small icon to do the gifting, DOW, etc... or just be able to click the name of the CS in the list and get the regular city state window to pop up would be fine.

Thanks in advance if anybody could whip this together!
 
I would like a small notification window that shows all pertinent info with CS's. Very much like what the Diplo button shows, except I want it to also show turns until losing alliance, be able to click on a small icon to do the gifting, DOW, etc... or just be able to click the name of the CS in the list and get the regular city state window to pop up would be fine.

Most of what you want is on the City State screen of "UI - Trade Opportunities"
 
Hi all. Is it possible to create a Social Policy that removes/negates the per-city Science penalty to Technology cost? Has this already been done? I am making a Social Policy overhaul mod and I can achieve most of the desired effects, but this is giving me a bit of trouble. Thanks!
 

Thanks, Whoward! That's exactly what I was hoping to do. Well, not -exactly-... I'd like to be able to still perform mouse clicks and play the game while I have my city state view up. Would it be simple enough, or ideal rather, to resize that window and remove the ConsumeMouse (or set to 0) to accomplish that?
 
Not sure whether SQL requests go here or in the "regular" mod-component section, but here goes...

I'm working on some mods involving new resources; some of those resources (like Amber) should appear on the map, but some (like Jewelry) shouldn't. I've borrowed FramedArchitecture's generator code for the "should place" items. Forbidding every terrain for the "shouldn't place" items looks tedious, though; I want players to be able to generate some resources only through a special building (like Jewelry through a Goldsmith's shop).

With all this in mind...could I please have an SQL script to add an "OnlyFromBuildings" value to the Resources table? Most resources would set it to false, of course; but being able to set just one new value to true saves a lot of work. If anyone's willing and able to help, I'll give them credit for that part of the code. Thank you!
 
Not sure whether SQL requests go here or in the "regular" mod-component section
It probably should go in mod components, but oh well!

could I please have an SQL script to add an "OnlyFromBuildings" value to the Resources table?
Code:
ALTER TABLE Resources ADD COLUMN 'OnlyFromBuildings' INTEGER DEFAULT 0;
UPDATE Resources SET OnlyFromBuildings = 1
    WHERE Type IN (
    'RESOURCE_AMBER',
    'RESOURCE_BUILDINGONLY2',
    'RESOURCE_BUILDINGONLY3');
EDIT: Obviously this would have to run after you've added your new resources. Alternatively, you could make sure the alter table occurs before you add the resources, and include OnlyFromBuildings within your new resource adds. I prefer the former method, myself, to keep the resources more modular.
 
It probably should go in mod components, but oh well!


Code:
ALTER TABLE Resources ADD COLUMN 'OnlyFromBuildings' INTEGER DEFAULT 0;
UPDATE Resources SET OnlyFromBuildings = 1
    WHERE Type IN (
    'RESOURCE_AMBER',
    'RESOURCE_BUILDINGONLY2',
    'RESOURCE_BUILDINGONLY3');
EDIT: Obviously this would have to run after you've added your new resources. Alternatively, you could make sure the alter table occurs before you add the resources, and include OnlyFromBuildings within your new resource adds. I prefer the former method, myself, to keep the resources more modular.

Thank you for taking the time to write that code; you'll get an honorable mention in the mod description. :goodjob:

Since this changes the table structure, I'd want it installed before the resource list, and identify the new entries as needed. Manufactured luxuries like Jewelry, Glass, or Paintings would simply add this line to the resource stats:

Code:
<OnlyFromBuildings>1</OnlyFromBuildings>

In any case, the resource-generator script will need a new rule to tell it "if OnlyFromBuildings = 1, don't put this resource on the map. I plan to use the generator included in FA's "Amer-Asian Resources" mod, plus the tweak discussed in this thread. FA wrote his rules partly in SQL and partly in Lua; I'm not sure where the new exception would go (which is why I posted under Lua requests). If you could please help me add that last bit of code, I'd be extremely grateful. :thanx: :bowdown:
 
Code:
<OnlyFromBuildings>1</OnlyFromBuildings>
That's exactly what I meant as the less-"modular" solution. But it's fine.

I plan to use the generator included in FA's "Amer-Asian Resources" mod, plus the tweak discussed in this thread.
FA's generator takes the resource to be added as a parameter. The resources to be added are in a list in AddAmerResource.lua. Don't worry about adding a table entry, and just don't include the resources you don't want to place in your equivalent lua file.
 
I hate to make another Lua request when I still need the CSA's done, but I'd like to do a bit of an overhaul of my World Trade Center (BUILDING_WTC) wonder. For the new effect, I'd like the player who owns the WTC to have an additional +1 Delegate in the World Congress for every different civ or city-state they have a trade route with. And if possible, perhaps +1 Delegate for the player being traded with by the WTC owner?
 
I have managed to assemble most of the code and art I need for my next civ, though having been forced into a rather rushed process, I doubt that I can take the time to try to do the Lua myself, given I found it too complex to handle. I have three requests, as follows:

-UA: +1 Movement and 10% Combat Strength to Gunpowder Units; doubled in Friendly Territory.
-UU: Gain a large amount of Culture (Say 5x your Culture per Turn) whenever it enters territory that this unitclass has not gone into before.
-UB: +1 Faith for every farm next to the city.

Thanks for any help! :D

@RawSasquatch - I'm having a go at it now.
 
I have a lua request for code that will set starting (e.g. turn 0) diplomatic relations between civilizations in a scenario - how possible/impossible is this, and would anybody be willing to provide code?

Edit: Nevermind.
 
Since I know nothing about lua, could someone provide me a code that provides, for example, +2 Gold from monuments during Golden Ages (as a trait)? I've tried by looking at other mods' codes, but I can't make it work. It seemed relatively simple, though lol. I'm hoping that I can use the code as some kind of framework for simple traits such as ''when this or that happens (golden age, have policy.. whatever), this or that effect takes place". I do know how to activate the lua :crazyeye:
 
I'll post the layout here to save myself some work later:

-Detect if there's a golden age for the civ
-Detect if there's a monument present in a city
-Give a Dummy Building giving +2 Culture.

I think that's it? I kinda need to know if I'm along the right lines before I try coding this; please correct me if I'm wrong!
 
I'll post the layout here to save myself some work later:

-Detect if there's a golden age for the civ
-Detect if there's a monument present in a city
-Give a Dummy Building giving +2 Culture.

I think that's it? I kinda need to know if I'm along the right lines before I try coding this; please correct me if I'm wrong!

Doesn't that give you +2 culture permanently? Although I asked for Gold, the yield doesn't matter. I was actually thinking that only during golden ages you get extra gold from monuments, not necessarily a dummy building. So if a Golden Age kicks in, all monuments provide +2 Gold. When it's over, they no longer provide the +2 Gold. So, just an effect during Golden Ages.
 
Speaking of which, while I REALLY hate to ask for more lua while I've got 2 requests already in the pipe, does anyone have a UA code that awards a hidden building for every specific worked improvement? I know that there's a few mods that use such an ability, and I need it for part of my Yucatan UA (Receive 5% Military Unit production in a city for every worked Plantation).
 
Doesn't that give you +2 culture permanently? Although I asked for Gold, the yield doesn't matter. I was actually thinking that only during golden ages you get extra gold from monuments, not necessarily a dummy building. So if a Golden Age kicks in, all monuments provide +2 Gold. When it's over, they no longer provide the +2 Gold. So, just an effect during Golden Ages.

Oops, I managed to misread "Gold" as "Culture". Somehow. How it happened is beyond me; my apologies.

Anyway, I think that there's something you can do so that while the condition is true (Golden Age), you get extra gold from monuments. I'm not sure how to do it without dummy buildings, though. I will attempt to write up the code later.
 
Oops, I managed to misread "Gold" as "Culture". Somehow. How it happened is beyond me; my apologies.

Anyway, I think that there's something you can do so that while the condition is true (Golden Age), you get extra gold from monuments. I'm not sure how to do it without dummy buildings, though. I will attempt to write up the code later.

Ok, great! :D The dummy method should be fine too, no problem.
 
Top Bottom