[SOLVED] Need help creating custom trait

RFormica

Imperator Silvae
Joined
May 27, 2017
Messages
473
Location
Pennsylvania, USA
I'm making a mod for Ur-Nammu of Sumeria, and I need help making his leader trait. It gives a custom government (not sure of the name yet) that has one of each policy type and unlocks upon Code of Laws.
I am currently using SQL; after several failures with custom art with XML I've decided to switch.
 
Last edited:
Uh.... for one, doesn't unlocking those governments that early (specifically at Code of Laws) mean that you can't progress further as you literally can't fill in those slots?

For another, there's a reason Democracy, Fascism, and Communism are late game governments as opposed to early game ones...

Finally, switching from XML to SQL won't solve anything as both insert into the database and one's not gonna be functionally different from the other...

of course, SQL is the superior language.
 
A unique government might be a better idea... and yet, I still don't know how I would do that. :(

And the main reason why I switched is that there are many SQL-based tutorials and mods that I can steal code from reverse-engineer.
 
for a beginning mod-maker SQL is much harder to de-bug because the database.log file gives essentially gorsnitcht for clues in the error messages

whereas XML files give an error-type, usually a line stating the offending text-string, and the file name werein the error was encountered.

and for syntax errors for things like forgetting a </Row> closer you still get much more info when using XML

SQL just gives you messages such as near ";" syntax error, which could be any of half a dozen different sorts of errors, and never narrows down where in the file this syntax error is located. Nor do errors from SQl files give the filename directly within Database.log -- you have to compare the time-stamps to those in modding.log in order to "guess" which file has an error.
 
Right, but we're getting off track...
I know the basic "structure" of SQL at this point, over looking extensively over files (If you go to the steam page for any of the city-state packs in my signature you'll see that they're in SQL), this is mainly a code help issue.
I don't generally have a lot of syntax errors; and based on what you've said before and the issues that I normally have, it'll be probably "near "MODIFIER_RF_UR-NAMMU_NEW_GOV" or something like that.

Anyway... if you know how to make a custom government that's unique to a civilization, do tell!
 
So far as I know you can't make a custom government for only one civ. All you can do is give extra policy slots. But the issues re extra policy slot from the beginning of the game is why the civ (Germany, Scythia?) that gets an extra policy slot gets the one it does is so that all the available slots can be filled when Code of Laws is researched.
 
A civ-only government would be possible if it were possible to make un-researachable techs and civics. That ability would honestly solve so many current limitations in modding. Then you could just manually award the unresearchable tech or civic for free.

The issue right now is if you try to make a tech unresearchable (e.g. by making it its own pre-req) the UI crashes. There may be other issues as well.

But yeah I wish we have techs and civics that just don't appear on the tree. It would open up a huge number of options for modding.
 
There's no PrereqTech in table "Governments". There is only "PrereqCivic".

Unresearchable techs are actually possible tho it requres a fair amount of UI re-write, and some gameplay lua. You can thus re-direct any civ which attempts to start researching TechX to some other tech they've not yet researched but can research.

There is no method I've yet tested or found to specify the Civic a player is "resesarching" so there's no way to do such a re-direct for civics.

For techs, the attached mod does work but is a bit kludgey and would need some rework. It creates a dummy tech that is given to Rome, and which should if I have not mucked the modifiers give the same instant effect as completing Big Ben. Problem is that it will instantly conflict with anything at all like CQUI or other UI mods writing to the same game UI-files. Plus since you cannot do dummy civics (because there's no way to keep the AI from "researching" them) I didn't proceed any farther with the concept once I tested that the idea works. Also hence why all the commented lines in the SQL file -- various experiments before I found a method that would work without CTD at game start.
 

Attachments

There's no PrereqTech in table "Governments". There is only "PrereqCivic".

Unresearchable techs are actually possible tho it requres a fair amount of UI re-write, and some gameplay lua. You can thus re-direct any civ which attempts to start researching TechX to some other tech they've not yet researched but can research.

There is no method I've yet tested or found to specify the Civic a player is "resesarching" so there's no way to do such a re-direct for civics.

For techs, the attached mod does work but is a bit kludgey and would need some rework. It creates a dummy tech that is given to Rome, and which should if I have not mucked the modifiers give the same instant effect as completing Big Ben. Problem is that it will instantly conflict with anything at all like CQUI or other UI mods writing to the same game UI-files. Plus since you cannot do dummy civics (because there's no way to keep the AI from "researching" them) I didn't proceed any farther with the concept once I tested that the idea works. Also hence why all the commented lines in the SQL file -- various experiments before I found a method that would work without CTD at game start.


Interesting technique. Code is pretty easy to follow too. Nice work. It's a shame the game doesn't natively support this. Just allowing us to create a recursive loop in tech or civic pre-reqs would have done wonders. I hope we get DLL access eventually, would make passing Modifiers around a lot easier without resorting to such workarounds.
 
Back
Top Bottom