A Quick Question (Also, Hello World!)

HPetch

Chieftain
Joined
Dec 11, 2016
Messages
6
Hello CivFanatics! I've been interested in modding for a while, and Civ 6 has caught my eye, so here I am. If there's another place for intos I'll move this there, but I digress. I have a few projects percolating, but I'll refrain from posting them until they're a little more concrete. Until then, I have a question: I suspect a lot of the bits I have to tweak for some of my projects are supposed to be in UnitActions.xml, but the file is empty for some reason. Is this normal, or am I missing a file? I'm trying to create an active ability for a unit, and I think I have it right, but I'm not 100% sure.
 
Possibly. As near as I can tell, UnitAbilities governs passive effects that can't be applied in the Units table, and UnitCommands governs things you can tell a unit to do. The issue I am having is that I can't figure out how the Commands in UnitCommands are tied to specific units, or actual ingame effects, so I don't know if the command I created will apply to the unit it should, or all units, or none of them. There seems to be a gap between what you tell a unit to do and what happens ingame, which I figured was what is supposed to be in UnitActions. Perhaps I already have everything set up correctly, but my gut feeling is that I've either missed a step or gone in entirely the wrong direction.
 
A completely new command would be a new aspect of the game that the AI can't use. The human player would at least need a button, code for that is in the UI .lua files. And for something to actually happen ingame, you'd need to make that button call a function of the game core. Without game core source code, we can't really create new game core functions.
(At least that's my understanding of the current situation. Correct me if I'm wrong.)
 
I'm hardly qualified to correct anyone, I just started. That being said, I'm not trying to do something completely new. I am, broadly speaking, trying to give a limited version of an active ability one unit has to another unit (sorry for being vague but I don't want to give my idea away). I think I have it set up right, but I'd rather ask someone then spend 8 hours testing it, if I can avoid it. I'm sure someone has done what I'm trying to do, or at least something similar.
 
Ok, so let's say you're trying to create a Combat Medic and you want an active ability for that medic to be able to "heal" a unit next to it for say 20% of their health. You'd have to have an at minimum a UI button for the user to click on. You'd then attach that to a function (LUA) on click to highlight all surrounding units that are within range and damaged, along with enabling a new 'on next click' type of functionality (already existing in game I believe? at least it was in BE) then on that second click you would fire off another LUA function to actually heal the selected unit by your 20%.

Now this ability wouldn't just appear because you added it. You'll need to assign that ability to the given units. It's been a few years (the launch of BE) since I've written any mods for civilization, but you should be able to assign specific actions to specific units. I'm in the office and don't have access to the civ VI DB dump files to look over them but there is an SQLite table containing all the linkages between actions and units.

But in the end, your looking at a bare minimum of 2 LUA functions and 3 - 4 SQL updates/inserts. Depending on how you want this unit to have this functionality it could result in further changes. Example being is it a promotion selectable ability or just one a unit would have outright like a "fortify and booby trap" ability that all Modern AT Infantry units would get. But keep in mind that the AI isn't going to use that ability unless it is specifically told to, which is a completely different thing.
 
Thanks for the insight, things are actually quite simplified in Civ 6. I have my mod largely functional with nothing but about a dozen table inserts in an XML file, and your example wouldn't be radically more complicated, although I would take a bit of experimentation. the core of the issue I'm running into is that there seems to be a chunk of stuff right in the middle of things that is hard-coded into the game, somewhere between telling a unit to do something and what actually happens, and I keep running into that while planning. I can find the "create a button on the UI" bit, and the "this ability does this thing" bit, but what actually ties the two together seems to be buried somewhere I haven't thought to (or can't) look. That, and it takes a while to test things, as I don't have access to debug stuff (can't get FireTuner in Canada). I'm going to post an alpha version of my project once I have a couple more features as functional as I can make them, then hopefully someone can tell me what I've been missing.
 
Top Bottom