Can Global warming effect be change from desert to fallout?

Feanor777

Zaphod Beeblebrox
Joined
Jun 25, 2007
Messages
37
In GlobalDefines.xml if I change:

<DefineName>GLOBAL_WARMING_TERRAIN</DefineName>
<DefineTextVal>TERRAIN_DESERT</DefineTextVal>

to:

<DefineName>GLOBAL_WARMING_TERRAIN</DefineName>
<DefineTextVal>FEATURE_FALLOUT</DefineTextVal>

will that give me fallout instead of desert when Global warming happen or something else must be edit?
 
That's a good question... I hope somebody knows the firm answer!
 
The answer to this question is: try it, and post your results here. I for one would be really interested in using this if it does work!

PS. any TERRAIN_* seems to work, but I haven't tried FEATURE_*
 
Why not try it? Start a game, go into worldbuilder and give yourself loads of nukes, set them off all over the place and see what happens. If it doesn't work, you can always change it back.

If it does work, let us know - global warming making desert everywhere is horrible.
 
I've a question that is irking me for a while: thre is any way of putting a "if , then, else" structure in the Global warming <DefineTextVal></DefineTextVal> tag to make it dependant of the previous train and of rivers/lakes/coast? That would make a much more richer GW effect...
 
My god... if this works, it would be the Single Greatest Thing Ever.

Add that, remove flank attacks, and suddenly the game would be playable again.
 
I never actually tried, but i am very sure just using FEATURE_ instead of TERRAIN_ will do no good: there are two different methods: setTerrainType() and setFeatureType() Since global warming seems to call the TerrainType, it will cause some kind of mess-up to pass a feature instead.

Making the Global warming Terrain change depending on the plot it hits for sure requires SDK changes. Maybe it can be done via Python. I think the Global Warming method is not exposed to Python by default however...

"40 Civs mod" sounds like a SDK job anyway - increasig the number of civs on a map requires a customized dll.
 
^^Really? I read the thread and didn't saw any reference.... and it was a XML or a Python op?

It is an optional feature in the mod. In the read me included with the mod it expains how to activate it

Spoiler :
I've added a new alternative form of global warming in this release. Instead of turning random tiles to desert, it will drop fallout on the random tiles. As with my governed colony option, this is off be default (instead using the normal desert technique). To activate this new form of global warming open your GlobalDefines.xml file in a text editor. Find the GLOBAL_WARMING_PROB value and add 100 to the value. Any value over 100 will use my new method and be treated as that value less 100.
Ex:
A value of 20 will turn tiles to desert with a probability of 20% (The default shipping method)
A value of 120 will drop fallout on tiles with a probability of 20%

I prefer this method of global warming because you can stave off the effects with enough workers scrubbing.
 
Back to the original question...

In GlobalDefines.xml if one changes:

<DefineName>GLOBAL_WARMING_TERRAIN</DefineName>
<DefineTextVal>TERRAIN_DESERT</DefineTextVal>

to:

<DefineName>GLOBAL_WARMING_TERRAIN</DefineName>
<DefineTextVal>FEATURE_FALLOUT</DefineTextVal>

will that give one fallout instead of desert when Global warming occurs?

I know it has been done in Lt.Bob's 40 Civs mods, but HOW was it done? Was it done with a simple XML change as above, or was it done with Python or something else? Anybody know a quick answer without having to reverse-engineer Lt.Bob's mod?
 
SDK -> CvGame.cpp -> doGlobalWarming()
 
In GlobalDefines.xml if I change:

<DefineName>GLOBAL_WARMING_TERRAIN</DefineName>
<DefineTextVal>TERRAIN_DESERT</DefineTextVal>

to:

<DefineName>GLOBAL_WARMING_TERRAIN</DefineName>
<DefineTextVal>FEATURE_FALLOUT</DefineTextVal>

will that give me fallout instead of desert when Global warming happen or something else must be edit?

Yes in thoery
 
I tried it and it didn't work :(

I also tried changing it to other terrain types and that didn't work either, so maybe I just screwed it up, but I don't think so. I'm quite sure it doesn't work. So we are stuck with crappy desert everywhere, poo :(
 
I tried it and it didn't work :(

I also tried changing it to other terrain types and that didn't work either, so maybe I just screwed it up, but I don't think so. I'm quite sure it doesn't work. So we are stuck with crappy desert everywhere, poo :(


I think that some of the older versions of Lt.Bob's script had source code in it. You could always open it up and reverse engineer it so that you can do the fallout thing without the 40 civs script.
 
I tried it and it didn't work :(

Shame, but given the difference between TERRAIN_ and FEATURE_ types, not hugely surprising.

I also tried changing it to other terrain types and that didn't work either, so maybe I just screwed it up, but I don't think so. I'm quite sure it doesn't work. So we are stuck with crappy desert everywhere, poo :(

Not true. It does work - you can make global warming turn tiles to any terrain type. I hate to plug but check in my sig for an example of global warming turning land into sea.
 
Not true. It does work - you can make global warming turn tiles to any terrain type. I hate to plug but check in my sig for an example of global warming turning land into sea.
How about "Global Warming" turning tiles into TUNDRA! (Nuclear Winter!)
 
How about "Global Warming" turning tiles into TUNDRA! (Nuclear Winter!)

Yeah I have been using that this current game, but I doubt the game will go on for long enough to see it in action.

Back to the original question though, if you look in the file "CvGame.cpp" and find the function "doGlobalWarming()" you can better understand exactly how this strange game feature works:

Spoiler :
void CvGame::doGlobalWarming()
{
CvCity* pCity;
CvPlot* pPlot;
CvWString szBuffer;
TerrainTypes eWarmingTerrain;
bool bChanged;
int iI;

eWarmingTerrain = ((TerrainTypes)(GC.getDefineINT("GLOBAL_WARMING_TERRAIN")));

for (iI = 0; iI < getNukesExploded(); iI++)
{
if (getSorenRandNum(100, "Global Warming") < GC.getDefineINT("GLOBAL_WARMING_PROB"))
{
pPlot = GC.getMapINLINE().syncRandPlot(RANDPLOT_LAND | RANDPLOT_NOT_CITY);

if (pPlot != NULL)
{
bChanged = false;

if (pPlot->getTerrainType() != eWarmingTerrain)
{
if (pPlot->calculateTotalBestNatureYield(NO_TEAM) > 1)
{
pPlot->setTerrainType(eWarmingTerrain);
bChanged = true;
}
}

if (pPlot->getFeatureType() != NO_FEATURE)
{
if (pPlot->getFeatureType() != GC.getDefineINT("NUKE_FEATURE"))
{
pPlot->setFeatureType(NO_FEATURE);
bChanged = true;
}
}

if (bChanged)
{
pPlot->setImprovementType(NO_IMPROVEMENT);

pCity = GC.getMapINLINE().findCity(pPlot->getX_INLINE(), pPlot->getY_INLINE());
if (pCity != NULL)
{
if (pPlot->isVisible(pCity->getTeam(), false))
{
szBuffer = gDLL->getText("TXT_KEY_MISC_GLOBAL_WARMING_NEAR_CITY", pCity->getNameKey());
gDLL->getInterfaceIFace()->addMessage(pCity->getOwnerINLINE(), false, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_GLOBALWARMING", MESSAGE_TYPE_INFO, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pPlot->getX_INLINE(), pPlot->getY_INLINE(), true, true);
}
}
}
}
}
}
}


The important bits for global warming changing tiles to have fallout are:

1. if (pPlot->getTerrainType() != eWarmingTerrain)
{
if (pPlot->calculateTotalBestNatureYield(NO_TEAM) > 1)
{
pPlot->setTerrainType(eWarmingTerrain);
bChanged = true;
}
}


which changes a tile to the TERRAIN_ type specified if it isn't of that kind already, and:

2. if (pPlot->getFeatureType() != NO_FEATURE)
{
if (pPlot->getFeatureType() != GC.getDefineINT("NUKE_FEATURE"))
{
pPlot->setFeatureType(NO_FEATURE);
bChanged = true;
}
}


which says that a tile should be given the 'feature' of NO_FEATURE unless the feature is already that defined by NUKE_FEATURE (in GlobalDefines.xml) which in the unmodified case is fallout. Simply: remove a tile's feature unless it already has fallout.

To get the desired effect, you would need to remove part 1, because you don't want the terrain type to change, and in part 2 modify the bold line to say pPlot->setFeatureType(GC.getDefineINT("NUKE_FEATURE"));
 
Top Bottom