I'm not the greatest python modder, but i can do a bit, and i have some ideas, so i decided to open just one thread for my code parts.
Special thanks to tsentom1, which modcomps are great, and taught me the basics with tsentoms help, and to EmperorFool, who helps to solve the biggest problems.
--------------------------------------------------
Unit experience through specialists and civics
This modcomp was requested by "Some guy".
Might be unbalanced, but the mechanics can easy be changed.
All changes are labeled with "SpecialistXP".
The example is with only vassalage as civic. The produced unit has 8 XP (2 through vassalage, 3*2 through the scientists in vasallage.
-----------------------------------------------------------------
Worldwonder "Monsanto"
It grants you 5 units "Geneticist", who can "plant" the new resource "genetically modified corn", which gives the plot +3/0/2, and 1
and 1
.
The mechanics are near the same like the pioneer tank below.
All changes are labeled with "Monsanto".
It might be a bit more difficult to understand, but if you have problems, just ask.
No custom art (no need for more files in this small modcomp), and no civilopedia entry (i have writing texts, i'm sorry).
.
I've re-uploaded the Monsanto-wonder, i've fixed the problem with it.
Problem:
Solution:
------------------------------------------------------------------
Respawn-Promotion
Requested by cfkane for his Fictionalization IV mod.
Credits: The python is totally based on tsentom1's Survival Promotion. Tsentom has also helped me.
The buttons are from FK2006 (this buttonpack).
What it does:
I've added 2 new promotions, respawn1+2.
Every promotion gives the unit +1 life.
If the unit dies, the higher respawn-promotion is lost, and the unit is in the capital reborn.
A unit with respawn2 can die, is reborn, loses respawn2, but still has respawn1. If the unit then again dies, it will lose respawn1, but is still reborn. After that, the unit is a normal unit, but can also again get the respawn-promotions.
For modders:
I've added #### Respawn Start ## and ## Respawn End ## in the CvEventManager.py, so you can easy find it.
If yo have any questions, ask me or tsentom1.
(tsentom, i hope, you don't mind it, that i say that)
And give me and tsentom credit, when you use it.
Re-uploaded September, 5th, 6:02 PM forum time.
- Cleaned up the code
- Will now place ships in coastal cities
- Added AI, so that the promotion will be applied to AI-controlled units.
Re-Uploaded September, 8th, 7:40 PM forum time.
- Replaced the button with the new one by Arian (here).
Edit: Re-uploaded on September, 23th, 5:42 PM forum time.
- Fixed a bug, which could lead to an invalid promoting order for the AI. Credits for finding this bug go to EmperorFool
------------------------------------------------------
Pioneertank
It can create hills and also build forts
.
3D-modell: Credits to Rabbit, White for his excellent Chimera-Tank.
Python-Code: Credtis to Tsentom1, i took the basics from his Eden Project.
Can be used as it comes as a stand-alone-mod.
Edit: V2 is up, with the changes, tsentom suggested. The AI will maybe know, how to use it.
If you can report some observations of intelligenct ai-use of the pioneer-tank, please report it.
Feel free to use it, but give me credit.
For modders:
I've added the PIONEERTANK at the end of the UnitInfos.xml and UnitClassInfos.xml., the artdefines at the end of the ArtDefines_Unit.xml.
Also added the improvement CREATE_HILL to the ImprovementInfos.xml, and BUILD_CREATE_HILL to the UnitBuildInfos.xml.
There's an entry in the CIV4ArtDefines_Improvement.xml, but it is not important, it's an dummy, you'll never see it.
Important is change of the CvEventManager.py
It just says: If there's an improvement CREATE_HILL, then change the plot to a hill, and destroy the improvement after it.
Not the most elegant way, but it works.
----------------------------------------------------------------
Planetbuster-Rocket
It'll destroy really all in it's catchement area
.
Uses the ICBM-modell.
Code is from Tsentom1 (his Eden Project), also got much help from him
.
Couldn't have done it without him
.
Also credits to EmperorFool, for his advice
.
Can be used as it comes as a stand-alone-mod.
AI will use it like an ICBM, not like a special unit.
Feel free to use it
, but give me and tsentom1 credit
.
For modders:
I've added the planetbuster-unitclass and unit at the end of the unitclassinfos.xml and unitinfos.xml
In the CvEventManager.py i've added with tsentom's help this:
Should be simple to understand. If not, ask me or tsentom
.
----------------------------------------------------
Palace replacing after conquering capital
In this small modcomp, the human player (NOT the AI) can, after conquering an enemy capital, move his palace to this city.
There are 3 changes in CvEventManager.py and 1 change in CvScreensInterface.py, all labeled with "moving palace".
This modcomp was requested by cybrxkhan for his mod World of Legends.
------------------------------------
FixedMPScoreboard
This mod fixes the issue, that you can see in a multiplayer game also the human civs, which you haven't met already.
-> When you start a MP game with this mod, the other human civs should not appear in the scoreboard.
Attention: It was only tested in hot seat.
If it works in normal MP games, then please report it.
There's only 1 change in CvMainInterface, it's labeled with "FixedMPScoreboard".
-----------------------------------------------------------------------------
Believer Trait
Image
With this trait, new cities of the leader will automatically have the state religion and the temple of the state religion.
There's only one change in CvEventManager, and it's labeled with "Believer Trait".
Edit: After re-upload there are 2 changes.
2 XML files are included, one for the text, and the CivilizationInfos.xml for an example.
It might be overpowered, but you're free to change it
.
Edit: Re-uploaded on April, 16th, 4:21 PM forum time
- The effect is now also applied on conquered cities
-------------------------------------------------------
Real Favorite Religion
In this modcomp, after a religion is founded every leader who has it as favorite religion will automatically get this religion in his capital.
There is only one change in CvEventManager.py, and it's labeled with "real favorite religion".
One XML file with the text for the popup is included.
This modcomp was requested by Caster_Troy
Attention: Makes only real sense with free religion choice .
--------------------------------------------------------
TechTree - New icons and effects
Image
Description:
In this modcomp, 4 techs get 4 new effects:
The new effects are only displayed in the tech tree, not in the civilopedia or the hover text.
This mod component has 5 files:
- CvEventManager, for applying the effect
- CvTechChooser, for displaying the icons
- CvGameUtils, for displaying the text when hovering over the icons
- A XML file for the text
- One custom button.
In the python files, search for "TechTree - new icons".
Notes:
- I do not recommend to use or to add any "first player gets" effects to the tech tree, because the AI does not understand the effect and will not try to get the tech first
- To change the effects/icons to a new tech, both CvEventManager and CvTechChooser have to be changed. Changes in one of the files will not automatically be detected.
This modcomp has been requested by Kathy.
Special thanks to tsentom1, which modcomps are great, and taught me the basics with tsentoms help, and to EmperorFool, who helps to solve the biggest problems.
--------------------------------------------------
Unit experience through specialists and civics
This modcomp was requested by "Some guy".
Might be unbalanced, but the mechanics can easy be changed.
All changes are labeled with "SpecialistXP".
Spoiler :
The example is with only vassalage as civic. The produced unit has 8 XP (2 through vassalage, 3*2 through the scientists in vasallage.
-----------------------------------------------------------------
Worldwonder "Monsanto"
It grants you 5 units "Geneticist", who can "plant" the new resource "genetically modified corn", which gives the plot +3/0/2, and 1


The mechanics are near the same like the pioneer tank below.
All changes are labeled with "Monsanto".
It might be a bit more difficult to understand, but if you have problems, just ask.
No custom art (no need for more files in this small modcomp), and no civilopedia entry (i have writing texts, i'm sorry).
Spoiler :
I've re-uploaded the Monsanto-wonder, i've fixed the problem with it.
Problem:
Spoiler :
The problem was, that the AI doesn't understand, that there can be multiple worker units.
It'll just see, that the genetic corn farm doesn't have any tech-prerequisite, and tries to build them everywhere with the normal worker. But you know, normal workers can't build the improvement. So the AI will just not build any improvements on the plots.
It'll just see, that the genetic corn farm doesn't have any tech-prerequisite, and tries to build them everywhere with the normal worker. But you know, normal workers can't build the improvement. So the AI will just not build any improvements on the plots.
Solution:
Spoiler :
I've attached the improvement to a fake technologie. The technologie GEN_CORN is not visibile in the tech treek and can't be researched. After building the wonder, you'll get the technology, but it will not be mentioned, the player will not see it. I've tried to remove the technology after the last improvement was build, but it seems, that it does not work. But shouldn't be a problem at this point of the game.
------------------------------------------------------------------
Respawn-Promotion
Requested by cfkane for his Fictionalization IV mod.
Credits: The python is totally based on tsentom1's Survival Promotion. Tsentom has also helped me.
The buttons are from FK2006 (this buttonpack).
Spoiler :
What it does:
I've added 2 new promotions, respawn1+2.
Every promotion gives the unit +1 life.
If the unit dies, the higher respawn-promotion is lost, and the unit is in the capital reborn.
A unit with respawn2 can die, is reborn, loses respawn2, but still has respawn1. If the unit then again dies, it will lose respawn1, but is still reborn. After that, the unit is a normal unit, but can also again get the respawn-promotions.
For modders:
I've added #### Respawn Start ## and ## Respawn End ## in the CvEventManager.py, so you can easy find it.
If yo have any questions, ask me or tsentom1.
(tsentom, i hope, you don't mind it, that i say that)
And give me and tsentom credit, when you use it.
Re-uploaded September, 5th, 6:02 PM forum time.
- Cleaned up the code
- Will now place ships in coastal cities
- Added AI, so that the promotion will be applied to AI-controlled units.
Re-Uploaded September, 8th, 7:40 PM forum time.
- Replaced the button with the new one by Arian (here).
Edit: Re-uploaded on September, 23th, 5:42 PM forum time.
- Fixed a bug, which could lead to an invalid promoting order for the AI. Credits for finding this bug go to EmperorFool
------------------------------------------------------
Pioneertank
It can create hills and also build forts

Spoiler :
3D-modell: Credits to Rabbit, White for his excellent Chimera-Tank.
Python-Code: Credtis to Tsentom1, i took the basics from his Eden Project.
Can be used as it comes as a stand-alone-mod.
Edit: V2 is up, with the changes, tsentom suggested. The AI will maybe know, how to use it.
If you can report some observations of intelligenct ai-use of the pioneer-tank, please report it.
Feel free to use it, but give me credit.
For modders:
Spoiler :
I've added the PIONEERTANK at the end of the UnitInfos.xml and UnitClassInfos.xml., the artdefines at the end of the ArtDefines_Unit.xml.
Also added the improvement CREATE_HILL to the ImprovementInfos.xml, and BUILD_CREATE_HILL to the UnitBuildInfos.xml.
There's an entry in the CIV4ArtDefines_Improvement.xml, but it is not important, it's an dummy, you'll never see it.
Important is change of the CvEventManager.py
Code:
def onImprovementBuilt(self, argsList):
'Improvement Built'
iImprovement, iX, iY = argsList
###PIONEERTANKBEGIN###
pPlot = CyMap().plot(iX, iY)
if iImprovement == gc.getInfoTypeForString('IMPROVEMENT_CREATE_HILL'):
pPlot.setPlotType(PlotTypes.PLOT_HILLS, True, True)
pPlot.setImprovementType(-1)
###PIONEERTANKEND###
It just says: If there's an improvement CREATE_HILL, then change the plot to a hill, and destroy the improvement after it.
Not the most elegant way, but it works.
----------------------------------------------------------------
Planetbuster-Rocket
It'll destroy really all in it's catchement area

Spoiler :
Uses the ICBM-modell.
Code is from Tsentom1 (his Eden Project), also got much help from him

Couldn't have done it without him

Also credits to EmperorFool, for his advice

Can be used as it comes as a stand-alone-mod.
AI will use it like an ICBM, not like a special unit.
Feel free to use it


For modders:
I've added the planetbuster-unitclass and unit at the end of the unitclassinfos.xml and unitinfos.xml
In the CvEventManager.py i've added with tsentom's help this:
Spoiler :
Code:
def onNukeExplosion(self, argsList):
'Nuke Explosion'
pPlot, pNukeUnit = argsList
CvUtil.pyPrint('Nuke detonated at %d, %d'
%(pPlot.getX(), pPlot.getY()))
###Planetbusterbegin###
if (pNukeUnit is not None and pNukeUnit.getUnitType() == gc.getInfoTypeForString('UNIT_PLANETBUSTER')):
iX = pPlot.getX()
iY = pPlot.getY()
for iXLoop in range(iX - 1, iX + 2, 1):
for iYLoop in range(iY - 1, iY + 2, 1):
pPlot = CyMap().plot(iXLoop, iYLoop)
if (( pPlot.isPeak()==true ) or (pPlot.isHills()==true)):
pPlot.setPlotType(PlotTypes.PLOT_LAND, True, True)
pPlot.setTerrainType(gc.getInfoTypeForString( "TERRAIN_COAST" ), 1, 1)
###Planetbusterend###
Should be simple to understand. If not, ask me or tsentom

----------------------------------------------------
Palace replacing after conquering capital
In this small modcomp, the human player (NOT the AI) can, after conquering an enemy capital, move his palace to this city.
Spoiler :

There are 3 changes in CvEventManager.py and 1 change in CvScreensInterface.py, all labeled with "moving palace".
This modcomp was requested by cybrxkhan for his mod World of Legends.
------------------------------------
FixedMPScoreboard
This mod fixes the issue, that you can see in a multiplayer game also the human civs, which you haven't met already.
-> When you start a MP game with this mod, the other human civs should not appear in the scoreboard.
Attention: It was only tested in hot seat.
If it works in normal MP games, then please report it.
There's only 1 change in CvMainInterface, it's labeled with "FixedMPScoreboard".
-----------------------------------------------------------------------------
Believer Trait
Image
With this trait, new cities of the leader will automatically have the state religion and the temple of the state religion.
There's only one change in CvEventManager, and it's labeled with "Believer Trait".
Edit: After re-upload there are 2 changes.
2 XML files are included, one for the text, and the CivilizationInfos.xml for an example.
It might be overpowered, but you're free to change it

Edit: Re-uploaded on April, 16th, 4:21 PM forum time
- The effect is now also applied on conquered cities
-------------------------------------------------------
Real Favorite Religion
Spoiler :

In this modcomp, after a religion is founded every leader who has it as favorite religion will automatically get this religion in his capital.
There is only one change in CvEventManager.py, and it's labeled with "real favorite religion".
One XML file with the text for the popup is included.
This modcomp was requested by Caster_Troy
Attention: Makes only real sense with free religion choice .
--------------------------------------------------------
TechTree - New icons and effects
Image
Description:
Spoiler :
In this modcomp, 4 techs get 4 new effects:
- Constitution: Golden age for everyone who researches it.
- Music: Golden age for the first player who researches it.
- Banking: 500*Gamespeed gold for everyone who researches it
- Fission: Free ICBM for everyone who researches it.
The new effects are only displayed in the tech tree, not in the civilopedia or the hover text.
This mod component has 5 files:
- CvEventManager, for applying the effect
- CvTechChooser, for displaying the icons
- CvGameUtils, for displaying the text when hovering over the icons
- A XML file for the text
- One custom button.
In the python files, search for "TechTree - new icons".
Notes:
- I do not recommend to use or to add any "first player gets" effects to the tech tree, because the AI does not understand the effect and will not try to get the tech first
- To change the effects/icons to a new tech, both CvEventManager and CvTechChooser have to be changed. Changes in one of the files will not automatically be detected.
This modcomp has been requested by Kathy.