[ADD-ON] GIRs Sevomod Add-On

I've been trying to get the KGB to work right. Could someone tell me what I'm doing wrong in these files?

CvKGBEventManager.py
Spoiler :
## Sid Meier's Civilization 4
## Copyright Firaxis Games 2005

# This is a sample file in case someone wants to to use Gillmer J. Derge's CvCustomEventsManager with other mods.
# Otherwise, you can delete it.

from CvPythonExtensions import *
#import CvUtil
import CvEventManager
import sys
#import PyHelpers
import KGBSpyCreate



# globals
###################################################

gc = CyGlobalContext()
KGBSpyCreate = KGBSpyCreate.KGBSpyCreate()
#PyPlayer = PyHelpers.PyPlayer


class CvKGBEventManager(CvEventManager.CvEventManager):
def __init__(self, eventManager):
# initialize base class
# --------- KGB -------------
eventManager.addEventHandler("buildingBuilt", self.onBuildingBuilt)
eventManager.addEventHandler("unitBuilt", self.onUnitBuilt)



def onBuildingBuilt(self, argsList):
KGBSpyCreate.onBuildingBuilt(argsList)

def onUnitBuilt(self, argsList):
KGBSpyCreate.onUnitBuilt(argsList)


KGBSpyCreate.py
Spoiler :
## Sid Meier's Civilization 4
## Copyright Firaxis Games 2005
##
## KGBSpyCreate by GIR
##

from CvPythonExtensions import *
import CvUtil
import Popup as PyPopup
import PyHelpers

# globals
gc = CyGlobalContext()

##################################################################################

class KGBSpyCreate:
def onBuildingBuilt(self, argsList):
'Building Completed'
pCity, iBuildingType = argsList



#####################
### KGB (part1/2) ###
#####################
### filter ###
if iBuildingType == gc.getInfoTypeForString( 'BUILDING_KGB' ):
pPlayer = gc.getPlayer(pCity.plot().getOwner())
u_spy = gc.getInfoTypeForString( 'UNIT_SPY' )
iX = pCity.getX()
iY = pCity.getY()
### set units with promotions and names ###
pNewUnit = pPlayer.initUnit( u_spy, iX, iY, UnitAITypes.UNITAI_SPY )
pNewUnit.setHasPromotion(gc.getInfoTypeForString( 'PROMOTION_SENTRY2' ), true)
pNewUnit.setHasPromotion(gc.getInfoTypeForString( 'PROMOTION_COMMANDO' ), true)
pNewUnit.setHasPromotion(gc.getInfoTypeForString( 'PROMOTION_SPEED' ), true)
pNewUnit.setName("KGB Agent 001")
pNewUnit = pPlayer.initUnit( u_spy, iX, iY, UnitAITypes.UNITAI_SPY )
pNewUnit.setHasPromotion(gc.getInfoTypeForString( 'PROMOTION_SENTRY2' ), true)
pNewUnit.setHasPromotion(gc.getInfoTypeForString( 'PROMOTION_COMMANDO' ), true)
pNewUnit.setHasPromotion(gc.getInfoTypeForString( 'PROMOTION_SPEED' ), true)
pNewUnit.setName("KGB Agent 002")
pNewUnit = pPlayer.initUnit( u_spy, iX, iY, UnitAITypes.UNITAI_SPY )
pNewUnit.setHasPromotion(gc.getInfoTypeForString( 'PROMOTION_SENTRY2' ), true)
pNewUnit.setHasPromotion(gc.getInfoTypeForString( 'PROMOTION_COMMANDO' ), true)
pNewUnit.setHasPromotion(gc.getInfoTypeForString( 'PROMOTION_SPEED' ), true)
pNewUnit.setName("KGB Agent 003")
### ausgabe ###
CyInterface().addMessage(CyGame().getActivePlayer(),false,15,CyTranslator().getText("TXT_KEY_KGB_GAMETXT1",()),'',0,'Art/Interface/Buttons/Units/spy.dds',ColorTypes(44), -1, -1, True,True)
### message: The KGB provides 3 KGB Agents ###


##################################################################################
def onUnitBuilt(self, argsList):
'Unit Completed'

pCity = argsList[0]
pUnit = argsList[1]
pPlayer = gc.getPlayer(pUnit.plot().getOwner())
pTID = pPlayer.getTeam()
#####################
### KGB (part2/2) ###
#####################
### filter ###
if ( pUnit.getUnitClassType() == gc.getInfoTypeForString("UNITCLASS_SPY") ):
### check all cities ###
for iCity in range(pPlayer.getNumCities()):
pCity = pPlayer.getCity(iCity)
### if the player have the kgb wonder give all new build spies the sentry II promotion ###
if pCity.hasBuilding(gc.getInfoTypeForString( 'BUILDING_KGB' )):
pUnit.setHasPromotion(gc.getInfoTypeForString( 'PROMOTION_SENTRY2' ), true)
CyInterface().addMessage(pPlayer.getID(),false,15,CyTranslator().getText("TXT_KEY_KGB_GAMETXT2",(pCity.getName(),PyHelpers.PyInfo.UnitInfo(pUnit.getUnitType()).getDescription())),'',0,'Art/Interface/Buttons/promotions/Sentry2.dds',ColorTypes(44), pCity.getX(), pCity.getY(),True,True)
### message: In %s the KGB Wonder provides a free Sentry II Promotion to your new build %s! ###

##################################################################################

 
This should actually be in the original Sevomod 3.3 thread, but I post it here because I only recently noticed it, while playing GIR's Add-on.

There seems to be an erroneous use of XML-code in Civ4CivilizationInfos.xml for the Ukrainean city names.

Starting from the city "Kirovohrad" there is for some reason the original input form of code, instead of just only the city name, this causes the city to be named "XML_CITY_NAME..." and so on. Not a very big issue and easy to fix. It is just so very stupid looking and annoying when AI is playing the Ukraineans... :rolleyes:

Anyone spotted a similiar error in any XML-file, where names use code?

(I'd like to remove all these errors...) Obsession or what... :lol:


And by the way, check out the Rise of Mankind mod by Zappara. It is really on the right track, though development is still needed. Please try and share your views! :goodjob:
 
@Xenomorph:

you still need help with the kgb wonder?
should i make a "mini" mod?
Yea, I kinda had to give up on it. It would be cool if you made a mini mod for all those special buildings, as you had some really neat python-related wonders in that mod that people who aren't using Sevomod would certainly enjoy (The Sphinx and Da Vinci's work shop were pretty neat).
 
Here is the KGB mini MOD:



And here is a list with a few other Python Wonders/stuff from my mod:


If you want to use more than one mini mod at the same time you have to merge the xml files (new buildings and stuff) and add 2 lines in the CvCustomEventManager.py file. That should be very easy (see HOW TO PART1 and PART2).
If you want to use the MachuPicchu Mod and the Petra Mod in one game you also have to change the CvGameUtils.py file. I already wrote a HOW TO:
http://forums.civfanatics.com/showpost.php?p=5915206&postcount=23


edit:
I forgot to mention that the mini mods are testet with BTS. Im not sure if they all work with vanilla civ4...
 
Yea, I kinda had to give up on it. It would be cool if you made a mini mod for all those special buildings, as you had some really neat python-related wonders in that mod that people who aren't using Sevomod would certainly enjoy (The Sphinx and Da Vinci's work shop were pretty neat).
--> Sphinx: http://forums.civfanatics.com/showthread.php?t=263903

Any possibility of updating Sevomod to BTS?:confused: (Just wondering...);)

At the moment I'm trying to update my add-on in little pieces to BTS. But it's a lot of work and I don't think I even have the time to finish this... :(
 
Top Bottom