Requesting following features

Note that you will only be getting the minor domestic rebellion thing (or whatever) because its set to happen 100% of the time. And thus preventing any of the other types of rebellions from happening. So you should at the least lessen those chances to something else than 100% or the mod won't work.
 
ok couple of questions, will I need tyo merge my custom functions with your helpers because some of my funxctions are not present in helpers. if I use a different langauge without changing ANYTHING will your messages just be in English? Should I just replace all of my files with yours? (provided that they contain the relevant information)
 
ok couple of questions, will I need tyo merge my custom functions with your helpers because some of my funxctions are not present in helpers.
The only thing I left out was the defunct function you wrote. It simply wasn't gonna fly and you don't need it anyways. If something else is missing you should probably add it, but make sure you didn't just miss it because there is a lot of useful things in there!

if I use a different langauge without changing ANYTHING will your messages just be in English?
Yeah, the whole mod should be self-translating if you change the strings values into XML tags (in string type). So you can do it in stages - or not at all. It should all work the same. You could test it on a small scale first - because I never did. :rolleyes:

Should I just replace all of my files with yours? (provided that they contain the relevant information)
Yeah, but note that I never merged the CvEventManager you sent me with my own. So my copy isn't aware of any of your edits, like what the ModEvents module is. See my previous post for more on this.
 
hmmm... compare:
Spoiler :

Code:
### Helper functions for Jamie's Rome Mod

from CvPythonExtensions import *
from CivPlayer import *
from eNums import *
from Popup import PyPopup

Interface = CyInterface()
Translator = CyTranslator()
Map = CyMap()

iNumMajorPlayers = 8
pHumanCiv = instance(Game.getActivePlayer())
eBarbarian = gc.getBARBARIAN_PLAYER()
pBarbarianCiv = CivPlayer(eBarbarian)

def showPopup(popupHeader, popupMessage):
        """
        Launches a pop-up window with the header defined by the popupHeader (string)
        argument and the text message defined by the popupMessage (string) argument.
        """
        modPopup = PyPopup()
        modPopup.setHeaderString(Translator.getText(popupHeader, ()))
        modPopup.setBodyString(Translator.getText(popupMessage, ()))
        modPopup.launch()

def isDate(iDate):
        """
        Returns True if the current game date is the first game turn past the iDate
        (integer) date. Otherwise returns False.
        """
        return CyGame().getTurnYear(CyGame().getGameTurn() +1) > iDate and CyGame().getGameTurnYear() <= iDate <= iDate

def spawnUnits(ePlayer, eUnitType, tCoords, iNum):
        """
        Initiates iNum (integer) number of CyUnit instances of the eUnitType (integer)
        UnitType for the ePlayer (integer) PlayerType at the CyPlot defined by the pair of
        integer coordinates contained in tCoords (tuple).
        """
        iX, iY = tCoords
        CivPlayer(ePlayer).get(PyPlayer).initUnit(eUnitType, iX, iY, iNum)

def isPlotOwner(tCoords, ePlayer): 
        """ 
        Returns True if ePlayer is the owner of the plot at tCoords. Otherwise returns
        False. To check if the plot has no owner (at all) the ePlayer value should be -1.        
        """
        pPlot = getPlot(tCoords) 
        eOwner = pPlot.getOwner() 
        return eOwner == ePlayer
        #Note to self: to ask the function if the plot is not owned use isPlotOwner(tCoords, -1) and True is for not owned
        #Subsequently if you use: if not isPlotOwner(tCoords, -1) you are asking the function whether ANYBODY owns the plot!

##def isPlotNotOwned(tCoords):
##    """
##    Returns True if Plot is not owned by anybody (made by J_mie6) if plot is owned returns False
##    """
##    pPlot = getPlot(tCoords)
##    eOwner = pPlot.getOwner()
##    return eOwner != eHellenicRebels or eRome or eGreece or eGaul or eBrittania or eCarthage or eEgypt or eGermania or ePictia or eItalianRebels or eNubianRebels or eNumidianRebels or eGallicRebels or eBrythonRebels or eGermanicRebels or ePictishRebels or eIberia or eGreekColonies
##    #Mostly the same as above just different method!

def checkCityProximity(tCoords, iDistance=4): 
        """ 
        Returns False if any city is within iDistance from the plot at tCoords. Otherwise
        returns True. 
        """ 
        pPlot = getPlot(tCoords) 
        iX = pPlot.getX() 
        iY = pPlot.getY() 
        for iCurrentX in range(iX - iDistance, iX + iDistance + 1): 
                for iCurrentY in range(iY - iDistance, iY + iDistance + 1): 
                        pCurrentPlot = Map.plot(iCurrentX, iCurrentY) 
                        if pCurrentPlot.isCity(): 
                                return False 
        return True 

def spawnCity(tCoords, ePlayer, name=None, iSize=2): 
        """ 
        Creates a new CyCity instance at tCoords belonging to ePlayer, of iSize and with
        the optional name.
        """ 
        iX, iY = tCoords 
        pPlayer = pPlayer = gc.getPlayer(ePlayer)
        pCity = pPlayer.initCity(iX, iY) 
        pCity.setPopulation(iSize) 
        if name != None: 
                pCity.setName(name, True) 

def getPlot(tCoords): 
        """ 
        Returns the CyPlot instance of the plot at tCoords. 
        """ 
        iX, iY = tCoords 
        return Map.plot(iX, iY)

def getCoords(pInstance):
        """
        Used for fetching the map plot coordinates of any CyPlot or CyCity object, supplied
        as the pInstance argument. The coordinates are returned as two integer values
        wrapped up in a tuple.
        """
        return (pInstance.getX(), pInstance.getY())
        
def isPlayerCity(pCity, ePlayer):
        """
        Returns True if pCity (CyCity object) is owned by ePlayer (integer).
        """
        return pCity.getOwner() == ePlayer

def getPlayerAreaCities(tCoords1, tCoords2, ePlayer):
        """
        Returns a list of all CyCity instances corresponding to cities belonging to ePlayer
        inside the map area defined by tCoords1 and tCoords2.
        """
        lPlayerAreaCities = list()
        for pCity in findAreaCities(tCoords1, tCoords2):
                if isPlayerCity(pCity, ePlayer):
                        lPlayerAreaCities.append(pCity)
        return lPlayerAreaCities

def findAreaCities(tCoords1, tCoords2):
        """
        Used for looping. When supplied with the map coordinates of a area defined by its
        lower left corner (tCoords1) and its upper right corner (tCoords2), the function
        yields all cities (CyCity instances) in order.
        """
        iX1, iY1 = tCoords1
        iX2, iY2 = tCoords2
        for iX in range(iX1, iX2 + 1):
                for iY in range(iY1, iY2 + 1):
                        pPlot = Map.plot(iX, iY)
                        if pPlot.isCity():
                                yield pPlot.getPlotCity()

def getHighestCityCulturalRival(pCity):
        """
        Returns the PlayerType (integer) of the rival with the highest amount of cultural
        points in pCity (CyCity object).
        """
        eOwner = pCity.getOwner()
        eCulturalOwner = pCity.findHighestCulture()
        if eCulturalOwner != eOwner:
                return eCulturalOwner
        else:
                tCurrentLeader = -1, 0
                for ePlayer in CivPlayer.getPlayers(index=playerID):
                        if ePlayer == eOwner or ePlayer == eCulturalOwner: continue
                        iCulture = pCity.getCulture(ePlayer)
                        if iCulture > tCurrentLeader[1]:
                                tCurrentLeader = ePlayer, iCulture
                return tCurrentLeader[0]

def addMessage(tag, tValues, eColor, tCoords=(-1, -1)):
        """
        Adds the tag (string) message to the game in eColor. (The preset pointers to valid
        ColorTypes are eRed, eGreen and eWhite. A None value will disable the message.) If
        the tag argument requires other values to be included in the message, then these
        can be supplied with the tValues (tuple) argument. The optional tCoords (tuple)
        argument is set to a pair of default -1 values that indicate that no arrow should
        accompany the text message. (Valid map tile coordinates will enable the arrow.)
        """
        if eColor == None: return
        message = Translator.getText(tag, tValues)
        bArrow = tCoords != (-1, -1)
        Interface.addMessage(pHumanCiv.get(playerID), True, 20, message, "", eMinorEvent, "", eColor, tCoords[0], tCoords[1], bArrow, bArrow)

def getColor(bHuman, bAI, bOther=None):
        """
        Used to translate the arguments (booleans) into one of the 3 preset ColorTypes values.
        The booleans are evaluated in order and the first one pointing to a True value will
        cause the function to return the corresponding ColorType. If all arguments are False
        then the fuction returns a None value.
        """
        if bHuman:
                return eGreen
        elif bAI:
                return eRed
        elif bOther:
                return eWhite

def isChance(iProbability):
        """
        Used to resolve random checks where the iProbability argument is a integer value
        between 1 and 100. The probability is this value in 100 and the function returns True
        or False depending on the outcome.
        """
        return getRandNum(100, "isChance()") < iProbability

def getRandNum(iRange, debug="getRandNum()"):
        """
        Returns a random number (integer) between 0 (zero) and iRange - 1. The debug (string)
        argument is optional.
        """
        return Game.getSorenRandNum(iRange, debug)

def getUnitClass(pUnit):
        """
        Returns the UnitClassType (integer) of the UnitType of the CyUnit instance referenced
        by the pUnit argument.
        """
        return gc.getUnitInfo(pUnit.getUnitType()).getUnitClassType()

def isSpawnValid(pPlot):
        """"
        Returns False if the CyPlot instance referenced by the pPlot argument is a water or
        a mountain tile. Otherwise returns True.
        """
        return not ( pPlot.isWater() or pPlot.isPeak() )

def getRandomCoords(lPlots):
        """
        Supplied with a list array (the lPlots argument) with CyPlot instances the function
        will return a tuple containing the integer map coordinates of one randomly selected
        plot.
        """
        iRandNum = getRandNum(len(lPlots), "random plot")
        pPlot = lPlots[iRandNum]
        return getCoords(pPlot)

def cityKnownByHuman(pCity):
        """
        Returns True if the CyCity instance referenced by the pCity argument is known to
        the human player. Otherwise returns False.
        """
        return pCity.isRevealed(pHumanCiv.get(teamID), False)

def getDistanceToCapital(pInstance, pPlayer):
        """
        Returns a integer value corresponding to the distance (in map plots) between the
        CyCity or CyPlot instance referenced by the pInstance argument and the capital of
        the player referenced by the pPlayer (CyPlayer object) argument.
        """
        iCityX, iCityY = getCoords(pInstance)
        iCapitalX, iCapitalY = getCoords(pPlayer.getCapitalCity())
        return max(abs(iCityX - iCapitalX), abs(iCityY - iCapitalY))

def getCityUnits(pCity):
        """
        Returns a list array of all units in pCity (CyCity object) belonging to the city's
        owner.
        """
        eOwner = pCity.getOwner()
        pPlot = pCity.plot()
        lUnits = list()
        for pUnit in (pPlot.getUnit(iUnit) for iUnit in range(pPlot.getNumUnits())):
                if pUnit.getOwner() != eOwner: continue
                lUnits.append(pUnit)
        return lUnits

def setCapital(pCity):
        """
        Spawns the Palace National Wonder in pCity (CyCity object) - thus making it the
        capital.
        """
        pCity.setNumRealBuilding(ePalace, 1)
    
def setAtWar(pCivPlayer1, pCivPlayer2):
        """
        Makes the team of the player referenced by the pCivPlayer1 (CivPlayer object)
        argument declare war on the team of the player referenced by the pCivPlayer2
        (CivPlayer object) argument.
        """
        pTeam1 = pCivPlayer1.get(CyTeam)
        team2ID = pCivPlayer2.get(teamID)
        if not pTeam1.isAtWar(team2ID):
                pTeam1.declareWar(team2ID, True, -1)

with mine:
Spoiler :

Code:
##custom functions for use in modding etc##
##use if required/wanted!##
##Currently contains: showPopup, isDate, spawnUnits, isPlotOwner, isPlotNotOwned, checkCityProximity, spawnCity, getPlot, hasCivLostCity, giveGold, isHuman##
##getCapital, isPlotCity, giveGoldenAge, findAreaCities, isPlayerCity, isAreaOwner and spawnAreaCityUnits!##
from Popup import PyPopup
from CvPythonExtensions import *
from PyHelpers import *
from CivPlayer import *
from Utils import *

def save():
    print "Save"

def showPopup(popupHeader, popupMessage):
    modPopup = PyPopup()
    modPopup.setHeaderString(popupHeader)
    modPopup.setBodyString(popupMessage)
    modPopup.launch()

def isDate(iDate):
    return CyGame().getTurnYear(CyGame().getGameTurn() +1) > iDate and CyGame().getGameTurnYear() <= iDate <= iDate

def spawnUnits(ePlayer, eUnitType, tCoords, iNum):
	iX, iY = tCoords
	CivPlayer(ePlayer).get(PyPlayer).initUnit(eUnitType, iX, iY, iNum)

Map = CyMap() 

def isPlotOwner(tCoords, ePlayer): 
    """ 
    Returns True if ePlayer is the owner of the plot at tCoords.  
    Otherwise returns False. 
    """ 
    pPlot = getPlot(tCoords) 
    eOwner = pPlot.getOwner() 
    return eOwner == ePlayer
    #Note to self: to ask the function if the plot is not owned use isPlotOwner(tCoords, -1) and True is for not owned
    #Subsequently if you use: if not isPlotOwner(tCoords, -1) you are asking the function whether ANYBODY owns the plot!
    
def isPlotNotOwned(tCoords):
    """
    Returns True if Plot is not owned by anybody (made by J_mie6)
    if plot is owned returns False
    """
    pPlot = getPlot(tCoords)
    eOwner = pPlot.getOwner()
    return eOwner != eHellenicRebels or eRome or eGreece or eGaul or eBrittania or eCarthage or eEgypt or eGermania or ePictia or eItalianRebels or eNubianRebels or eNumidianRebels or eGallicRebels or eBrythonRebels or eGermanicRebels or ePictishRebels or eIberia or eGreekColonies
    #Mostly the same as above just different method!

def checkCityProximity(tCoords, iDistance=4): 
    """ 
    Returns False if any city is within iDistance from the plot at  
    tCoords. Otherwise returns True. 
    """ 
    pPlot = getPlot(tCoords) 
    iX = pPlot.getX() 
    iY = pPlot.getY() 
    for iCurrentX in range(iX - iDistance, iX + iDistance + 1): 
        for iCurrentY in range(iY - iDistance, iY + iDistance + 1): 
            pCurrentPlot = Map.plot(iCurrentX, iCurrentY) 
            if pCurrentPlot.isCity(): 
                return False 
    return True 

def spawnCity(tCoords, ePlayer, name=None, iSize=2): 
    """ 
    Creates a new CyCity instance at tCoords belonging to ePlayer,  
    of iSize and with the optional name. (Returns None.) 
    """ 
    iX, iY = tCoords 
    pPlayer = pPlayer = gc.getPlayer(ePlayer) # alt instance(ePlayer).get(CyPlayer) 
    pCity = pPlayer.initCity(iX, iY) 
    pCity.setPopulation(iSize) 
    if name != None: 
        pCity.setName(name, True) 

def getPlot(tCoords): 
    """ 
    Returns the CyPlot instance of the plot at tCoords. 
    """ 
    iX, iY = tCoords 
    return Map.plot(iX, iY)

def hasCivLostCity(ePlayer):
    """
    Returns if the specified civ has lost any cities.
    True for lost 1 or more cities
    False for lost no cities
    """
    pPlayer = gc.getPlayer(ePlayer)
    if pPlayer.getCitiesLost() >= 1:
        return True
    else:
        return False

def giveGold(iChange, ePlayer):
    """
    Gives gold to the specified player!
    """
    pPlayer = gc.getPlayer(ePlayer)
    iGold = pPlayer.getGold()
    pPlayer.setGold(iChange + iGold)
    #Note to self: DO NOT USE iGold to define amount of gold to give!!!
    #Use a negative value to deduct money!

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()

def getCapital(ePlayer):
    """
    Returns ePlayers capital city co-ordinates!
    """
    pPlayer = gc.getPlayer(ePlayer)
    pCapital = pPlayer.getCapitalCity()
    tCapitalPlot = getPlot(pCapital)
    return tCapitalPlot

def isPlotCity(tCoords):
    """
    returns if a plot is a city or not!
    """
    pPlot = getPlot(tCoords)
    if pPlot.isCity():
        return True
    else:
        return False

def giveGoldenAge(ePlayer, eTurns):
    pPlayer = gc.getPlayer(ePlayer)
    pPlayer.changeGoldenAgeTurns(eTurns) 

Map = CyMap()

def findAreaCities(tCoords1, tCoords2):
	"""
	Used for looping. When supplied with the map coordinates of a area defined 
	by its lower left corner (tCoords1) and its upper right corner (tCoords2), 
	the function yields all cities (CyCity instances) in order.
	"""
	iX1, iY1 = tCoords1
	iX2, iY2 = tCoords2
	for iX in range(iX1, iX2 + 1):
		for iY in range(iY1, iY2 + 1):
			pPlot = Map.plot(iX, iY)
			pCity = pPlot.getPlotCity()
			if pCity != None:			
				yield pCity

def isPlayerCity(pCity, ePlayer):
	"""
	Returns True if pCity belongs to ePlayer. Otherwise returns False.
	"""
	if pCity.getOwner() == ePlayer:
		return True
	else:
		return False

def isAreaOwner(ePlayer, tCoords1, tCoords2):
	"""
	Returns True if all cities in the area defined by tCoords1 and 
	tCoords2 belong to ePlayer. Otherwise returns False.
	"""
	for pCity in findAreaCities(tCoords1, tCoords2):
		if not pCity.isPlayerCity(pCity, ePlayer):
			return False
	return True

def spawnAreaCityUnits(ePlayer, tCoords1, tCoords2, eUnitType, iNumUnits)
	"""
	Spawns iNumUnits units of eUnitType for ePlayer in all cities 
	in the area defined by tCoords.
	"""
	for pCity in findAreaCities(tCoords1, tCoords2):
		tCoords = getCoords(pCity)
		spawnUnits(ePlayer, eUnitType, tCoords, iNumUnits)

#def findPlayerAreaCities(tCoords1, tCoords2, ePlayer):
#    for pCity in findAreaCities(tCoords1, tCoords2):
#        if isPlayerCity(pCity, ePlayer) == True:
#            yield pCity


it is missing some helpful functions.... Oh before I forget, You didn't send me any sort of referance to Senates?

do we need mod settings anymore? Because I have one and you didn't send one...
 
Oh, its hard to compare so I hope you can manage to get everything organized yourself. :blush: But you should keep adding stuff to the module anyway, so why not start now?

Regarding the Mission class for your Senate module, I'll get to that once I have the time. I thought you'd be busy celebrating New Years and also testing the present Python work. Because there is a lot of it to test at this point! So I'm sorta counting on you to supply me with bugs to fix, exceptions to decipher and so on for the immediate future. Because none of it has been tested in a real game situation and some of it might even need to be redone completely... :p

So we have jobs, both of us, as is. Lets just worry about the next addition (written by you) once we know what we have and whether or not its behaving. At all.
 
oh I am currenly modifing the EventManager, merging CustomFunctions with Helpers, making sure Utils corresponds to eNums. And modifing ModEvents to correspond with the renames! Then I will test, tweak, test ect... (including a full game for byzantium... ugh)
 
No, you don't use Utils anymore. Everything is in Helpers and eNums.

Or did you mean that you're making sure I didn't mess anything up? :D

By the way, the PlayerType eNums shouldn't really be necessary since your mod uses CivPlayer... But its your mod I didn't dare to delete all traces of your own work. :p
 
ok! yes I am checking to see if you messed anything up :p

Do you still need modsettings or are they contained inside the relative modules?
 
ModSettings is also history - this was your request, right?
 
ok about to start testing! added the randomevent thing. checked eNums (well done, no mistakes!)
merged Helpers and Custum Functions. changed referenced to CustomFunctions and Utils from anywhere...
 
Good luck! :goodjob:
 
iRequiredRebellionCitySize = 3
iRebelReinforcementPercentage = 90
iNumRebelReinforcements = 1
iCulturalRebellionPercentage = 75
iResistancePercentage = 100
iResistanceDomesticPercentage = 50
iResistanceDomesticTurns = 2
iDomesticRebellionPercentage = 60
iCivilizedPercentageSubtract = 5
iCapitalHappinessPenalty = 2
iMinorRevoltPercentage = 8
iCivilWarPercentage = 5
iCivilWarUnhappyCitiesPercentage = 30
iRequiredNumCivilWarCities = 6
iRequiredNumCivilWarUnhappiness = 2
iCivilWarRebelArmySize = 6
iSlaveRevoltDenominator = 10
iNumSlaveUnitsPerCitizen = 3
tByzantion = (46, 23)
byzansCapital = "Constantinople"
iByzansRebelArmySize = iCivilWarRebelArmySize

these are the new settings for now!

Was I meant to give the rebels their own island and we were going to kill them on rebellion? did that happen?

....99 population! oh well I guess they will just starve back down again :p (looking though byzantium code... for termination year)
 
Was I meant to give the rebels their own island and we were going to kill them on rebellion? did that happen?
If you wanna get rid of those messages - add the rebel island(s). Whether or not we need to kill those units off later remains to be seen...
 
....99 population! oh well I guess they will just starve back down again :p (looking though byzantium code... for termination year)
No, thats not for changing/setting actual city size or anything. Its just to have a really high number to compare the other Roman cities size's. So that Byzantion will always be counted as the largest city - the new capital.

edit: "termination year"? :confused: Its a civil war, right? And those would be evil as to never end, right?
 
off course they must be killed... if not then the rebels would never die... therefore their diplomacy could never be reset... It's a chain reaction. Anyway where does it say when byzantium is meant to happen (it is a set event in time... I believe the year is 1600ad

also where does it say that all cities within xa, ya and xb, yb should be fliped? I believe my break has messed with my logic a little :lol:
 
off course they must be killed... if not then the rebels would never die... therefore their diplomacy could never be reset... It's a chain reaction.
No, things can be reset whether or not players are alive or not. Its not an issue - unless actual play testing proves otherwise.
Anyway where does it say when byzantium is meant to happen (it is a set event in time... I believe the year is 1600ad
You have to make this happen yourself - I already posted the statement that fires the rebellion code. You of course script this into your ModEvents module. :king:
 
see end line of last post.

where did you post the statement?
 
also where does it say that all cities within xa, ya and xb, yb should be fliped? I believe my break has messed with my logic a little :lol:
You supply the cities with the lDefectingCities argument. I think I already gave you all the helper functions for this, not?

So its not part of the Rebellion module - you have to do this part in ModEvents.

where did you post the statement?
Here.

I'm on om my way out the door - talk to you later. And have a Happy New Year! :king:
 
thanks you too!

I found them lol

And you fire the event from ModEvents with this statement:

Code:
EastRomanEmpire.initCivilWar(Civ("Rome"), lDefectingCities)The trick, of course, is to compile the lDefectingCities array holding all Roman cities in the east.

Code:
lDefectingCities = getPlayerAreaCities(tERE1, tERE2, eRome)You of course need to import the EastRomanEmpire class from the Rebellion module in order to be able to access it:

Code:
from Rebellion import EastRomanEmpire

so I can handle this from here (untill I do the marius and get stumped by today's lack of logical thinking...)
 
Back
Top Bottom