Python Help-how to make terrain features cause damage

Joined
Jul 21, 2003
Messages
7,819
Location
Adelaide, South Australia
Hi guys, Was wondering if you could help me out (I'm looking at YOU Kael or Great Apple ;) ). What I want is a system where units have a random chance of sustaining damage if they spend too long in certain types of terrain (desert, jungle and tundra). I also want to make it so that this chance is even higher IF the terrain lies outside of the player's cultural border.
So, the first question is: Can it even be done? Second, if yes, then what part of the API am I looking to change? Thanks in advance :).

Yours,
Aussie_Lurker.
 
Aussie_Lurker said:
Hi guys, Was wondering if you could help me out (I'm looking at YOU Kael or Great Apple ;) ). What I want is a system where units have a random chance of sustaining damage if they spend too long in certain types of terrain (desert, jungle and tundra). I also want to make it so that this chance is even higher IF the terrain lies outside of the player's cultural border.
So, the first question is: Can it even be done? Second, if yes, then what part of the API am I looking to change? Thanks in advance :).

Yours,
Aussie_Lurker.

Yeah, you want to put your check in the onUnitMove event. So each time a unit moves it checks the terrain of the new plot and if it matches it performs whatever function you want.
 
It can be done.

The sort of thing I would suggest is a bit more complicated than Kael's suggestion. Instead of using the onUnitMove event I'd set it up to check all the units at the start of every turn to see what terrain they are in. If they are in "dangerous" terrain you could attach a piece of data to the unit, which could increase the longer they stayed in the terrain (if that's what you wanted). Then you could do the check, and do the damage if it was passed.

Storing and retrieving data IMO is best done with the SD-Toolkit which should be able to let you store data based on the unit's unique ID for retrieval later.

Unfortunetly the AI would not be able to work this out, and wouldn't avoid dangerous terrain any more than normal.
 
The Great Apple said:
Unfortunetly the AI would not be able to work this out, and wouldn't avoid dangerous terrain any more than normal.

Ahhhh... excellent point.
 
Back
Top Bottom