Blizzards (Age of Ice Style)

TC01

Deity
Joined
Jun 28, 2009
Messages
2,216
Location
Irregularly Online
Blizzards Modcomp v1.21
For Fall from Heaven 2 0.41o

This python-only modcomp adds Age of Ice style blizzards to Fall from Heaven 2. If you haven't played AoI, Blizzards were able to move around and spread snow terrain in that scenario. FFH 2 lacks this feature. However, for my Frozen new civ mod I wanted to add a method of "automatically spreading" snow terrain- and thought of blizzards. So, I'm releasing this modcomp with only the Blizzard code in it. It is included in the Frozen civ mod, however this modcomp is for regular, otherwise unmodded FFH.

Blizzards is done entirely in python, thus making merging it with another mod very easy (especially since all of my new code, save a few lines in the event manager and spell interface files, is in a new python file, Blizzards.py). There are instructions for using it with another mod, like Fall Further or Orbis, below under the Install Instructions, and are also included in a file in the download.

What Blizzards Do:
  • Allowed blizzards to move around the map (they are blocked by features)
  • Allowed blizzards to be randomly spawned on snow plots in Illian terrain after the Deepening is completed
  • Blizzards randomly spread both temporary and permanent snow terrain
  • Blizzards sometimes create Ice features on water they move by
  • Blizzards will randomly be destroyed (naturally)
  • The Call Blizzard ability applies the code ran by the blizzard to set ice terrain
  • The Scorch spell destroys water ice within a 1-plot radius of the caster
  • Blizzards cannot be created on water or in cities, nor move onto water
Links:
Download Here
Blizzards for Fall Further

Changelog:

Code:
v1.21 Changelog:
-Compatible with FFH 0.41o

v1.2 Changelog:
-Compatible with FFH 0.41m
-Scorch now destroys water ice
-Blizzards will not spawn until someone completes the Deepening
-Movement, permanent snow, and permanent ice chances decreased
-Blizzard death chances increased
-Blizzards not in Illian lands have extra chance to die
-Blocked blizzards from being created in cities and moving onto water
-Before creating a blizzard, the game will check if too many other blizzards are nearby

v1.1 Changelog:
-Compatible with FFH 0.41j
-Blizzards now have a 50/50 chance of turning water into ice
-Streamlined check if a blizzard could be created on plot

To Install:

1. Unzip the files into a temporary directory.

2. Copy the Python folder into your Beyond the Sword\Mods\Fall from Heaven 2\Assets folder. You may wish to back up your existing files or create a new "FFH Blizzards" folder in Beyond the Sword\Mods that is a copy of the Fall from Heaven 2 folder, and copy the Python folder from the zip into there. Either method will work.

3. To test, start a game as the Illians and make all plots around you Snow terrain via Worldbuilder. Blizzards should start spawning on them if you have installed the mod correctly.

To install this with another modmod, you can either use the Merging Guide included in the mod or the instructions below.

Spoiler Merging Guide :
1. Copy the Blizzards.py file from the modcomp into [FFH_MOD]\Assets\Python, where [FFH_MOD] is the mod you are trying to merge this with. (For instance,
Fall Further 051\Assets\Python).

2. Open CvEventManager.py, located in Assets\Python, using a text editor such as Notepad++ (but Notepad works as well).

3. At the top of the file, between the import statements (for instance, import OOSLogger, import Util, etc.) and a line saying # Globals, add this line:

Code:
import Blizzards

4. Below where it says # Globals, add the following line of code:

Code:
Blizzards = Blizzards.Blizzards()

5. In the onBeginGameTurn function, add the following line of code at the end of the function.

Code:
		Blizzards.doBlizzardTurn()

6. Close CvEventManager.py and open the file CvSpellInterface.py, located in Assets\Python\Entrypoints.

7. At the top of the file, below the import statements, add the following line:

Code:
import Blizzards

8. Below the globals, add the following line of code:

Code:
Blizzards = Blizzards.Blizzards()

9. Overwrite the spellCallBlizzard function with this code:

Code:
def spellCallBlizzard(caster):
	iBlizzard = gc.getInfoTypeForString('FEATURE_BLIZZARD')
	iTundra = gc.getInfoTypeForString('TERRAIN_TUNDRA')
	iX = caster.getX()
	iY = caster.getY()
	pBlizPlot = -1
	for iiX in range(iX-1, iX+2, 1):
		for iiY in range(iY-1, iY+2, 1):
			pPlot = CyMap().plot(iiX,iiY)
			if pPlot.getFeatureType() == iBlizzard:
				pBlizPlot = pPlot
	if pBlizPlot != -1:
		pBlizPlot.setFeatureType(-1, -1)
	pPlot = caster.plot()
	pPlot.setFeatureType(iBlizzard, 0)
	Blizzards.doBlizzard(pPlot)

10. Add this code to the end of the spellScorch function:

Code:
	for iiX in range(pPlot.getX()-1, pPlot.getX()+2):
		for iiY in range(pPlot.getY()-1, pPlot.getY()+2):
			pIce = CyMap().plot(iiX, iiY)
			if pIce.getFeatureType() == gc.getInfoTypeForString('FEATURE_ICE'):
				pIce.setFeatureType(-1, -1)

10. Close CvSpellInterface.py and test it out as described in the install directions.


Credits:
-TC01
-MagisterCultuum, Cypher, xienwolf (help)

-Fall from Heaven 2 Mod Team (for making FFH 2)
-Firaxis (for making Civ IV)

Screenshots:

On the download page, there are three screenshots, of Turn 0, Turn 5, and Turn 10, to show the effect of a blizzard. I have worldbuildered a blizzard on Turn 0 on the coast by some plains. By Turn 5, the Blizzard has spread snow and ice in a small region around the plot where I Worldbuildered it. By Turn 10, you can see that the blizzard has faded, and one of the plots has reverted back to normal terrain (as it must have been a temporary change).
 
Doesn't Fall Further already have a tempFeature function? I know some mod does... But yeah, the only reason I made ice applied permanently was because I didn't have a tempFeature function.
 
[to_xp]Gekko;8497165 said:
blizzards as they were meant to be? yes, thanx :D

You're welcome. :)

I don't think FF does, mostly because I've seen Magister ask for one repeatedly. ;)

It seems that it does, though, this is from CyPlot.cpp of the Fall Further SDK:

Code:
void CyPlot::setTempFeatureType(int eFeature, int iVariety, int iTimer)
{
	if (m_pPlot)
		m_pPlot->setTempFeatureType((FeatureTypes)eFeature, iVariety, iTimer);
}

So it exists and has been exposed to python.
 
I asked for one for a long time, and eventually it was added. I'm not sure when exactly, as no one told me and I'd been editing one version of FF for weeks before noticing that it was used in the code for FF's version of End of Winter.

FF's version differs from the one I wrote only in that the feature variety (like deciduous vs coniferous vs snow coniferous forests) is the second parameter and duration third instead of the other way around. I guess Xinewolf based his on the setTerrain function, whereas I based mine on TempTerrain and so in my first attempt forgot about varieties completely and had to go back and add them.

FF also has a TempBonus function.

Unlike my version, it does not have a tempImprovment function. Actually, glancing though the SDK it seems like Xinewolf started to write one, but stopped before he got to the point where he would expose it to python. I thought I remembered a tempImprovement function being used for Bedouin Sits, but that may have been in Orbis instead of FF.
 
Neat, I agree with Valk that I would rather see the ice features in the water be temp instead of permanent (or a way added to melt sea ice)
 
Actually, with tempBonus available in Fall Further I can also make certain bonuses be destroyed as well. For instance, food resources could be temporarily destroyed until the blizzard passes. I was going to implement that in this version, but since the resources would be destroyed forever I chose not to. Those are good reasons to release a FF specific version, now, rather then to just make the ice temporary.

So... except a Fall Further specific version some time in the future.
 
Very cool! I played an Illians game recently and managed to find and harness a blizzard that I dragged around with my main army stack. It was a lot of fun and I look forward to having a lot more opportunities to play with blizzards (or curse them repeatedly if I happen to be neighbors with the snowy bastards)!
 
I've released a Fall Further version of Blizzards. You can see that forum thread (linked from here) to see what it changes.
 
This modcomp is now compatible with patch J of FFH, as of v1.1, which is now released.

v1.1 also does a few minor things: since there is no tempFeatureType function, I made blizzards have a 50/50 chance of turning water they pass by into ice. This can be balanced further, both by modders and in a future version. And I've messed around with the Blizzards code, making it easier for someone to add additional restrictions (or loosen them) for the movement/creation of blizzards.
 
I've released v1.2, which adds many balance changes that I've been implementing in various versions of the Frozen but not in this modcomp. So there's nothing new here, just compatibility with patch M and the following balance changes:

-Scorch now destroys water ice
-Blizzards will not spawn until someone completes the Deepening
-Movement, permanent snow, and permanent ice chances decreased
-Blizzard death chances increased
-Blizzards not in Illian lands have extra chance to die
-Blocked blizzards from being created in cities and moving onto water
-Before creating a blizzard, the game will check if too many other blizzards are nearby
 
I've released v1.2, which adds many balance changes that I've been implementing in various versions of the Frozen but not in this modcomp.
...
-Blizzards will not spawn until someone completes the Deepening
-Movement, permanent snow, and permanent ice chances decreased
-Blizzard death chances increased
Nice! :goodjob: I was very much overwhelmed by Blizzard-spawn, especially when I started at near-pole area. Statis indeed :lol:

Permission to steal it (again) for my personal pleasure (read : modmodmod :mischief:)?

-Blocked blizzards from being created in cities and moving onto water

Wouldn't this means that Blizzard never move/be in water? Thus never turn water into ice?

So. what is this new Scorch for? :confused: To destroy regular, map=created ice in water? A little too powerful, IMHO.

-Scorch now destroys water ice


Thanks!
 
Permission to steal it (again) for my personal pleasure (read : modmodmod :mischief:)?


Wouldn't this means that Blizzard never move/be in water? Thus never turn water into ice?

Feel free to take it for your modmod(mod).

No, Blizzards affect all tiles within a 1-plot radius. So a Blizzard on the coast will make some water ice immediately on the coast. (Not all, because there's only a chance that water ice is actually created).
 
Top Bottom