Platy's Peculiar Pleasant Posh Python

Standalone is outdated and no longer supported.
But the initial era limit should be defined in the ini section.
Self.ihideera
 
Goodier Huts

Features:
Adds 6 new events to Goody Huts

1) Free Random Promotion
If no available promotion, receives morale

2) + Fledging Culture to Nearest City
If no City, receives 20 to 99 Gold

3) +1 Population to Nearest City
If no City, receives 1 Worker

4) Unit immobiled for 4 Turns, + 25% Damage

5) +100 Espionage against random team met.
If no team met, gets contact to random team.

6) +3 Moves temporarily
 
All right this is my last idea, then I'll shut up and start doing useful things like learning python.
Diseases could be made, and they'd work much the same way as artifacts, with disease promotions being given to units randomly if they are in a jungle or unhealthy city. Then if a diseased unit is adjacent to another unit the disease could spread. There could be several different diseases, which would be promotions that have negative effects.
What do you think?
 
Easy to code, tedious checks. Not recommended.

Basically, all you need to do is check location of every unit every turn and apply disease check.
Too taxing.
 
Goodier Huts - a good idea. Also, I have several times wondered if it would be possible for the first two eras to appear new goody huts on uninhabited areas
 
So, I managed to add the worldbuilder into Dune Wars. The only thing to do in relation to BUG is to make the python widgets work normally by tweaking WidgetUtils and that's it.

I noticed that we can't change the strenght of air units. Limitation or did you just forget?
 
So, I managed to add the worldbuilder into Dune Wars. The only thing to do in relation to BUG is to make the python widgets work normally by tweaking WidgetUtils and that's it.

Did you manage to get the new events at the bottom of CvEventManager to register correctly with BUGEventManager? I can't get them to work, and without them editing script data or placing landmarks doesn't work.
 
@hrochland
Basically needs a check every X turn through whole map and do some tests and add new ones.
 
Ultrapack

Adds a Full Order List Button
OrderList0000_zps11bf3e87.jpg


which leads to new screens for easy sorting of items to add to order list.
 

Attachments

  • Order List 10000.JPG
    Order List 10000.JPG
    49.1 KB · Views: 209
  • Order List 40000.JPG
    Order List 40000.JPG
    60.7 KB · Views: 186
  • htgjfjj0000.JPG
    htgjfjj0000.JPG
    90.3 KB · Views: 197
  • ssdsfg0000.JPG
    ssdsfg0000.JPG
    36.1 KB · Views: 233
  • sss10000.JPG
    sss10000.JPG
    112.3 KB · Views: 213
Adds 2 buttons to adjust Selection Icon Layers
2 to 5 layers
 

Attachments

  • Size 40000.JPG
    Size 40000.JPG
    148.2 KB · Views: 242
  • Size 30000.JPG
    Size 30000.JPG
    147.1 KB · Views: 214
  • Size 20000.JPG
    Size 20000.JPG
    146.1 KB · Views: 211
Hi platyping,

I was wondering if you have any insights into the python map scripts for Civ4 - I've been trying to improve the Planets mapscript for my 2071 mod, but am not very skilled with python and after trying on my own for quite a while I am kind of hitting a wall with several aspects of it.

In this space colonization mod, the mapscript generates several planets which are circular areas of land terrain surrounded by a "sea" of space (curently TERRAIN_OCEAN with a space graphical reskin). The basics of this are currently working ok, by using a python class DonutFractalWorld that was adapted by TC01 from the Donut mapscript in Civ4BtS. As far as I can figure out, this basically works by setting a number of planets to generate based on the mapsize, then finding a center tile for each planet while checking to ensure its radius won't overlap with another one. Then it sets plottypes for all tiles inside the planet's radius to Land, Hills, or Peak using a fractal function that I don't quite understand.

This aspect is currently already working fairly well, but the Terrains of all the planets it generates are essentially the same. In Civ4Colonization there can be many more types of tile Yields than just the Food/Hammers/Commerce in Civ4BtS (the 2.0 update for this mod has over 20 Yields that can be produced from different Terrain types, such as Nutrients, Isotopes, Nucleic Acids, etc), so it's important to be able to generate more Terrain diversity between planets. I've worked on collecting a lot of different Terrains to be variants of the standard terrains (see the downloadable 200 Terrains Pack in my sig) and modded these as in XML, but need to get the mapscript to generate different terrains for each planet.

It currently generates the 5 standard terrains everywhere (TERRAIN_TUNDRA,TERRAIN_MARSH,TERRAIN_GRASS,TERRAIN_PLAINS,TERRAIN_DESERT) using class TerrainGenerator in CvMapGeneratorUtil.py . Ideally, I'd like to enhance it so that when generating each planet, it randomly chooses a climate type for that planet (Temperate, Aquatic, Arid, Volcanic, or Arctic), and then pick terrains for that planet based on that climate. Eg for an Aquatic planet, replacing the standard TERRAIN_TUNDRA,TERRAIN_MARSH,TERRAIN_GRASS,TERRAIN_PLAINS,TERRAIN_DESERT the terrains would be:

TUNDRA_WET Glacial
MARSH_WET Wetlands
GRASS_WET Loam
PLAINS_WET Silt Beds
DESERT_WET Diatomaceous

and so on.

I'm hoping it should be feasible to do this; however inside the loop in Planets.py DonutFractalWorld that generates each planet it currently only sets the plot type (Land, Hills, or Peak), and the Terrains themselves are generated afterward by TerrainGenerator in CvMapGeneratorUtil.py . I've managed to deactivate the dependence on Latitude variables in those functions so it no longer puts Ice/Tundra at the top of the map, etc; but after trying for quite a while I can't figure out how to generate different terrains for each planet. I like that the fractal functions and classes in the standard mapscripts do a good job of generating natural-seeming patches of different terrains, but don't really understand how these fractals work (and being fairly new to this am getting kind of lost with all this object-oriented python). :crazyeye:

Anyway, sorry for the long post and rather complicated issues, but as resident python wizard I'd be really grateful if you (or any other skilled python modders reading this) could take a look at the mapscript and see if you might have any solutions. Also you're more than welcome to acess the updated work-in-progress at https://github.com/Nightinggale/Medieval_Tech/tree/colonization2071 or look at the non-updated playable version here.
 

Attachments

Code:
	def initFractals(self):
		self.deserts.fracInit(self.iWidth, self.iHeight, self.grain_amount, self.mapRand, self.iFlags, self.fracXExp, self.fracYExp)
		self.iDesertTop = self.deserts.getHeightFromPercent(self.iDesertTopPercent)
		self.iDesertBottom = self.deserts.getHeightFromPercent(self.iDesertBottomPercent)

		self.plains.fracInit(self.iWidth, self.iHeight, self.grain_amount+1, self.mapRand, self.iFlags, self.fracXExp, self.fracYExp)
		self.iPlainsTop = self.plains.getHeightFromPercent(self.iPlainsTopPercent)
		self.iPlainsBottom = self.plains.getHeightFromPercent(self.iPlainsBottomPercent)

		self.marsh.fracInit(self.iWidth, self.iHeight, self.grain_amount, self.mapRand, self.iFlags, self.fracXExp, self.fracYExp)
		self.iMarshTop = self.marsh.getHeightFromPercent(self.iMarshTopPercent)
		self.iMarshBottom = self.marsh.getHeightFromPercent(self.iMarshBottomPercent)
		
		self.tundra.fracInit(self.iWidth, self.iHeight, self.grain_amount, self.mapRand, self.iFlags, self.fracXExp, self.fracYExp)
		self.iTundraTop = self.tundra.getHeightFromPercent(self.iMarshTopPercent)
		self.iTundraBottom = self.tundra.getHeightFromPercent(self.iMarshBottomPercent)

		self.variation.fracInit(self.iWidth, self.iHeight, self.grain_amount, self.mapRand, self.iFlags, self.fracXExp, self.fracYExp)

		iType = CyGame().getSorenRandNum(100, "Choose Planet Type")
		if iType < 20:
			self.terrainDesert = self.gc.getInfoTypeForString("TERRAIN_DESERT")
			self.terrainPlains = self.gc.getInfoTypeForString("TERRAIN_PLAINS")
			self.terrainIce = self.gc.getInfoTypeForString("TERRAIN_SNOW")
			self.terrainTundra = self.gc.getInfoTypeForString("TERRAIN_TUNDRA")
			self.terrainGrass = self.gc.getInfoTypeForString("TERRAIN_GRASS")
			self.terrainMarsh = self.gc.getInfoTypeForString("TERRAIN_MARSH")
		else:
			self.terrainDesert = self.gc.getInfoTypeForString("TERRAIN_DESERT_WET")
			self.terrainPlains = self.gc.getInfoTypeForString("TERRAIN_PLAINS_WET")
			self.terrainIce = self.gc.getInfoTypeForString("TERRAIN_SNOW_WET")
			self.terrainTundra = self.gc.getInfoTypeForString("TERRAIN_TUNDRA_WET")
			self.terrainGrass = self.gc.getInfoTypeForString("TERRAIN_GRASS_WET")
			self.terrainMarsh = self.gc.getInfoTypeForString("TERRAIN_MARSH_WET")

If all you want is every planet still have the 5 terrain types, just that they are in different sets, then thats all.

Currently 20% of the time it will use default terrain, 80% the wet style, so adjust as you like.
 
Ok, thanks for your help platy! :king:

I tried what you suggested placing that code in def initFractals(self) in Planets.py , but it crashes during map generation (the python exception before crashing is "no starting plot for player").

I think the terrain types need to be declared inside the loop in Planets.py where it iterates through each planet; but it only sets the plottypes there. It looks like the terrain types are set separately by TerrainGenerator in CvMapGeneratorUtil.py, but I'm not sure how to let this access what planet type was created during the loop in Planets.py. :confused:

I've also tried it an alternate way where I instead add your terrain definitions (the code chunk from iType = CyGame().getSorenRandNum(100, "Choose Planet Type") and below) inside the loop in Planets.py that generates planets, but this is also giving the same crash.
 
Edit:
Nvm, I know why :D
Will do some experiments when home
 
Can someone help me put this in custom assets. I want to use the WB in this mod to edit saves and share those saves with other players, so they can play the game as they are comfortable with whatever is in their custom assets folder.

Taking the stuff out of the assets folder in this mod and adding it to custom assets folder gives a game with no interface during the game. I started with an empty custom assets folder. Am I missing a step somewhere?

Thanks in advance.
 
@Orlanth

I cannot run your script without instant defeat, so I did my experiements in one default Civ IV Map.

Attached is an edited Hemisphere which will still spawn 2 to 6 continents.
Each continent will be either snow + tundra, or desert + plains.
So you can pretty much replace the terrains with your own sets.

What is interesting is that starting plots are not affected.
 

Attachments

Since I cannot run your script, you can run and see if it works.
 

Attachments

Hi. I have an idea that emerged from the game. There is a button which when pressed will show all the sources. It would be very helpful button which, if pressed, showed all the natural wonders. Is such a thing possible? Could you do it, please?
 
Hey platyping, is there a function that activates on an air strike, something like def onairstrike? Or, alternatively, is there a way to make a function that does so? I want to add to the effects of an air strike.

Thanks
 
Back
Top Bottom