Change resource - Help

Riker13

King
Joined
Nov 9, 2001
Messages
859
Location
UK
I want to change the resource IVORY to ELEPHANT so that all nations can use them as "War-Phants"

Is it an <Update> issue?

Any help or guidance will be great.

Regards

Riker13 :crazyeye:
 
You need more detail about what you're trying to do, but the short answer is no, you can't just do it in XML. Here are a few issues you'll have to keep in mind:

1> If you want to have a resource be used as a strategic, then you'll have to change its Resource Class from Luxury to either Rush or Modern as an XML change.

2> You'll also need to adjust the quantities, and that means Lua editing, because the XML fields for this aren't used. (Specifically, AssignStartingPlots will need to be HEAVILY modified in at least six places that I can think of.) Luxuries and Strategics are handled almost entirely separately, so changing something from one category to the other would require a large amount of editing to the spawn tables.

3> The UI (specifically TopPanel.lua) will treat any resource that has a <Happiness> value as a luxury and not a strategic, regardless of what Resource Class you set. It's easy enough to fix this (I did so for my own mod), but this means that if you want elephants to still act as a luxury then you'll have issues. And removing its happiness has all kinds of other balance issues.

Plus the usual assortment of Civilopedia entries you'd have to tweak.
 
Bugger ;(

But thanks for the quick reply, ok plan 2.....................
 
2> You'll also need to adjust the quantities, and that means Lua editing, because the XML fields for this aren't used. (Specifically, AssignStartingPlots will need to be HEAVILY modified in at least six places that I can think of.) Luxuries and Strategics are handled almost entirely separately, so changing something from one category to the other would require a large amount of editing to the spawn tables.
This actually got me thinking... would it be possible to mod AssignStartingPlots so that it reads the values from a new table, instead of having the values defined in the LUA code? This could potentially make it a lot easier to mod in extra resources or alter the distribution of existing resources; all you would have to do is edit the XML file for the new table, instead of tweaking things everywhere in the LUA code.
 
This actually got me thinking... would it be possible to mod AssignStartingPlots so that it reads the values from a new table, instead of having the values defined in the LUA code?

No. I mean, yes, you can have Lua read XML, but that part's not actually the problem.

The first problem is that when the script calls GetMajorStrategicwhatever, the calling statement has a specific number of arguments. It's not being handled as an allocatable data structure or anything like that, so when the calling routine has 7 arguments and the called routine returns 10, or vice versa, then things break. It's just not dynamic; if you add a new resource, then you need to rewrite all of those, and that's what makes it incompatible with, say, the Lakes map script (since it has its own version of that subroutine). If the devs were smart they'd have written the map script resources as a modifier, so that you could default any new resources to x1, but they instead took the cheap way out and overwrote the existing routine. (The fact that map scripts override mods is also backwards, IMO.)
This also means that if you restructure AssignStartingPlots to read from files, then the Lakes, Great Plains, and Highlands map scripts will stop working entirely unless you make new versions of them as well.

The second problem is that the rarities are all handled through a bunch of weighting tables, and while you COULD transfer all of those to XML, it'd be a HUGE amount of work. So if a Small deposit on a grassland hill has a 25% chance of being Iron, a 45% chance of Uranium, and a 30% chance of Aluminum (just making those numbers up), then think about how much XML you'd have to write to just set that ONE rarity table. Now double that for the Major deposits, and add in the other dozen or so terrain types.

Besides just being a tremendous amount of work, you'd also end up with something that's completely incompatible with any future updates. Now, if Firaxis was smart they'd do this themselves, so that they could fix the map scripts at the same time. Of course, doing that would break plenty of existing mods (like mine) and nearly any custom map script, so I hope they don't do that any time soon.
 
This actually got me thinking... would it be possible to mod AssignStartingPlots so that it reads the values from a new table, instead of having the values defined in the LUA code? This could potentially make it a lot easier to mod in extra resources or alter the distribution of existing resources; all you would have to do is edit the XML file for the new table, instead of tweaking things everywhere in the LUA code.
Yes, but the modification has to be a bit deeper than that, due to the architecture of the file. Quite a lot of it needs to be reworked.
 
Back
Top Bottom