[Question] Trying to add something

gradea

Chieftain
Joined
Aug 6, 2005
Messages
14
So, I just got civ 5. Lot of changes, not sure if they'll be for good or ill. But I figured I'd try my favorite part, the editing.

Now, let me preface this. I've done a LITTLE independent study of SQL, and am a student just starting the computer science program at my college.

... And dear lord in heaven maybe when I get my Bachelors I'll be able to ACTUALLY mod something.

Seriously, the GECK editor is user friendly. This? This is just a file editing utility they allowed you to download. The only way it could be harder is if they made you hunt down the tools yourself, or encrypted the files. I'm not starting this post just to complain though. I just want to add one small thing.

A little late game resource sink/way to help new cities get off the ground faster. The basic idea was I'd make a unit that could join a city like a great person, and have an effect (Small food or production boost). A little something that's expensive, but helps you get a new city off its feat, and is something to spend resources on later on.

Adding the new unit isn't that hard, its finding out how to actually give it the ability to join the city like a specialist. Going to the missions file lead me to entity events... which was a dead end.

"Simple" left the building LONG ago...
 
First of all, SQL is not the lowest level of modding in this game. XML is. Basically, learn the XML editing first, then learn SQL, then Lua. (Some people skip the SQL altogether.) And yes, I know that the XML is a front-end for the SQL, but that's the whole point of being more user-friendly.

Second, no, it's not difficult. Once you understand XML syntax, for instance, it's VERY easy to make mods. And learning the syntax isn't too difficult; go read Kael's guide over in the References section, and then work from there. In practice, the XML editing here is FAR better than the GECK; it's not quite as colorful, but the simplicity of text file tables has a big advantage over the mess you'd often have in modding the Fallout games. (On the other hand, the GECK was much better at handling art assets.)
Lua, however, is basically a lot like a solid programming environment, and so shouldn't be messed with by anyone who doesn't know how to write code. You don't have to use Lua to make a good mod, but it helps.

It's intimidating, sure, but realize that there are quite a few Civ5 mods, and most of the people involved don't have computer science degrees. Ergo, it can't be as bad as you seem to think it is, or else no mods would ever have been completed. QED.

A little late game resource sink/way to help new cities get off the ground faster. The basic idea was I'd make a unit that could join a city like a great person, and have an effect (Small food or production boost). A little something that's expensive, but helps you get a new city off its feat, and is something to spend resources on later on.

Why bother with the unit, then? There are other, better ways to handle something like this. For instance, you can create units that act like toned-down versions of the Great Engineer, and can be sacrificed to rush production in a city. (Done that.) Or you can create a building that adds a small amount of food/production/whatever to all cities in your empire. (Done that.) Or change the growth equation to make small cities grow faster and large cities grow more slowly, then add some growth-enhancing buildings requiring various city sizes to act as a resource sink for larger cities. (Done that.)

The reason I say these ways are "better" is simple: the AI is somewhat limited in the sorts of things it can understand. If you were to somehow create a mechanism by which a certain unit could be combined with a city, the AI would have no idea what that would imply. If it even knew that the unit could be sacrificed, then it'd be just as likely to do so at your capital as in one of the fringe cities, and there's a very good chance that it'd have no clue that sacrificing is the primary use of the unit.

Adding the new unit isn't that hard, its finding out how to actually give it the ability to join the city like a specialist. Going to the missions file lead me to entity events... which was a dead end.

Adding a new action isn't difficult. The hard part is tying an EFFECT to the action, and that generally requires Lua, because XML and SQL are not designed for that. Lua is very powerful, and can do a lot of different things; its main drawback is a lack of documentation. 2kgames has a wiki that lists most of the Lua functions and events, but the argument lists and triggers are not documented as well as they should be, so there's quite a bit of experimentation going on as we speak.

And again, even if you could give the action an effect, the AI would not understand how the two connected, so the only way this would work without totally unbalancing the game would be if the change was something that the AI already was intending to do.
As an example, let's say I want a custom worker unit to be able to terraform a desert into a grassland. I could handle this as a direct action, but the AI wouldn't understand that it's an action that needs to be done on deserts but not while standing on grassland, and it wouldn't really understand the benefits. So instead, you work it indirectly; the worker places a temporary Terraform improvement, an improvement that can only be built on desert tiles and that has all of the Flavor and yield values needed to make the AI associate it with a gain in food. When it completes, a Lua function removes the improvement and changes the terrain type to grassland.
Same effect as an action, but it works within the existing XML framework (mostly) in a way that the AI is already built to understand. And yes, I've done exactly this in my own mod, which has a half-dozen different terraforming actions built along these lines.
 
Back
Top Bottom