Requesting following features

here:

Code:
##ERE spawn!##
iEREYear = -2600
tERE1 = (39, 0)
tERE2 = (83, 51)
def eventERE():
    if isDate(iEREYear):
        lDefectingCities = getPlayerAreaCities(tERE1, tERE2, eRome)
        EastRomanEmpire.initCivilWar(Civ("Rome"), lDefectingCities)
This is in ModEvents!

now all there is to do is test everything and fix the years and percentages and test again and add XML tags and test AGAIN... yay...
 
ok... a exception from ModEvents regarding SenatePrompt....

Code:
##Byzantium Senate Prompt##
iSenateYear = -3800
iSenateEndYear = -3000
iSenateGold = 1000
senateHeader = "Senate"
senateMessage1 = "The glorius Senate of Rome requests that you take the city of Byzantium. If you take it and hold it at the end of 30 turns (turn 195) you will be greatly rewarded"
senateMessage2 = "The glorius Senate of Rome wishes that you make sure that you keep control of Byzantium by the end of 30 turns (turn 195). If you successful, you will be rewarded!"
senateMessage3 = "The Senate notes that you have succeeded and has gifted you 1000 gold!"
senateMessage4 = "The Senate notes that you have failed to control Byzantium and you will not be rewarded!"  
tByzantium = (46, 23)
def eventSenate():
    if isHuman("Rome") == True:
        if isDate(iSenateYear):
            if isPlotOwner(tByzantium, eRome) == False and isPlotCity(tByzantium) == True:
                showPopup(senateHeader, senateMessage1)
            else:
                showPopup(senateHeader, senateMessage2)
        elif isDate(iSenateEndYear):
            if isPlotOwner(tByzantium, eRome) == True and isPlotCity(tByzantium) == True:
                giveGold(iSenateGold, eRome)
                showPopup(senateHeader, senateMessage3)
            else:
                showPopup(senateHeader, senateMessage4)
Code:
def isHuman(name): # takes the Civ name (string) as the argument 
    pPlayer = pointer(name, CyPlayer) # assines the CyPlayer instance of the CivPlayer corresponding to name to the value pPlayer 
    return pPlayer,isHuman() # return the return value of CyPlayer.isHuman()

and the exception is:

File "CvEventInterface", line 23 in onEvent
File "CvEventManager", line 187m inhandleEvent
File "CvEventManager", line 385, in onBeginGameTurn
File "ModEvents", line 61,in eventSenate
File "Helpers", line 292, in isHuman

TypeError: isHuman() takes exactly 1 arguement (0 given)

which makes no sense because I did give it an arguement... is it because of the new CivPlayer module?
 
ok so I changed it to eRome instead of "Rome" and I got a different exception!

File "CvEventInterface", line 23 in onEvent
File "CvEventManager", line 187m inhandleEvent
File "CvEventManager", line 385, in onBeginGameTurn
File "ModEvents", line 63,in eventSenate (added something)
File "Helpers", line 292, in isHuman
File "CivPlayer", line 38 in pointer
File "CivPlayer", line 29, in Civ

KeyError: 0

I posted twice don't forget the other....

eRome is defined in your eNums

EDIT:
Code:
##Marius Reform##
iMissionsNeeded = 0
iCitiesNeeded = 10
mariusHeader = "Marius Reform"
mariusMessage1 = "An old soldier called Marius has called for the Roman Army to be reorganized, this means that as of now, all your cities give units +1 experience on build!
mariusMessage2 = "A man called Marius has called for the Roman Army to be reformed!"
def eventMarius():
    if getNumPlayerCities(eRome) >= iCitiesNeeded and getGlobalData("iMissionCounter") >= iMissionsNeeded:
        addMessage(mariusMessage2, (), eWhite)
        showPopup(mariusHeader, mariusMessage1)
        save()

this is the marius code (which I am finishing now...)

and here is the getNumPlayerCites function I made:
Code:
def getNumPlayerCities(ePlayer):
        pPlayer = gc.getPlayer(ePlayer)
        pPlayer.getNumCities ()
does that work fine?

Counter
Also I am lost with the counter... authough I understand how it works... I fail to understand where to put it and how to use it...
will I need to add
Code:
def increaseMissionCounter():
    iMissionCounter = getGlobalData("iMissionCounter")
    setGlobalData("iMissionCounter", iMissionCounter + 1)

to Helpers? Or is it not needed? You say define it on game start but how and where? It just needs a little explaining for me :rolleyes:

It is probably very simple but I'm not very logical today... Also by Termination Year I kinda meant fire year... sorry to confuse you :(
 
ok... a exception from ModEvents regarding SenatePrompt....

(...)

which makes no sense because I did give it an arguement... is it because of the new CivPlayer module?
If you change the comma to a dot it should work. ;)

ok so I changed it to eRome instead of "Rome" and I got a different exception!
Don't do that. The pointer() function takes a string value as the first argument, while eRome points to integer value. If you need to get a CivPlayer instance for a PlayerType you use the instance() method instead.
Code:
instance(eRome).get(CyPlayer).isHuman()
All of this is actually documented in the code for the CivPlayer module. You might wanna look into it eventually.

And you basically shouldn't need to use those PlayerType eNums that I added to the eNums module. Because with CivPlayer you can use the civ name directly, so its a bit redundant. :p

this is the marius code (which I am finishing now...) however it appears that I don't have a functions which returns the number of cities a player has. do you have one?
This is from memory, but you should use the API for this sort of thing: CyPlayer.getNumCities()

Also I am lost with the counter... authough I understand how it works... I fail to understand where to put it and how to use it...
will I need to add
Code:
def increaseMissionCounter():
    iMissionCounter = getGlobalData("iMissionCounter")
    setGlobalData("iMissionCounter", iMissionCounter + 1)

to Helpers? Or is it not needed? You say define it on game start but how and where? It just needs a little explaining for me :rolleyes:
You can define the helper in whichever module you like, as long as its available (even if so via import) in the module where you need it. I would probably keep some helpers in the ModEvents module that are specific to the code. The Helpers module is more for general purpose functions and other helpers that can be used in other modules - and projects.

Try this: Put this function in the ModEvents module:
Code:
def setupMissionCounter():
	setGlobalData("iMissionCounter", 0)
Then, in CvEventManager - in the onGameStart() method - add this function call:
Code:
ModEvents.setupMissionCounter()
You could of course call the setGlobalData() function directly from the Event Manager:
Code:
ModEvents.setGlobalData("iMissionCounter", 0)
Whichever should work the same. What it does is it adds the key "iMissionCounter" to the global value dictionary. Because some other code will be asking for this key - so there needs to be something defined in there, like a default zero value. Otherwise its an instant exception.

Now, it would be possible to work around this issue and not set any default value, but this might just be simpler to grasp. At this point. And you can follow this logic with any other custom values you need to define and store. But you might wanna rename the function setupDefaultValues() or something instead and supply default values for all of them in one single function call. This can also be done quite efficiently if you end up with a lot of values. You might even define the whole dictionary! But lets just save that for another time. ;)
 
for some reason I had a flash of inpiration and did the setupCounter(): and did the helper function myself (see above post...)

so thats good...

so, completed marius code (with the giveXP...):
Code:
#Data Storage!#
def setupCounter():
    setGlobalData("iMissionCounter", 0)

def increaseMissionCounter():
    iMissionCounter = getGlobalData("iMissionCounter")
    setGlobalData("iMissionCounter", iMissionCounter + 1)

def setRomeExtraXP():
	"""
	Sets a boolean flag to True that can be accessed though the name "bExtraXP" 
	or with the function isRomeExtraxP.
	"""
	setPlayerData(pointer("Rome", playerID), "bExtraXP", True)

##Marius Reform##
iMissionsNeeded = 0
iCitiesNeeded = 10
mariusHeader = "Marius Reform"
mariusMessage1 = "An old soldier called Marius has called for the Roman Army to be reorganized, this means that as of now, all your cities give units +1 experience on build!"
mariusMessage2 = "A man called Marius has called for the Roman Army to be reformed!"
def eventMarius():
    if getNumPlayerCities(eRome) >= iCitiesNeeded and getGlobalData("iMissionCounter") >= iMissionsNeeded:
        addMessage(mariusMessage2, (), eWhite)
        showPopup(mariusHeader, mariusMessage1)
        setRomeExtraXP()

I defined ModEvents.setupCounter() in onGameStart (under your rebels setup... thats how I did mine :D)
**I defined this in CustomFeatures:

Code:
#Marius XP give#
def isRomeExtraXP():
	"""
	Returns True if the "bExtraXP" flag has been set. Otherwise returns False.
	"""
	return getPlayerData(pointer("Rome", playerID), "bExtraXP")
       
def grantExtraXP(pUnit):
	if isRomeExtraXP() and pUnit.getOwner() == pointer("Rome", playerID):
		pUnit.setExperience(iRomeExtraXP, iRomeExtraXP)
should I import ModEvents and then put in the EventManager under onUnitBuild Custom.grantExtraXP. also should I import all of ModEvents or just eventMarius?**

how ever, I noticed that in onLoadGame there is a Rebellion.retrieveData()... do I need that? for mine to work? Also just for me, where will the senate missions be defined in ModEvents (importing the Senate module)?
 
Code:
def getNumPlayerCities(ePlayer):
        pPlayer = gc.getPlayer(ePlayer)
        pPlayer.getNumCities()
That last line should probably be a return statement.

how ever, I noticed that in onLoadGame there is a Rebellion.retrieveData()... do I need that? for mine to work? Also just for me, where will the senate missions be defined in ModEvents (importing the Senate module)?
Short answer: No, you're fine with just the one retrieveData() line.

Long answer:

That function call is actually done to the DataStorage module, but since that isn't used directly (it can be) the call goes via the CivPlayer module from the Rebellion module to DataStorage. This because all of these modules are chain-linked via * import lines. This is actually a somewhat dicey setup, but I didn't design it for you to use in the first place. :p

So you could pretty much import DataStorage in CvEventManager and just do the call directly to that module:
Code:
DataStorage.retrieveData()
Because what this does is... well... its all documented for you in the actual module:
Spoiler :
PHP:
def retrieveData():
        """
        To be called at the OnLoad event to retrieve all data from the save game.
        """
        scriptData = Game.getScriptData()
        tData = pickle.loads(scriptData)
        sd.lPlayerData, sd.globalData = tData
Without this procedure the mod won't know what any of the custom values are once you reload a game.

edit: I didn't grasp the last question.
 
ok thanks, btw don't forget to read the stuff between the ** because it asks about the exp!

edit: in the other thread you talked about putting the XP function definition in CustomFeatures and therefore in EventManager saying Custom.grantExtraXP() in onUnitBuilt

but for this to work the CustomFeatures needs to know whether bExtraXP is True... for it to know this surely it needs to import ModEvents (where the Marius Event tells the game that bExtraXP is True) to work? so should it import ModEvents or just:
from ModEvents import eventMarius?
 
It basically needs to make sense. Be watchful what you import into what module, and what name it is going under. And unless you use the from command with import you also need to specify the module name whenever you wanna access it.

The custom data set with DataStorage isn't module dependent. If you define a value you define it in DataStorage, even if the function call is done in another module (and it always will). As long as the module that is accessing/setting the value is importing DataStorage this is sufficient. You could view DataStorage as just that - the place where you store your data. And as long all modules have access to CivPlayer (they should) they can also access DataStorage - and all the data. This is achieved with all the import * linkage. Because DataStorage is a companion module to CivPlayer - they are co-dependant. I might just merge them if and when I release CivPlayer as a separate modding tool.
 
sounds good! I'm sure people with appreciate it! should the event manager look like this?
Code:
	def onUnitBuilt(self, argsList):
		'Unit Completed'
		city = argsList[0]
		unit = argsList[1]
		player = PyPlayer(city.getOwner())
		CvAdvisorUtils.unitBuiltFeats(city, unit)
		
		if (not self.__LOG_UNITBUILD):
			return
		CvUtil.pyPrint('%s was finished by Player %d Civilization %s' 
			%(PyInfo.UnitInfo(unit.getUnitType()).getDescription(), player.getID(), player.getCivilizationName

                [B]Custom.grantExtraXP()[/B]
 
Here's a little configuration tip for you regarding the Rebellion module. By default the various Rebellion types are checked in the same order as their respective classes appear in the code. There is nothing automatic or natural about this however - it just happens to be that I define the following array under constants:
Code:
tRebellionClasses = (
    "CulturalInfiltration",
    "Resistance",
    "DomesticRebellion",
    "MinorRevolt",
    )
These four strings represent the names of the classes that are evaluated in order every turn (for a different player each turn admittedly). The other rebellion types are handled differently and are not affected by this more than in a secondary way. (Like if some other rebellion type occurs there will not be any civil war rebellion on the same turn - for that player. Or if a city is in rebellion the slave revolt units wont spawn. And so on.)

The customization this offers is that you can easily change the order in which the conditions for the various rebellions are evaluated. So if you wanna favor Minor Revolts over Domestic Rebellions you switch places with the associated class names in the tRebellionClasses tuple.

Note that if you make your own rebellion type - and you could - it has to be defined in this array in order to be be able to be fired. At all.
 
The function call looks ok, but you should probably add some argument to it? (Probably unit, which should be uncovered as pUnit in the function definition.)
 
yeah, I got an exception because of that :lol: I then realised what I had missed out...

in any case I fixed up a new XML file containing all XML for python (untranslated of course...) don't know if it will work but if it doesn't link the %s1 etc with the python (which it should) then I will talk to the world of XML about it:

Spoiler :

Code:
	<TEXT>
		<Tag>TXT_KEY_EVENT_CIVIL_WAR</Tag>
		<English>Bring me his head on a pole, crush these cities, I am the ruler here.</English>
		<French>Apportez-moi la tête sur un poteau, d'écraser ces villes, JE suis le maître ici.</French>
		<German>Bringt mir seinen Kopf auf einem Pfahl, zerstört diese Staedte, ICH bin der Herrscher hier.</German>
		<Italian>Portami la testa su un palo, schiacciare queste città, IO sono il sovrano qui.</Italian>
		<Spanish>Tráeme su cabeza en un palo, aplastar a esas ciudades, yo soy el rey aquí.</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_EVENTTRIGGER_CIVIL_WAR</Tag>
		<English>A civil war has broken out in the Roman empire, battles are going on against the Byzantine rebels.</English>
		<French>Une guerre civile a éclaté dans l'empire romain, les combats sont en cours contre les rebelles byzantine.</French>
		<German>Ein Buergerkrieg ist im Roemischen Imperium ausgebrochen, es gibt Kaempfe gegen die Byzantinischen Rebellen.</German>
		<Italian>Una guerra civile è scoppiata nel impero romano, stanno andando avanti le battaglie contro i ribelli bizantino.</Italian>
		<Spanish>Una guerra civil ha estallado en el imperio romano, las batallas se están llevando a bizantinos contra los rebeldes.</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_EVENTTRIGGER_CIVIL_WAR_PLAYER</Tag>
		<English>Riots are breaking out in your cities! A new leader has arised, and his only goal is to free the people from your cruel dictatorship. Some of your cities have united under a new flag and will now fight against you.</English>
		<French>Des émeutes éclatent dans vos villes! Un nouveau chef a arised, et son seul but est de libérer le peuple de votre dictature cruelle. Certains de vos villes se sont unis sous un nouveau drapeau et aura désormais la lutte contre vous.</French>
		<German>Es gibt Aufstaende in euren Staedten! Ein neuer Anfuehrer hat sich erhoben, um die Menschen von eurer grausamen Herrschaft zu befreien. Einige eurer Staedte haben sich unter einer neuen Flagge vereint und werden euch nun bekaempfen.</German>
		<Italian>Rivolte sono scoppiata nella tua città! Un nuovo leader è giunto il momento, e il suo unico obiettivo è quello di liberare il popolo dalla dittatura crudele. Alcune delle vostre città sono uniti sotto una nuova bandiera e ora lotta contro di voi.</Italian>
		<Spanish>Los disturbios están surgiendo en sus ciudades! Un nuevo líder ha surgido, y su único objetivo es liberar al pueblo de su cruel dictadura. Algunas de sus ciudades se han unido bajo una nueva bandera y ahora luchará en contra de usted.</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_MODEVENTS_SPARTICUS_HEADER</Tag>
		<English>Sparticus</English>
		<French>Sparticus</French>
		<German>Sparticus</German>
		<Spanish>Sparticus</Spanish>
		<Italian>Sparticus</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_MODEVENTS_SPARTICUS_MESSAGE1</Tag>
		<English>Spartacus has invaded southern Italy as revenge for his cruel mistreatment.[NEWLINE][NEWLINE] A barbarian army will spawn in sourthern Italy</English>
		<French>Spartacus has invaded southern Italy as revenge for his cruel mistreatment.[NEWLINE][NEWLINE] A barbarian army will spawn in sourthern Italy</French>
		<German>Spartacus has invaded southern Italy as revenge for his cruel mistreatment.[NEWLINE][NEWLINE] A barbarian army will spawn in sourthern Italy</German>
		<Spanish>Spartacus has invaded southern Italy as revenge for his cruel mistreatment.[NEWLINE][NEWLINE] A barbarian army will spawn in sourthern Italy</Spanish>
		<Italian>Spartacus has invaded southern Italy as revenge for his cruel mistreatment.[NEWLINE][NEWLINE] A barbarian army will spawn in sourthern Italy</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_MODEVENTS_SPARTICUS_MESSAGE2</Tag>
		<English>Spartacus has invaded southern Italy as revenge for his cruel mistreatment!</English>
		<French>Spartacus has invaded southern Italy as revenge for his cruel mistreatment!</French>
		<German>Spartacus has invaded southern Italy as revenge for his cruel mistreatment!</German>
		<Spanish>Spartacus has invaded southern Italy as revenge for his cruel mistreatment!</Spanish>
		<Italian>Spartacus has invaded southern Italy as revenge for his cruel mistreatment!</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_MODEVENTS_MACEDONIA_HEADER</Tag>
		<English>Macedonian Rebellion</English>
		<French>Macedonian Rebellion</French>
		<German>Macedonian Rebellion</German>
		<Spanish>Macedonian Rebellion</Spanish>
		<Italian>Macedonian Rebellion</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_MODEVENTS_MACEDONIA_MESSAGE1</Tag>
		<English>Leaders of a small rebel group hope to reform the mighty kingdom of Macedon![NEWLINE][NEWLINE] Either a large army of barbarians will spawn in the north of Greece or a city and a small army will appear of rebels!</English>
		<French>Leaders of a small rebel group hope to reform the mighty kingdom of Macedon![NEWLINE][NEWLINE] Either a large army of barbarians will spawn in the north of Greece or a city and a small army will appear of rebels!</French>
		<German>Leaders of a small rebel group hope to reform the mighty kingdom of Macedon![NEWLINE][NEWLINE] Either a large army of barbarians will spawn in the north of Greece or a city and a small army will appear of rebels!</German>
		<Spanish>Leaders of a small rebel group hope to reform the mighty kingdom of Macedon![NEWLINE][NEWLINE] Either a large army of barbarians will spawn in the north of Greece or a city and a small army will appear of rebels!</Spanish>
		<Italian>Leaders of a small rebel group hope to reform the mighty kingdom of Macedon![NEWLINE][NEWLINE] Either a large army of barbarians will spawn in the north of Greece or a city and a small army will appear of rebels!</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_MODEVENTS_MACEDONIA_MESSAGE2</Tag>
		<English>Leaders of a small rebel group hope to reform the mighty kingdom of Macedon!</English>
		<French>Leaders of a small rebel group hope to reform the mighty kingdom of Macedon!</French>
		<German>Leaders of a small rebel group hope to reform the mighty kingdom of Macedon!</German>
		<Spanish>Leaders of a small rebel group hope to reform the mighty kingdom of Macedon!</Spanish>
		<Italian>Leaders of a small rebel group hope to reform the mighty kingdom of Macedon!</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_MODEVENTS_SENATE_HEADER</Tag>
		<English>Senate</English>
		<French>Senate</French>
		<German>Senate</German>
		<Spanish>Senate</Spanish>
		<Italian>Senate</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_MODEVENTS_SENATE_MESSAGE1</Tag>
		<English>The glorius Senate of Rome requests that you take the city of Byzantium. If you take it and hold it at the end of 30 turns (turn 195) you will be greatly rewarded</English>
		<French>The glorius Senate of Rome requests that you take the city of Byzantium. If you take it and hold it at the end of 30 turns (turn 195) you will be greatly rewarded</French>
		<German>The glorius Senate of Rome requests that you take the city of Byzantium. If you take it and hold it at the end of 30 turns (turn 195) you will be greatly rewarded</German>
		<Spanish>The glorius Senate of Rome requests that you take the city of Byzantium. If you take it and hold it at the end of 30 turns (turn 195) you will be greatly rewarded</Spanish>
		<Italian>The glorius Senate of Rome requests that you take the city of Byzantium. If you take it and hold it at the end of 30 turns (turn 195) you will be greatly rewarded</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_MODEVENTS_SENATE_MESSAGE2</Tag>
		<English>The glorius Senate of Rome wishes that you make sure that you keep control of Byzantium by the end of 30 turns (turn 195). If you successful, you will be rewarded!</English>
		<French>The glorius Senate of Rome wishes that you make sure that you keep control of Byzantium by the end of 30 turns (turn 195). If you successful, you will be rewarded!</French>
		<German>The glorius Senate of Rome wishes that you make sure that you keep control of Byzantium by the end of 30 turns (turn 195). If you successful, you will be rewarded!</German>
		<Spanish>The glorius Senate of Rome wishes that you make sure that you keep control of Byzantium by the end of 30 turns (turn 195). If you successful, you will be rewarded!</Spanish>
		<Italian>The glorius Senate of Rome wishes that you make sure that you keep control of Byzantium by the end of 30 turns (turn 195). If you successful, you will be rewarded!</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_MODEVENTS_SENATE_MESSAGE3</Tag>
		<English>The Senate notes that you have succeeded and has gifted you 1000 gold!</English>
		<French>The Senate notes that you have succeeded and has gifted you 1000 gold!</French>
		<German>The Senate notes that you have succeeded and has gifted you 1000 gold!</German>
		<Spanish>The Senate notes that you have succeeded and has gifted you 1000 gold!</Spanish>
		<Italian>The Senate notes that you have succeeded and has gifted you 1000 gold!</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_MODEVENTS_SENATE_MESSAGE4</Tag>
		<English>The Senate notes that you have failed to control Byzantium and you will not be rewarded!</English>
		<French>The Senate notes that you have failed to control Byzantium and you will not be rewarded!</French>
		<German>The Senate notes that you have failed to control Byzantium and you will not be rewarded!</German>
		<Spanish>The Senate notes that you have failed to control Byzantium and you will not be rewarded!</Spanish>
		<Italian>The Senate notes that you have failed to control Byzantium and you will not be rewarded!</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_REBELLION_REBELLION</Tag>
		<English>A rebellion has broken out in the city of %s1!</English>
		<French>A rebellion has broken out in the city of %s1!</French>
		<German>A rebellion has broken out in the city of %s1!</German>
		<Spanish>A rebellion has broken out in the city of %s1!</Spanish>
		<Italian>A rebellion has broken out in the city of %s1!</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_REBELLION_TERMINATION</Tag>
		<English>The rebellion in %s1 has ended!</English>
		<French>The rebellion in %s1 has ended!</French>
		<German>The rebellion in %s1 has ended!</German>
		<Spanish>The rebellion in %s1 has ended!</Spanish>
		<Italian>The rebellion in %s1 has ended!</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_REBELLION_UNITSPAWN</Tag>
		<English>Rebel units are forming around %s1!</English>
		<French>Rebel units are forming around %s1!</French>
		<German>Rebel units are forming around %s1!</German>
		<Spanish>Rebel units are forming around %s1!</Spanish>
		<Italian>Rebel units are forming around %s1!</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_REBELLION_CIVILWAR</Tag>
		<English>The %s1 Empire is descending into Civil War!</English>
		<French>The %s1 Empire is descending into Civil War!</French>
		<German>The %s1 Empire is descending into Civil War!</German>
		<Spanish>The %s1 Empire is descending into Civil War!</Spanish>
		<Italian>The %s1 Empire is descending into Civil War!</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_REBELLION_CIVILWAR_TERMINATION</Tag>
		<English>The %s1 Civil War has come to an end!</English>
		<French>The %s1 Civil War has come to an end!</French>
		<German>The %s1 Civil War has come to an end!</German>
		<Spanish>The %s1 Civil War has come to an end!</Spanish>
		<Italian>The %s1 Civil War has come to an end!</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_REBELLION_CIVILWAR_UNITSPAWN</Tag>
		<English>A Rebel Army is forming around the rebel city of %s1!</English>
		<French>A Rebel Army is forming around the rebel city of %s1!</French>
		<German>A Rebel Army is forming around the rebel city of %s1!</German>
		<Spanish>A Rebel Army is forming around the rebel city of %s1!</Spanish>
		<Italian>A Rebel Army is forming around the rebel city of %s1!</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_REBELLION_SLAVEREVOLT</Tag>
		<English>Escaped slaves are forming military units in the countryside surrounding %s1!</English>
		<French>Escaped slaves are forming military units in the countryside surrounding %s1!</French>
		<German>Escaped slaves are forming military units in the countryside surrounding %s1!</German>
		<Spanish>Escaped slaves are forming military units in the countryside surrounding %s1!</Spanish>
		<Italian>Escaped slaves are forming military units in the countryside surrounding %s1!</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_REBELLION_SLAVEREVOLT_TERMINATION</Tag>
		<English>All slave units are laying down arms and re-entering the work-force as free men!</English>
		<French>All slave units are laying down arms and re-entering the work-force as free men!</French>
		<German>All slave units are laying down arms and re-entering the work-force as free men!</German>
		<Spanish>All slave units are laying down arms and re-entering the work-force as free men!</Spanish>
		<Italian>All slave units are laying down arms and re-entering the work-force as free men!</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_REBELLION_ERE</Tag>
		<English>The once great Roman Empire has been split into a Western and a Eastern part. The new capital %s1 is renamed %s2!</English>
		<French>The once great Roman Empire has been split into a Western and a Eastern part. The new capital %s1 is renamed %s2!</French>
		<German>The once great Roman Empire has been split into a Western and a Eastern part. The new capital %s1 is renamed %s2!</German>
		<Spanish>The once great Roman Empire has been split into a Western and a Eastern part. The new capital %s1 is renamed %s2!</Spanish>
		<Italian>The once great Roman Empire has been split into a Western and a Eastern part. The new capital %s1 is renamed %s2!</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_MODEVENTS_MARIUS_HEADER</Tag>
		<English>The once great Roman Empire has been split into a Western and a Eastern part. The new capital %s1 is renamed %s2!</English>
		<French>The once great Roman Empire has been split into a Western and a Eastern part. The new capital %s1 is renamed %s2!</French>
		<German>The once great Roman Empire has been split into a Western and a Eastern part. The new capital %s1 is renamed %s2!</German>
		<Spanish>The once great Roman Empire has been split into a Western and a Eastern part. The new capital %s1 is renamed %s2!</Spanish>
		<Italian>The once great Roman Empire has been split into a Western and a Eastern part. The new capital %s1 is renamed %s2!</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_MODEVENTS_MARIUS_MESSAGE1</Tag>
		<English>The once great Roman Empire has been split into a Western and a Eastern part. The new capital %s1 is renamed %s2!</English>
		<French>The once great Roman Empire has been split into a Western and a Eastern part. The new capital %s1 is renamed %s2!</French>
		<German>The once great Roman Empire has been split into a Western and a Eastern part. The new capital %s1 is renamed %s2!</German>
		<Spanish>The once great Roman Empire has been split into a Western and a Eastern part. The new capital %s1 is renamed %s2!</Spanish>
		<Italian>The once great Roman Empire has been split into a Western and a Eastern part. The new capital %s1 is renamed %s2!</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_CUSTOMFEATURES_HEADER</Tag>
		<English>Jamie's Rome Mod</English>
		<French>Jamie's Rome Mod</French>
		<German>Jamie's Rome Mod</German>
		<Spanish>Jamie's Rome Mod</Spanish>
		<Italian>Jamie's Rome Mod</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_CUSTOMFEATURES_MESSAGE</Tag>
		<English>This mod includes the Rebels Python mod component. It has been redesigned for this mod! please refer to the Civilopedia entry for Rebellions in Mod Concepts for more information!</English>
		<French>This mod includes the Rebels Python mod component. It has been redesigned for this mod! please refer to the Civilopedia entry for Rebellions in Mod Concepts for more information!</French>
		<German>This mod includes the Rebels Python mod component. It has been redesigned for this mod! please refer to the Civilopedia entry for Rebellions in Mod Concepts for more information!</German>
		<Spanish>This mod includes the Rebels Python mod component. It has been redesigned for this mod! please refer to the Civilopedia entry for Rebellions in Mod Concepts for more information!</Spanish>
		<Italian>This mod includes the Rebels Python mod component. It has been redesigned for this mod! please refer to the Civilopedia entry for Rebellions in Mod Concepts for more information!</Italian>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_CUSTOMFEATURES_COMMANDERING</Tag>
		<English>A %s1 %s2 unit has been captured!</English>
		<French>A %s1 %s2 unit has been captured!</French>
		<German>A %s1 %s2 unit has been captured!</German>
		<Spanish>A %s1 %s2 unit has been captured!</Spanish>
		<Italian>A %s1 %s2 unit has been captured!</Italian>
	</TEXT>


and also this explanation of the rebels in another txt file:

Spoiler :

This mod contains the Python Rebellion Mod Comp by Baldyr! It has been specially adapted so will be fully explained here so that you know how to deal with these events! The feature can very much help or hinder you civilization, it can either put you against a new enemy or do exactly the same to your enemies! Here is a little explanation of each type of Rebellion! (authough 1 is hidden, just for the surprise!)

Occupation
This rebellion takes place in conquored cities during their original conquor anarchy and the rebel units belong the city's original owner and the unit types correspond to the original city owner's tech level!

Domestic
This happens when a city is in disorder and will spawn a "Civ Specific Rebel" (from here on called CSR) Civilization which is minor but at peace with every body when it spawns (except the victim of the rebellion of course!).

Minor Domestic
Happens when a city is angry, quite rare this event spawns units based of the cities unhappiness, so watch out! Once again uses a CSR.

Cultural
Happens in cities with cultural pressure this spawn the units to the Civilization with the dominant culture in the city!

Slave
This rather special rebellion takes place while you are in slavery and the slave revolt event hits. When it does the way to disband the Rebel Civilization is to swap from Slavery to a diffrent Civic!


do you think that explains it well enough? Of course Evil Me decided to let them find out about Civil War on their own! :satan:
 
hmmmm odd callback, says there is an invalid syntax in my Custom.grantExtraXP(unit)

so I check module in IDLE and it says that Custom is an invalid syntax... Right... so I change to CustomFeatures and it still says invalid syntax... at the bottom of the module EventManager:
Code:
def initiateCustomPython():
	if gc.getGame().isFinalInitialized():
		global Powers, Rebellion, Custom, CC, ModEvents
		import Powers, Rebellion, CustomFeatures as Custom, CatapultConstruction as CC, ModEvents
		if not Rebellion.getGlobalScriptDict():
			Rebellion.setup()
		CC.load()
		from CvGameUtils import CvGameUtils
		CvGameUtils.powers = Powers
		Custom.gameTurn()

it is also appearing at start up in single boxes at a time so hard to document...

edit: I move Custom.grantExtraXP(unit) up and check and IDLE says that def (yes DEF) is an invalid syntax?????!!!!!!
 
Looking good, but know that you can add tons of variant messages to the Rebellion module. You need to redefine a few methods for the rebellion type and also write the new string (and translate it later) to achieve this, but I can explain once you need it. I basically supplied you with the bare minimum in regard to messages.

Also, it is quite possible to add a free promotion to all units of any given rebellion type. And of course change the default UnitAIType. (I believe that I did the latter with some rebellion type - possibly the slaves.)
 
ok dont forget to look at post 713 (I double posted) quite important...
 
The exceptions are also printed into the error logs - keep them handy when testing/debugging. Post the whole traceback and we should be able to figure it out!

IDLE will show you with a red square where your syntax is faulted if you use Run->Check Module. But most of the time it will show up as a mistake on the previous or the subsequent line - because the interpreter is misinterpreting what line ends where.
 
but it has a block over def... i Will show you the whole area...
Code:
	def onUnitBuilt(self, argsList):
		'Unit Completed'
		city = argsList[0]
		unit = argsList[1]
		player = PyPlayer(city.getOwner())
		CvAdvisorUtils.unitBuiltFeats(city, unit)

                [B]Custom[/B].grantExtraXP(unit)
		
		if (not self.__LOG_UNITBUILD):
			return
		CvUtil.pyPrint('%s was finished by Player %d Civilization %s' 
			%(PyInfo.UnitInfo(unit.getUnitType()).getDescription(), player.getID(), player.getCivilizationName
	
	[B]def[/B] onUnitKilled(self, argsList):

bits in bold are bits that have come up red...

How do I find the Error logs? :p
 
actually I might have figured this out... It is saying that whatever is after
%(PyInfo.UnitInfo(unit.getUnitType()).getDescription(), player.getID(), player.getCivilizationName

is invalid syntax... now notice that getCivilizationName has nothing behind it (I expect something along the lines of ()). maybe thats it?

edit: yes it is! it is missing a ())) at the end of the line! yay my first debug..

but still, where are the error logs?
 
Congrats! :goodjob: It was obvious for someone like me, but I'm impressed at the speed at which you figured it out yourself.

The 3 logs you wanna keep an eye on are PythonErr.log, PythonErr2.log and PythonDbg.log found in \Documents\Games\BtS\Logs\

You can add debug messages to the debug log with the print command.
 
ok thanks!

btw do you know of any other message colours other than red green white? because that could be interesting!
 
Back
Top Bottom