• Civ7 is already available! Happy playing :).

Guide to VP modding

I think it’d be nice to host the guide on GitHub (doesn't have to be the VP repo) so that improvements and adjustments can be implemented more easily.
I've written it in OpenOffice and I think GitHub would treat the document as a binary file, so it wouldn't be possible to view diffs or merge changes. Does anyone know of a better way to host such a file? Or would it be necessary to rewrite it in another format first, maybe LaTex?
 
Write it in Markdown and put it on Github wiki?
 
Question cause its been a while and the last time I touched this game I only really messed by "programming" from copy pasting and occasionally trying my own edits the SQL and XML Formatting languages (Originally I thought they were just programming languages), but how exactly does the promotion for being unable to cross ocean until astronomy work exactly? I can't find some value within the table additions that specifies the tech can obsolete other than in the original game's XML file that specifies that promotion obsoletes at Astronomy.

I also see that Work Boats got a similar promotion now that obsoletes at Compass so I know for a fact there is a method but I haven't found it, though I recently realized this promotion was a new thing since I last played (Or I think so) so I should probably take another look around.

Will this require Lua to do? If so when can we expect a guide on Lua programming as that would likely help me on my personal path towards Cybersecurity and Networking and this is probably the easiest way for me to stay engaged trying to do it somewhat unfortunately.
 
Question cause its been a while and the last time I touched this game I only really messed by "programming" from copy pasting and occasionally trying my own edits the SQL and XML Formatting languages (Originally I thought they were just programming languages), but how exactly does the promotion for being unable to cross ocean until astronomy work exactly? I can't find some value within the table additions that specifies the tech can obsolete other than in the original game's XML file that specifies that promotion obsoletes at Astronomy.

I also see that Work Boats got a similar promotion now that obsoletes at Compass so I know for a fact there is a method but I haven't found it, though I recently realized this promotion was a new thing since I last played (Or I think so) so I should probably take another look around.

Will this require Lua to do? If so when can we expect a guide on Lua programming as that would likely help me on my personal path towards Cybersecurity and Networking and this is probably the easiest way for me to stay engaged trying to do it somewhat unfortunately.

I use Visual Studio Code, and this is what I do when I need to look for things like that.

1. Have a workspace with both VP repository and Civ5's Assets folder (I made a copy with only the .xml and .lua files).
2. Use the Search function and look for TECH_ASTRONOMY.
3a. You'll find a hardcoded variable in CvGame.cpp set to the Astronomy tech ID, referenced in CvGame::getOceanPassableTech(), but that one's unused.
3b. VP didn't modify the tech, so you'll find it in CIV5Technologies.xml from Expansion2 which has EmbarkedAllWaterPassage set to true.
4. Now search for the Domestic Focus promotion.
5. You'll find the text key in PromotionTextChanges.sql (TXT_KEY_PROMOTION_OCEAN_IMPASSABLE_ASTRO), which points to the PROMOTION_OCEAN_IMPASSABLE_UNTIL_ASTRONOMY promotion in OldPromotions.xml.
6. Search for the promotion and you'll find PromotionChanges.sql set PassableTech to TECH_COMPASS for the promotion in the UnitPromotions_Terrains table.
 
I use Visual Studio Code, and this is what I do when I need to look for things like that.

1. Have a workspace with both VP repository and Civ5's Assets folder (I made a copy with only the .xml and .lua files).
2. Use the Search function and look for TECH_ASTRONOMY.
3a. You'll find a hardcoded variable in CvGame.cpp set to the Astronomy tech ID, referenced in CvGame::getOceanPassableTech(), but that one's unused.
3b. VP didn't modify the tech, so you'll find it in CIV5Technologies.xml from Expansion2 which has EmbarkedAllWaterPassage set to true.
4. Now search for the Domestic Focus promotion.
5. You'll find the text key in PromotionTextChanges.sql (TXT_KEY_PROMOTION_OCEAN_IMPASSABLE_ASTRO), which points to the PROMOTION_OCEAN_IMPASSABLE_UNTIL_ASTRONOMY promotion in OldPromotions.xml.
6. Search for the promotion and you'll find PromotionChanges.sql set PassableTech to TECH_COMPASS for the promotion in the UnitPromotions_Terrains table.
Yeah the only steps I haven't actually performed in this is the first step and the third step lol.

I remember seeing that passable tech option in one of the many files for either VP or a modmod, but I forgot to specify the reason why I wanted to know if this is something that would require Lua is because its less about ocean being passable at a specific tech in my case, and more so I want to nerf a units movement that gets unlocked at Military Theory until The Wheel is researched. I already technically did it by applying a new promotion to it directly that gives it -1 movement, and then having the wheel apply a second promotion from researching The Wheel to a new Combat Class Type I made for it, but that felt a little overkill and it'll show 2 different promotions under said Unit.

I was hoping to find something a little cleaner, AKA the way the promotion TXT_KEY_PROMOTION_OCEAN_IMPASSABLE_ASTRO handles it where it just disappears from the unit.

(For Context, I'm reintegrating the Battering Ram as a Unit instead of a City-State Gift as an Ancient Era Siege Unit.)

I'll make a separate folder with the XML and Lua files from the base game as you suggested just to make looking around easier since the way the devs set up their folders is an absolute nightmare. If I do need Lua or C++ coding to implement this would looking at the code in CivGame.cpp be a good reference point to frankenstein something?
 
Sry I just scanned, but that ocean impassable promo, I believe that's a special case. afaik if you want a promo to expire at a specific trigger you'll need Lua -- others here may know things I don't but I'm 99% on this.

afaik the tech pre req for promos just controls when they are chooseable on xp promo -- if you give it to unit automatically it won't check for tech. I don't believe there is any such 'obsolete' tech for promos

For Lua I'd say you're firmly in the beginner level of tasks so if you understand basics or beyond of scripting you should be good. Several of my mods handle this by checking for the promo on a per turn loop through all units. Once you're handling promos in Lua already in some capacity, I'd suggest just doing both the addition and removal there.
 
Last edited:
Weird that there isn't a game event for tech completion.
 
Weird that there isn't a game event for tech completion.
TeamTechResearched is listed in vanilla lua reference, idk if it functions, but I assume it would

i think you'd still need to loop all units however, cuz you're either gonna give it as free promo and then remove via lua after certain point, or gonna add it at that point, depending if its done as malus or buff -- in either case though you'd still need to handle units trained after the tech event fires, so loop or some other catch mechanism would be needed. Seems to me this event can be ignored as the per turn unit loop would do everything required anyway -- maybe in some fancier implementation you could use it to control whether or not the per-turn-loop activates or not, to save a few cpu cycles when its not needed
 
Sry I just scanned, but that ocean impassable promo, I believe that's a special case. afaik if you want a promo to expire at a specific trigger you'll need Lua -- others here may know things I don't but I'm 99% on this.

afaik the tech pre req for promos just controls when they are chooseable on xp promo -- if you give it to unit automatically it won't check for tech. I don't believe there is any such 'obsolete' tech for promos

For Lua I'd say you're firmly in the beginner level of tasks so if you understand basics or beyond of scripting you should be good. Several of my mods handle this by checking for the promo on a per turn loop through all units. Once you're handling promos in Lua already in some capacity, I'd suggest just doing both the addition and removal there.
Yeah I learned quickly ObsoleteTech isn't something the Promotions Table knows how to handle when I attempted it since all the code after it failed to load. I'll definitely give it a look at some point cause I'd rather playtest it since I regardless need a separate CombatClass for Battering Rams (Field is pointless on a Melee Unit) so it requires me to check every Trait, Building, etc. that gives unit promotions to combat classes and make sure the combat class can take that promotion and then make sure the Trait is updated to include the new combat class.

Thanks for the help you guys!
 
a separate CombatClass
assuming you're referring to the column in the units table, this won't work as you hope (unless you use one that already exists) -- you might get the barebones functionality but the animations etc will all be messed up.

look into PromotionClass instead -- idk how it works but this is where i'd start

alternatively you can do some overrides in lua but investigate db method first
 
assuming you're referring to the column in the units table, this won't work as you hope (unless you use one that already exists) -- you might get the barebones functionality but the animations etc will all be messed up.

look into PromotionClass instead -- idk how it works but this is where i'd start

alternatively you can do some overrides in lua but investigate db method first
What can I expect to be messed up besides animations? And if that is the case how can I fix it?
 
No idea nobody really does this in any widely adopted mod afaik. Wouldn't be surprised if it ctd's with the new asserts in 4.18, but may just be animations, not sure.
Good to know and I'll keep an eye out. I play without animations turned on so I would have never noticed unless I was told. Not gonna throw out that lengthy amount of work but I'll comment it out and see in what other way I could go about using it since I've had some ideas. Thanks!
 
Top Bottom