kiwitt
Road to War Modder
I have found a partisans mod, But I am having a bit of a mind blank about how to import it. I will also need to modify the code as well to relate to my my own mod, but that is another task.
Start of Partisan.py
Start of CvEventManager.py
What do I put in this file to reference and import the partisan functions.
I also note it has PythonCallbackDefines.xml
Where do I place this file ?
Start of Partisan.py
Spoiler :
Code:
## Sid Meier's Civilization 4
## Copyright Firaxis Games 2005
##
## Partisan Mod (by GIR)
##
from CvPythonExtensions import *
# globals
gc = CyGlobalContext()
####################################################
class Partisan:
def onCityAcquired(self, argsList):
owner,playerType,city,bConquest,bTrade = argsList
###...
###... support text
###...
if bConquest:
loserPlayer = gc.getPlayer(owner)
loserPlayerTeam = loserPlayer.getTeam()
### partisans only available with rifling tech ###
if ( gc.getTeam(loserPlayerTeam).isHasTech(gc.getInfoTypeForString("TECH_RIFLING")) == true ):
### dont place partisan units if you capture your city back ###
if ( city.isOccupation()==true ):
### dont show partisan message if loserPlayer is already death ###
if ( loserPlayer.isAlive()==true ):
u_partisan = gc.getInfoTypeForString( 'UNIT_PARTISAN' )
loserTeam = gc.getTeam(owner)
loserPlayerID = loserPlayer.getID()
lPnCities = loserPlayer.getNumCities()
conqTeam = gc.getTeam(city.getOwner())
conqPlayer = gc.getPlayer(city.getOwner())
conqPlayerID = conqPlayer.getID()
iX = city.getX()
iY = city.getY()
cityName = city.getName()
traitt_protective = gc.getInfoTypeForString('TRAIT_PROTECTIVE')
ct_nationhood = gc.getInfoTypeForString('CIVIC_NATIONHOOD')
tt_noterrain = gc.getInfoTypeForString( 'NO_TERRAIN' )
tt_coast = gc.getInfoTypeForString( 'TERRAIN_COAST' )
tt_ocean = gc.getInfoTypeForString( 'TERRAIN_OCEAN' )
tt_desert = gc.getInfoTypeForString( 'TERRAIN_DESERT' )
tt_tundra = gc.getInfoTypeForString( 'TERRAIN_TUNDRA' )
tt_snow = gc.getInfoTypeForString( 'TERRAIN_SNOW' )
ft_ice = gc.getInfoTypeForString('FEATURE_ICE')
ft_forest = gc.getInfoTypeForString('FEATURE_FOREST')
ft_jungle = gc.getInfoTypeForString( 'FEATURE_JUNGLE' )
it_fort = gc.getInfoTypeForString("IMPROVEMENT_FORT")
t_rocketry = gc.getInfoTypeForString("TECH_ROCKETRY")
t_plastics = gc.getInfoTypeForString("TECH_PLASTICS")
t_assemblyline = gc.getInfoTypeForString("TECH_ASSEMBLY_LINE")
t_industrialism = gc.getInfoTypeForString("TECH_INDUSTRIALISM")
t_computers = gc.getInfoTypeForString("TECH_COMPUTERS")
t_railroad = gc.getInfoTypeForString("TECH_RAILROAD")
t_combustion = gc.getInfoTypeForString("TECH_COMBUSTION")
t_radio = gc.getInfoTypeForString("TECH_RADIO")
t_fascism = gc.getInfoTypeForString("TECH_FASCISM")
t_robotics = gc.getInfoTypeForString("TECH_ROBOTICS")
t_composites = gc.getInfoTypeForString("TECH_COMPOSITES")
t_laser = gc.getInfoTypeForString("TECH_LASER")
p_drill1 = gc.getInfoTypeForString( "PROMOTION_DRILL1" )
p_drill2 = gc.getInfoTypeForString( "PROMOTION_DRILL2" )
p_drill3 = gc.getInfoTypeForString( "PROMOTION_DRILL3" )
p_drill4 = gc.getInfoTypeForString( "PROMOTION_DRILL4" )
p_flanking1 = gc.getInfoTypeForString( 'PROMOTION_FLANKING1' )
p_flanking2 = gc.getInfoTypeForString( 'PROMOTION_FLANKING2' )
p_morale = gc.getInfoTypeForString( 'PROMOTION_MORALE' )
p_combat1 = gc.getInfoTypeForString("PROMOTION_COMBAT1")
p_combat2 = gc.getInfoTypeForString("PROMOTION_COMBAT2")
p_combat3 = gc.getInfoTypeForString("PROMOTION_COMBAT3")
p_combat4 = gc.getInfoTypeForString("PROMOTION_COMBAT4")
p_combat5 = gc.getInfoTypeForString("PROMOTION_COMBAT5")
p_combat6 = gc.getInfoTypeForString("PROMOTION_COMBAT6")
p_woodsman1 = gc.getInfoTypeForString("PROMOTION_WOODSMAN1")
p_guerilla1 = gc.getInfoTypeForString("PROMOTION_GUERILLA1")
#p_warmth1 = gc.getInfoTypeForString("PROMOTION_WARMTH1")
#p_cold1 = gc.getInfoTypeForString("PROMOTION_COLD1")
i_inner_plot = -1
l_inner_plot = [0,0,0,0,0,0,1,1,1,0,0,1,1,1,0,0,1,1,1,0,0,0,0,0,0]
lpPlots = []
promotiontech = 0
count_Partisan = 0
damage = 0
Spoiler :
Code:
## Sid Meier's Civilization 4
## Copyright Firaxis Games 2006
##
## CvEventManager
## This class is passed an argsList from CvAppInterface.onEvent
## The argsList can contain anything from mouse location to key info
## The EVENTLIST that are being notified can be found
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
# RtW Stuff
import CvRtWEventManager
rtw = CvRtWEventManager.CvRtWEventManager()
import CvRtWGlobal
rtwglobal = CvRtWGlobal.CvRtWGlobal()
from Historical import Each_turn_event
gc = CyGlobalContext()
localText = CyTranslator()
PyPlayer = PyHelpers.PyPlayer
PyInfo = PyHelpers.PyInfo
# globals
###################################################
class CvEventManager:
def __init__(self):
#################### ON EVENT MAP ######################
I also note it has PythonCallbackDefines.xml
Spoiler :
Code:
<?xml version="1.0"?>
<!-- Sid Meier's Civilization 4 -->
<!-- Copyright Firaxis Games 2005 -->
<!-- -->
<!-- Global Defines -->
<Civ4Defines xmlns="x-schema:CIV4GlobalDefinesSchema.xml">
<Define>
<DefineName>USE_CANNOT_FOUND_CITY_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_CAN_FOUND_CITIES_ON_WATER_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_IS_PLAYER_RESEARCH_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_CAN_RESEARCH_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_CANNOT_DO_CIVIC_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_CAN_DO_CIVIC_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_CANNOT_CONSTRUCT_CALLBACK</DefineName>
<iDefineIntVal>1</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_CAN_CONSTRUCT_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_CAN_DECLARE_WAR_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_CANNOT_RESEARCH_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_GET_UNIT_COST_MOD_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_GET_BUILDING_COST_MOD_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_GET_CITY_FOUND_VALUE_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_CANNOT_HANDLE_ACTION_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_CAN_BUILD_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_CANNOT_TRAIN_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_CAN_TRAIN_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_UNIT_CANNOT_MOVE_INTO_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_CANNOT_SPREAD_RELIGION_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_FINISH_TEXT_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_ON_UNIT_SET_XY_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_ON_UNIT_SELECTED_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_ON_UPDATE_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_ON_UNIT_CREATED_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_ON_UNIT_LOST_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
</Civ4Defines>