Several "Newbie" Questions

General Tso

Panzer General
Joined
Oct 12, 2007
Messages
1,548
Location
U. S. of A.
In the past I did a lot a modding for Civ4 and I'm now considering a move to Civ5. I'm going to start checking things out but I had several questions I hope can be answered without to much trouble.

1. In Civ4 modders where eventually given access to the .dll file and could modify it using C++. The last I heard this was going to happen to Civ5 but I haven't heard anything to indicate that it actually happened. Has there been any updates on this subject.

2. Is it possible to change the victory conditions?

3. Is it possible to load a new map automatically?

Basically what I want to do is create a scenario that consists of a series of maps with custom victory conditions. When victory occurs on the current map the player would click on "Continue" on a custom victory screen and the next map would load automatically. I would also need to preserve some of my mod's data between maps.
 
1. In Civ4 modders where eventually given access to the .dll file and could modify it using C++. The last I heard this was going to happen to Civ5 but I haven't heard anything to indicate that it actually happened. Has there been any updates on this subject.

No. We've been told it's on its way quite a few times; with the announcement of the first expansion coming out in three months, a number of people are guessing that it'll be out some time after that, since there wouldn't be much point in them giving it to us soon only to have to do it all over again post-expansion.

2. Is it possible to change the victory conditions?

Depends which ones, and how you want to change it. You can change the number of branches needed for a Culture win, for instance, but you can't change it to depend on something other than the number of Policy branches, at least in XML. You can change the number of parts needed for a Space Race win, but if you try to make it need 50 parts like back in the old days, then the UI will break unless you edit that too.

In Lua, you can change almost anything. including adding new victory types. In my own Alpha Centauri mod, for instance, I "disabled" the space race victory; the reason I use quotes is that its components are still in the game, and you still try to build all the parts as normal, but now the completions trigger a bunch of future-era events instead of leading to a victory. And then, at the end of the tree, I added a new victory type awarded entirely through a series of Lua events.

3. Is it possible to load a new map automatically?

Basically, no. We can tweak how the existing map loads by editing functions like AssignStartingPlots, but we don't have access to the functions needed to do more. We can't even update the graphics of the existing terrain; if you change a terrain type through a Lua function, then you won't see the new graphic until you reload the game. So switching to an entirely new map mid-game would be entirely out of the question.

At best, you could destroy the current map (delete all cities and units, change all terrains to the new map, place new starting cities) and make a popup to tell the player to save and reload to continue to the new map. But that'd be a tremendous amount of work, because you'd have to call all of the map generation routines over again, and I'm not sure how flexible those things are.
Also, if you do those deletions, the game might decide partway through that the game's now over (since at some point, the Domination victory will be met where one player still has his capital and the others don't) and do all of the usual victory popups.

Bottom line, I'd wait for the DLL. Even then, it won't really be easy to do what you're asking.
 
Thanks for the excellent answers. Yea I agree that it makes sense that the dll won't be released until after the expansion. Hadn't thought of that.

I guess I'll just spend a little time exploring how thing work. Then look it to things more closely when and if the dll arrives.
 
3. Is it possible to load a new map automatically?

Basically what I want to do is create a scenario that consists of a series of maps with custom victory conditions. When victory occurs on the current map the player would click on "Continue" on a custom victory screen and the next map would load automatically. I would also need to preserve some of my mod's data between maps.
that's a feature I'm pondering to do since my Stalingrad scenario.

Changing plots and force a save/reload to update the graphic should be doable, keeping/spawning/teleporting units shouldn't be a problem, cities translation (first map Berlin at west side, second map centering on it for example) may be harder, but keeping data from save/reload is definitively not a problem.

The maps sizes would have to be fixed, but focusing on one portion should do to simulate size change.

Seraphim's RealNameEarth contains function to load a map from a lua file containing a table with all plots, so what's most needed would be to write a function to output a WB map to the lua log in form of such a table so you can create multiple tables and refer to them for rewriting the map ingame. But I don't know how the game would handle the include of a lot of maps coded this way. :think:
 
Thanks, that sounds like a very good start. I need to spend some time learning the basics of Civ5 modding first. Then I'll check out Seraphim's mod. If you find anything worthwhile in the mean time I'd be greatly interested in hearing about it.
 
Depends which ones, and how you want to change it. You can change the number of branches needed for a Culture win, for instance, but you can't change it to depend on something other than the number of Policy branches, at least in XML. You can change the number of parts needed for a Space Race win, but if you try to make it need 50 parts like back in the old days, then the UI will break unless you edit that too.

In Lua, you can change almost anything. including adding new victory types. In my own Alpha Centauri mod, for instance, I "disabled" the space race victory; the reason I use quotes is that its components are still in the game, and you still try to build all the parts as normal, but now the completions trigger a bunch of future-era events instead of leading to a victory. And then, at the end of the tree, I added a new victory type awarded entirely through a series of Lua events.

What would be an easy way to remove Space Race and Diplomatic victories so that they never trigger regardless without messing up the UI or causing unnecessary "Player X has won a Space Race victory!"?

On top of that, disable the "Space Race" and "Diplomatic" victory options from the advanced options screen?
 
What would be an easy way to remove Space Race and Diplomatic victories so that they never trigger regardless without messing up the UI or causing unnecessary "Player X has won a Space Race victory!"?

If you just update the XML to set <WinsGame> to False for those, you won't get the end-of-game big popup, although you'll still get the "Bob is #1 in Science!" indicator in the small popups on the right hand of the screen on the turn when they complete the requirements. Personally, I didn't feel this was annoying enough to intercept initially, although since then I've had to adjust popups for other reasons (making certain Projects not give a popup when completed, because I'm using Lua to assign them to players for bookkeeping reasons) so it's not hard to block those popups as well.

Beyond that, you just can't stop them in-game without entirely deleting them, and every reference to them, in all of the XML. And even that'll fail because certain UI elements are expecting the full list. VictoryProgress is one, obviously; while it's built to not show the spaceship or cultural boxes when those are disabled, internally it's still expecting them to exist in the database, to say nothing of the fact that the progress screen would now be half-empty all the time.

And then there's the one you mentioned:

On top of that, disable the "Space Race" and "Diplomatic" victory options from the advanced options screen?

This, unfortunately, requires editing AdvancedSetup.lua itself (which I've done, in my mod). The existing victory conditions are actually stored within each map, to where this Lua function loads the chosen map's settings as its default. So if you want to disable one victory entirely, like I did, or add a new victory type, then you'll need to adjust this setup screen to intercept it... unless you're doing this for a scenario, where the map will already have the appropriate changes to which conditions are to be used.

If you look in my Base mod, where I have a modified version of AdvancedSetup, you'll see that it's leaving the Space Race victory in the XML but simply setting WinsGame=False, removing it from the UI, forcing it to be set to turned off regardless of the map, and then enabling a box for the Transcendence win (defaulting to on, regardless of map), which also has WinsGame=false in the XML and is awarded through Lua. So looking through my version should give a rough idea of how to do this in your own mod. (I've made a lot of other changes to that screen, so you can't just use my file as-is.)
 
Back
Top Bottom