Desert Hardship mod

What usually happens if they hold still is that you'll see one of the guys disappear and then reappear at the start of the turn. It's easy to miss.
If you want the damage to still be significant when standing still, increase the numbers in lines 9-12 of Hardship.py. This will make the desert much nastier, though (which may be what you want). I think the standard healing rate is 10% per turn, though I could be wrong.
 
There are a couple of things I am unsure about. I download 1.3 from the thread, but it unzips as 1.2. THe readme says that I just need to add hardship.turn () to an area, but the included event manager has hardship.newturn (). There is also another code of line that is different and seems that it needs to be added. I've included the code that I am using in my merged python CvEventmanager file. Maybe someone can tell what is going wrong if the python is the problem.

Code:
from CvPythonExtensions import *
import CvUtil
import CvScreensInterface
import CvDebugTools
import CvWBPopups
import PyHelpers
import Popup as PyPopup
import CvCameraControls
import CvTopCivs
import sys
import CvWorldBuilderScreen
import CvAdvisorUtils
import CvTechChooser
import MineWarfare
import Hardship

Code:
def onBeginGameTurn(self, argsList):
		'Called at the beginning of the end of each turn'
		iGameTurn = argsList[0]
		CvTopCivs.CvTopCivs().turnChecker(iGameTurn)
######Hardship mod###################
		Hardship.newTurn()

	def onEndGameTurn(self, argsList):
		'Called at the end of the end of each turn'
		iGameTurn = argsList[0]

Then there is also this added on line 584:

Code:
             CvAdvisorUtils.unitBuiltFeats(city, unit)
             Hardship.NewUnit(argsList)
 
Hello! This little modcomp looks really nice. I might add it to WoL, depending on how much more I want to make changes to terrain in the game.

A sort of stupid question - if a unit remains in the desert for too long, and it health reduces to 0, will it die? According to your description the unit will gain a new promotion if it stays in the desert tile for 20 turns, but let's say for instance on turn 19 I move the unit from desert to a grasslands, and then the turn after that I move it back onto the desert and keep it there until its health reduces to 0 without letting it have time to heal.
 
stolenrays: I just forgot to update the file names to 1.3 in the zip... my bad. Ditto with the readme--you want Hardship.newTurn(). The line
Code:
CvAdvisorUtils.unitBuiltFeats(city, unit)
was not added by me, but presumably is supposed to be there--it was in CvEventManager before I modded it. If the CvEventManager you're working from doesn't have it... not sure what that means. I see what makes you think I added it, though--the spacing in the file makes it look like those two lines go together.

cybrxkhan: Yes, the unit should die on the 20th turn if it stays in the desert or goes in and out of desert 20 times without a chance to heal. The action all takes place at the beginning of the turn: it checks whether the unit is on a desert plot, and if it is, it checks whether it has the promotion. If not, the unit takes damage. The promotion is given to units that have been in the desert long enough to kill them (taken damage 20 times), but got a chance to heal before that happened. The idea isn't to make it impossible to cross the desert with a fresh, healthy unit--just to make those units not so healthy when they get out, and to make it dangerous for a damaged unit to go through at all. It's a rare desert that takes 20 turns to cross.
 
Thanks for the info. I realized about the version type after thinking about the posts. Hope it works.

Yeah, I included
Code:
CvAdvisorUtils.unitBuiltFeats(city, unit)
to easily find the code line if you were looking in the python file. I believe as well that it is supposed to be there.
 
Clearly I need to update the readme... as it reads now, it is nigh-useless.
 
All right, the latest (and probably final, unless there are bugs or really cool new suggestions) version is here.

Nothing's changed from the old attachment except the readme and the folder names, since stolenrays pointed out that those were not up to date (thanks!).
 
All right, the latest (and probably final, unless there are bugs or really cool new suggestions) version is here.

Nothing's changed from the old attachment except the readme and the folder names, since stolenrays pointed out that those were not up to date (thanks!).

I finally got it to work. I had python exception errors to fix from another mod component. It is a fully functional good mod as is, but you could add:

1. help text for the promotion defining its function and when given.
2. text defining the damage terrain gives when rolling over it with a curson on the map.--This may be difficult and may require sdk editing.
 
Very nice extra, thank you!
I noticed that the Barbarians are not affected by hardship. Could it be changed?
 
Thank you Xooll for the fix, now Barbarians don't come out from the desert as if they have supernatural abilities!

I had some strange promotions for units newly built so I looked at your file Hardship.py (I know nothing of Python) and the code says:
xrange = range(x-1, x+1)
yrange = range(y-1, x+1) Shouldn't it be y+1?

Also I noticed that in your popup messages, it's always about Desert Survivalist promotion, not the other ones.

It might help also if the ReadMe.txt could be corrected about the "onUnitBuild" function which is in fact the "onUnitBuilt" function (I could not find it straight away).

Now for a real challenge: the AI doesn't really know that those terrains and features are dangerous so it keep sending them in there and Units are glued to some places trying to heal (I might have increased the damages...). I guess there is no easy fix for that unless the dll is modified or not?

Anyway, thanks a lot again because I really appreciate your Hardship mod.
 
AI modification is always a doozy. And yes, it's DLL-based.

Nice modcomp, btw.
 
Thank you Xooll for the fix, now Barbarians don't come out from the desert as if they have supernatural abilities!

I had some strange promotions for units newly built so I looked at your file Hardship.py (I know nothing of Python) and the code says:
xrange = range(x-1, x+1)
yrange = range(y-1, x+1) Shouldn't it be y+1?

Also I noticed that in your popup messages, it's always about Desert Survivalist promotion, not the other ones.

It might help also if the ReadMe.txt could be corrected about the "onUnitBuild" function which is in fact the "onUnitBuilt" function (I could not find it straight away).

Now for a real challenge: the AI doesn't really know that those terrains and features are dangerous so it keep sending them in there and Units are glued to some places trying to heal (I might have increased the damages...). I guess there is no easy fix for that unless the dll is modified or not?

Anyway, thanks a lot again because I really appreciate your Hardship mod.

oops...That's what I get for using copy+paste. Thanks for the bug reports.;)
 
I'm terrible at Python, so I'll need to ask: is there a way to make it so that units do not take any damage if the plot has a road/railroad or is within the civilisation's own cultural borders?
 
That should be simple enough. Just change line 31 of Hardship.py to:
Code:
			if iterr == 2 and cyPlot.isFreshWater()==0 and cyUnit.isHasPromotion(i_des)==0 [B]and cyPlot.isRoute() == 0 and cyPlot.getOwner != pyPlayer.CyGet()[/B]:
And add the bolded stuff to lines 49, 66, and 86 as well.
 
You mean the cactus silhouette? Sure--attached. The reason I didn't stick with those graphics is that I couldn't think of anything equally iconic for arctic and jungle survivalists.
 

Attachments

  • desert_survivalist.zip
    3 KB · Views: 62
Top Bottom