Requesting following features

I am not sure what the city flip eligiblity should be... unhappiness is too unreliable..
however it makes sense... maybee a conditional statement for example:

if *there are enough unhappy cities*:
(...)
else:
((getNumCities / 100) * 25) * cities* with the least population # if rome has 20 cities /100 = 0.2 * 25 is both 25% of their overall cities and 5 cities and then the 5 cities lowest in pop get fliped
 
how would that be done exactly......? wow today is a confusing day :rolleyes:
 
You could basically look at the beginning of the Rebellion module for how the default Civil War stuff is done. You could basically copy it, even if I strongly recommend you actually write the code yourself (no copy-paste nonsense) and thereby understand everything you're doing.

Do I need to point out exactly what code I'm referring to?
 
probably... Though I think I know...

I came up with this reward random pointer which looks like this:
if Reward == None:
if random >= 0 and random <= 11:
pass #gold
if random >= 12 and random <= 23:
pass #unit
if random >= 24 and random <= 35:
pass #golden
if random >= 36 and random <= 47:
pass #happy
if random >= 48 and random <= 59:
random being getRandNum(100)

will this work?
edit uses elifs whoops seriously today is not wroking for me
 
That logic could be simplified, but sure.
Spoiler :
Start from the back and look if random is > 47, then look for > 35, then > 23 and finally just a "else".

I'd probably make up some elaborate setup just to avoid an ugly if-tree. :D Just for the fun of it.
 
ok so I have these:
Code:
                    if self.Reward == None:
                        if random >= 0 and random <= 11:
                            pass #gold
                        elif random >= 12 and random <= 23:
                            pass #unit
                        elif random >= 24 and random <= 35:
                            pass #golden
                        elif random >= 36 and random <= 47:
                            pass #happy
                        elif random >= 48 and random <= 59:
                            pass #upgrade
                        elif random >= 60 and random <= 71:
                            pass #build
                        elif random >= 72 and random <= 83:
                            pass #civic
                        elif random >= 84 and random <= 95:
                            pass #tech
                        else:
                            pass #city gift
                    else:
                        if self.Reward == 1:
                            pass #gold
                        elif self.Reward == 2:
                            pass #unit
                        elif self.Reward == 3:
                            pass #golden
                        elif self.Reward == 4:
                            pass #happy
                        elif self.Reward == 5:
                            pass #upgrade
                        elif self.Reward == 6:
                            pass #build
                        elif self.Reward == 7:
                            pass #civic
                        elif self.Reward == 8:
                            pass #tech
                        else:
                            pass #city gift
I was thinking of making them into functions but not sure how it would would...

for example
Code:
if self.Reward == None:
    getRandReward(self.Reward)

def getRandReward(Reward):
    random = getRandNum(100)
    if random >= 0 and random <= 11:
        Gold(1000, eRome)
    elif random >= 12 and random <= 23:
        pass #unit
    elif random >= 24 and random <= 35:
        pass #golden
    elif random >= 36 and random <= 47:
        pass #happy
    elif random >= 48 and random <= 59:
        pass #upgrade
    elif random >= 60 and random <= 71:
        pass #build
    elif random >= 72 and random <= 83:
        pass #civic
    elif random >= 84 and random <= 95:
        pass #tech
    else:
        pass #city gift
would that actually work?
and will random be the same EVERY time or will it change every time the function is called?
 
This is the code I mentioned:
Code:
def checkRebellion(iGameTurn):
    pCivPlayer = instance((iGameTurn + iRandomSeed) % iNumMajorPlayers)
    if not pCivPlayer.isAlive(): return
    [B]lCities = pCivPlayer.get(PyPlayer).getCityList()
    lCities.reverse()
    lDefectingCities = list()
    iNumCities = len(lCities)
    bCivilWarValid = iNumCities >= iRequiredNumCivilWarCities
    for pCity in (city.GetCy() for city in lCities):
        if not isRebellionValid(pCity): continue[/B]
        if checkClasses(pCity, pCivPlayer): return
        [B]if ( bCivilWarValid
             and not CivilWar.isQuota(len(lDefectingCities), iNumCities)
             and CivilWar.checkUnhappiness(pCity) ):
            lDefectingCities.append(pCity)
    if ( bCivilWarValid
         and CivilWar.checkConditions(len(lDefectingCities), iNumCities) ):
        CivilWar.initCivilWar(pCivPlayer, lDefectingCities)[/B]
What I'm proposing is that you write your own script for getting the CyCity instances you need for the Senate Mission penalties. You can basically skip the bCivilWarValid boolean and use the boolean statement directly in your code. But the exact logic is up to you.

Look at the code above and try to figure out exactly how it works. If you see unfamiliar function calls you should be able to look those up yourself and see what they do/return.
 
ok I will look at it and get back to you, dont forget to read the previous post!
 
would that actually work?
and will random be the same EVERY time or will it change every time the function is called?
Yeah, you got it. And what would be the point of fetching a random number if it is the same every time? :crazyeye:

With that said, you could express the same logic as:
Spoiler :
Code:
def grantRandReward(iReward):
	iRandom = getRandNum(100)
	if iRandom > 95:
		pass #city gift
	elif iRandom > 83:
        	pass #tech
	elif iRandom > 71:
        	pass #civic
	elif iRandom > 59:
        	pass #build
	elif iRandom > 47:
        	pass #happy
	elif iRandom > 35:
        	pass #golden
	elif iRandom > 23:
        	pass #unit
	else:
		Gold(1000, eRome)
 
this is the current class:
Spoiler :

Code:
from eNums import *
from Helpers import *
from Rebellion import *
#Constants#
MainHeader = "Senate Feature"
MainMessage = "This feature is specifically for Rome and gives them missions which can result in\
rewards or penalties. There are various different missions and conditions"
SenateHeader = "Senate"

## main functions
def getRandReward():
    random = getRandNum(100)
    if random >= 0 and random <= 11:
        Gold(1000, eRome)
    elif random >= 12 and random <= 23:
        Unit(ePraetorian, getCapital(eRome), 2)
    elif random >= 24 and random <= 35:
        GoldenAge(6)
    elif random >= 36 and random <= 47:
        pass #happy
    elif random >= 48 and random <= 59:
        pass #upgrade
    elif random >= 60 and random <= 71:
        pass #build
    elif random >= 72 and random <= 83:
        pass #civic
    elif random >= 84 and random <= 95:
        pass #tech
    else:
        pass #city gift
def getReward(Reward, iReward):
    if Reward == 1:
        Gold(iReward, eRome)
    elif Reward == 2:
        Unit(ePraetorian, getCapital(eRome), iReward)
    elif Reward == 3:
        GoldenAge(iReward)
    elif Reward == 4:
        pass #happy
    elif Reward == 5:
        pass #upgrade
    elif Reward == 6:
        pass #build
    elif Reward == 7:
        pass #civic
    elif Reward == 8:
        pass #tech
    else:
        pass #city gift
def getPenalty(Penalty, iPenalty):
    if Penalty == 1:
        GoldDeduct(iPenalty, eRome)
    elif Penalty == 2:
        RebelUnit(eSwordsman, "add rome radius", iPenalty)
    elif Penalty == 3:
        pass #unhappy
    elif Penalty == 4:
        pass #dest
    elif Penalty == 5:
        pass #anarchy
    else:
        CivilWar()


# rewards

def Gold(iChange, ePlayer):
    giveGold(iChange, ePlayer)
def Unit(eUnitType, tCoords, iNum):
    spawnUnits(eRome, eUnitType, tCoords, iNum)
def GoldenAge(iTurns):
    giveGoldenAge(eRome, iTurns)
def Happy():
    pass
def UpgradeBuild():
    pass
def Build():
    pass
def FreeCivic():
    pass
def FreeTech():
    pass
def CitySelect():
    pass

# penalties
def GoldDeduct(iChange, ePlayer):
    giveGold(-iChange, ePlayer)
def RebelUnit(eUnitType, tCoords, iNum):
    spawnUnits(eItalianRebels, eUnitType, tCoords, iNum)
def Unhappy():
    pass
def BuildingDest():
    pass
def Anarchy():
    pass
def CivilWar():
    STD = False #add standard conditioning
    if STD:
        lCities = 
        CivilWar.initCivilWar(instance("Rome"), lCities)
    else:
        lCities = 
        CivilWar.initCivilWar(instance("Rome"), lCities)
    
## data storage
def increaseMissionCounter():
    iMissionCounter = getGlobalData("iMissionCounter")
    setGlobalData("iMissionCounter", iMissionCounter + 1)

## classes

class Mission: #simple take city, like byzantium prompt
    def __init__(self, tCityCoords, Message1, Message2, ePlayer, Message3, MessageHold, iStartYear = None, iEndYear = None\
                 , Reward = None, Penalty = None, iReward = None, iPenalty = None)
        self.tCityCoords = tCityCoords
        self.iReward = iReward
        self.iPenalty = iPenalty
        self.Message1 = Message1
        self.Message2 = Message2
        self.Player = ePlayer
        self.Message3 = Message3
        self.MessageHold = MessageHold
        self.Start = iStartYear
        self.End = iEndYear
        self.Reward = Reward
        self.Penalty = Penalty
        self.iReward = iReward
        self.iPenalty = iPenalty
    def Condition(self):
        if not self.Start and self.End == None:
            if isDate(self.Start):
                if isPlotOwner(self.tCityCoords, self.eRome) == False and isPlotCity(self.tCityCoords) == True:
                   showPopup(SenateHeader, self.Message1)
                else:
                    Hold().Condition() #add parameters here
            elif isDate(self.End):
                if isPlotOwner(self.tCityCoords, self.ePlayer) and isPlotCity(self.tCityCoords):
                    showPopup(SenateHeader, self.Message2)
                    if self.Reward == None:
                        getRandReward()
                        increaseMissionCounter()
                    else:
                        getReward(self.Reward, self.iReward)
                        increaseMissionCounter()
                else:
                    showPopup(SenateHeader, self.Message3)
                    if self.Penalty == None:
                        pass #getRandPenalty()
                    else:
                        getPenalty(self.Penalty, self.iPenalty)
                        
        else:
            pass #this is for if no date is defined for the event
                            
                        
                
                    
class Wonder(Mission):
class AreaControl(Mission):
class CivicChange(Mission):
class Peace(Mission):
class War(Mission):
class ExpandMelee(Mission):
class ExpandNavy(Mission):
class Hold(Mission):

##pre-defined missions
#Byzantium Prompt
iByzantiumStartYear = 1050
iByzantiumEndYear = 1350
iByzantiumGold = 1000
iByzantiumPenalty = 0
byzantiumMessage1 = "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"
byzantiumMessage2 = "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!"
tByzantium = (46, 23)

Byzantium = Mission(tByzantium, byzantiumMessage1, "insert success message here", eRome, "insert fail message here", byzantiumMessage2, iByzantiumStartYear, iByzantiumEndYear, 1, 1, iByzantiumGold, iByzantiumPenalty)
Byzantium.Condition()

#date
#wonder built
#peace
#war
#military deficiency
#naval deficiency
#not owning area + date (could be ran)
#city not owned + date

#misc senate relation
def gloriusAchieve():
    tAfricaCoords1 = (0, 0)
    tAfricaCoords2 = (0, 0)
    tBritonCoords1 = (0, 0)
    tBritonCoords2 = (0, 0)
    tGaulCoords1 = (0, 0)
    tGaulCoords2 = (0, 0)
    tIberiaCoords1 = (0, 0)
    tIberiaCoords2 = (0, 0)
    tGermaniaCoords1 = (0, 0)
    tGermaniaCoords2 = (0, 0)
    tGreeceCoords1 = (0, 0)
    tGreeceCoords2 = (0, 0)
    tEgyptCoords1 = (0, 0)
    tEgyptCoords2 = (0, 0)
    
    iDates = 3800 or 3000 or 0 #to be edited
    if isDate(iDates):
        if isAreaOwner(eRome, tAfricaCoords1, tAfricaCoords2) == True:
            print "acheive africa at: "#, getDate()
        elif isAreaOwner(eRome, tBritonCoords1, tBritonCoords2) == True:
            print "acheive briton at: "#, getDate()
        elif isAreaOwner(eRome, tGaulCoords1, tGaulCoords2) == True:
            print "acheive gaul at: "#, getDate()
        elif isAreaOwner(eRome, tIberiaCoords1, tIberiaCoords2) == True:
            print "acheive spain at: "#, getDate()
        elif isAreaOwner(eRome, tGermaniaCoords1, tGermaniaCoords2) == True:
            print "acheive germania at: "#, getDate()
        elif isAreaOwner(eRome, tGreeceCoords1, tGreeceCoords2) == True:
            print "acheive greece at: "#, getDate()
        elif isAreaOwner(eRome, tEgyptCoords1, tEgyptCoords2) == True:
            print "acheive egypt at: "#, getDate()
        else:
            print "no acheive at: "#, getDate()

224 lines, getting pretty big...

any comments/errors/anything you would like to say/add?

is the GloriusAchieve() function ok?

edit:
found these in the api:
#VOID setBuildingProduction (BuildingType iIndex, INT iNewValue)
#void (BuildingID, iNewValue) - set progress towards BuildingID as iNewValue


#VOID setBuildingProductionTime (BuildingType eIndex, INT iNewValue)
#int (int eIndex, int iNewValue)


#VOID setBuildingYieldChange (BuildingClassType eBuildingClass, YieldType eYield, INT iChange)


#VOID setBuildingCommerceChange (BuildingClassType eBuildingClass, CommerceType eCommerce, INT iChange)
#void (int /*BuildingClassTypes*/ eBuildingClass, int /*CommerceTypes*/ eCommerce, int iChange)


#VOID setBuildingHappyChange (BuildingClassType eBuildingClass, INT iChange)
#void (int /*BuildingClassTypes*/ eBuildingClass, int iChange)


#VOID setBuildingHealthChange (BuildingClassType eBuildingCla
# eBuildingClass, INT iChange)
#INT getNumMilitaryUnits ()
#int ()

#INT getUnitClassCount (UnitClassType eIndex)
#int (int (UnitClassTypes) eIndex
# BOOL isHasCivicOption (CivicOptionType eIndex)
#bool (int (CivicOptionTypes) eIndex)


# VOID setCivics (CivicOptionType eIndex, CivicType eNewValue)
#void (int iCivicOptionType, int iCivicType) - Used to forcibly set civics with no anarchy

I will probs need help setting up the more advanced reward functions but it should be fine...can't find anything for changing cities happiness...
 
I haven't looked at the code more closely, but I've included methods for changing happiness to PyScenario. (API - see the output() and yields() methods.) So you could look up how I did it in the PyScenario module. :D

Regarding specifically gloriusAchieve(), you could define those coordinates as constants on module level, instead of inside the function. Because they will be defined every time the function is called, which... isn't called for. Also, it should surely be possible to achieve several of those control area conditions at the same time? So you should turn those elif:s and the else to regular if statements. Because then they can potentially all be valid once the function is checked.
 
I could find the methods but not the code itself can you post it here?

also how would the free civic change and free tech be done? I just need help with those functions atm...
and of course the conditions themselves I have no clue on:
#wonder built
#peace
#war
#military deficiency
#naval deficiency
#not owning area + date (could be rand)
#city not owned + date
I am just not with it this week :D

full class:
Spoiler :

Code:
from eNums import *
from Helpers import *
from Rebellion import *
#Constants#
MainHeader = "Senate Feature"
MainMessage = "This feature is specifically for Rome and gives them missions which can result in\
rewards or penalties. There are various different missions and conditions"
SenateHeader = "Senate"
tAfricaCoords1 = (0, 0)
tAfricaCoords2 = (0, 0)
tBritonCoords1 = (0, 0)
tBritonCoords2 = (0, 0)
tGaulCoords1 = (0, 0)
tGaulCoords2 = (0, 0)
tIberiaCoords1 = (0, 0)
tIberiaCoords2 = (0, 0)
tGermaniaCoords1 = (0, 0)
tGermaniaCoords2 = (0, 0)
tGreeceCoords1 = (0, 0)
tGreeceCoords2 = (0, 0)
tEgyptCoords1 = (0, 0)
tEgyptCoords2 = (0, 0)
    

## main functions
def getRandReward():
    random = getRandNum(100)
    if random >= 0 and random <= 11:
        Gold(1000, eRome)
    elif random >= 12 and random <= 23:
        Unit(ePraetorian, getCapital(eRome), 2)
    elif random >= 24 and random <= 35:
        GoldenAge(6)
    elif random >= 36 and random <= 47:
        pass #happy
    elif random >= 48 and random <= 59:
        pass #upgrade
    elif random >= 60 and random <= 71:
        pass #build
    elif random >= 72 and random <= 83:
        pass #civic
    elif random >= 84 and random <= 95:
        pass #tech
    else:
        pass #city gift
def getRandDate():
    random = getRandNum(100)
    if random >= 0 and random <= 9:
        date = #add date type
    elif random >= 10 and random <= 9:
        date = #add date type
    elif random >= 20 and random <= 29:
        date = #add date type
    elif random >= 30 and random <= 39:
        date = #add date type
    elif random >= 40 and random <= 49:
        date = #add date type
    elif random >= 50 and random <= 59:
        date = #add date type
    elif random >= 60 and random <= 69:
        date = #add date type
    elif random >= 70 and random <= 79:
        date = #add date type
    elif random >= 80 and random <= 89:
        date = #add date type
    else:
        date = #add date type
    return date
def getRandEndDate():
    random = getRandNum(100)
    if random >= 0 and random <= 9:
        enddate = #add date type
    elif random >= 10 and random <= 9:
        enddate = #add date type
    elif random >= 20 and random <= 29:
        enddate = #add date type
    elif random >= 30 and random <= 39:
        enddate = #add date type
    elif random >= 40 and random <= 49:
        enddate = #add date type
    elif random >= 50 and random <= 59:
        enddate = #add date type
    elif random >= 60 and random <= 69:
        enddate = #add date type
    elif random >= 70 and random <= 79:
        enddate = #add date type
    elif random >= 80 and random <= 89:
        enddate = #add date type
    else:
        enddate = #add date type
    return date
def getReward(Reward, iReward):
    if Reward == 1:
        Gold(iReward, eRome)
    elif Reward == 2:
        Unit(ePraetorian, getCapital(eRome), iReward)
    elif Reward == 3:
        GoldenAge(iReward)
    elif Reward == 4:
        pass #happy
    elif Reward == 5:
        pass #upgrade
    elif Reward == 6:
        pass #build
    elif Reward == 7:
        pass #civic
    elif Reward == 8:
        pass #tech
    else:
        pass #city gift
def getPenalty(Penalty, iPenalty):
    if Penalty == 1:
        GoldDeduct(iPenalty, eRome)
    elif Penalty == 2:
        RebelUnit(eSwordsman, "add rome radius", iPenalty)
    elif Penalty == 3:
        pass #unhappy
    elif Penalty == 4:
        pass #dest
    elif Penalty == 5:
        pass #anarchy
    else:
        CivilWar()


# rewards

def Gold(iChange, ePlayer):
    giveGold(iChange, ePlayer)
def Unit(eUnitType, tCoords, iNum):
    spawnUnits(eRome, eUnitType, tCoords, iNum)
def GoldenAge(iTurns):
    giveGoldenAge(eRome, iTurns)
def Happy():
    pass
def UpgradeBuild():
    pass
def Build():
    pass
def FreeCivic():
    pass
def FreeTech():
    pass
def CitySelect():
    pass

# penalties
def GoldDeduct(iChange, ePlayer):
    giveGold(-iChange, ePlayer)
def RebelUnit(eUnitType, tCoords, iNum):
    spawnUnits(eItalianRebels, eUnitType, tCoords, iNum)
def Unhappy():
    pass
def BuildingDest():
    pass
def Anarchy():
    pass
def CivilWar():
    STD = False #add standard conditioning
    if STD:
        lCities = 
        CivilWar.initCivilWar(instance("Rome"), lCities)
    else:
        lCities = 
        CivilWar.initCivilWar(instance("Rome"), lCities)
    
## data storage
def increaseMissionCounter():
    iMissionCounter = getGlobalData("iMissionCounter")
    setGlobalData("iMissionCounter", iMissionCounter + 1)

## classes

class Mission: #simple take city, like byzantium prompt
    def __init__(self, tCityCoords, Message1, Message2, ePlayer, Message3, MessageHold, iStartYear = None, iEndYear = None\
                 , Reward = None, Penalty = None, iReward = None, iPenalty = None)
        self.tCityCoords = tCityCoords
        self.iReward = iReward
        self.iPenalty = iPenalty
        self.Message1 = Message1
        self.Message2 = Message2
        self.Player = ePlayer
        self.Message3 = Message3
        self.MessageHold = MessageHold
        self.Start = iStartYear
        self.End = iEndYear
        self.Reward = Reward
        self.Penalty = Penalty
        self.iReward = iReward
        self.iPenalty = iPenalty
    def Condition(self):
        if not self.Start and self.End == None:
            if isDate(self.Start):
                if isPlotOwner(self.tCityCoords, self.ePlayer) == False and isPlotCity(self.tCityCoords) == True:
                   showPopup(SenateHeader, self.Message1)
                else:
                    Hold().Condition() #add parameters here
            elif isDate(self.End):
                if isPlotOwner(self.tCityCoords, self.ePlayer) and isPlotCity(self.tCityCoords):
                    showPopup(SenateHeader, self.Message2)
                    if self.Reward == None:
                        getRandReward()
                        increaseMissionCounter()
                    else:
                        getReward(self.Reward, self.iReward)
                        increaseMissionCounter()
                else:
                    showPopup(SenateHeader, self.Message3)
                    if self.Penalty == None:
                        pass #getRandPenalty()
                    else:
                        getPenalty(self.Penalty, self.iPenalty)
                        
        else:
            if isDate(getRandDate):
                if isPlotOwner(getRandCoords, self.ePlayer) == False and isPlotCity(getRandCoords) == True:
                    showPopup(SenateHeader, "The Senate requests you take the city of %s1!")
                else:
                    Hold().Condition()
            elif isDate(getRandEndDate):
                if isPlotOwner(getRandCoords, self.eRome) and isPlotCity(getRandCoords):
                    showPopup(SenateHeader, "you have succeeded in your mission!")
                    getRandReward()
                    increaseMissionCounter()
                else:
                    showPopup(SenateHeader, "you have failed the senate!")
                    pass #getRandPenalty()
                
                              
                
                            
                        
                
                    
class Wonder(Mission):
class AreaControl(Mission):
class CivicChange(Mission):
class Peace(Mission):
class War(Mission):
class ExpandMelee(Mission):
class ExpandNavy(Mission):
class Hold(Mission):

##pre-defined missions
#Byzantium Prompt
iByzantiumStartYear = 1050
iByzantiumEndYear = 1350
iByzantiumGold = 1000
iByzantiumPenalty = 0
byzantiumMessage1 = "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"
byzantiumMessage2 = "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!"
tByzantium = (46, 23)

Byzantium = Mission(tByzantium, byzantiumMessage1, "insert success message here", eRome, "insert fail message here", byzantiumMessage2, iByzantiumStartYear, iByzantiumEndYear, 1, 1, iByzantiumGold, iByzantiumPenalty)
Byzantium.Condition()

#date
#wonder built
#peace
#war
#military deficiency
#naval deficiency
#not owning area + date (could be rand)
#city not owned + date

#misc senate relation
def gloriusAchieve():
    iDates = 3800 or 3000 or 0 #to be edited
    if isDate(iDates):
        if isAreaOwner(eRome, tAfricaCoords1, tAfricaCoords2) == True:
            print "acheive africa at: "#, getDate()
        if isAreaOwner(eRome, tBritonCoords1, tBritonCoords2) == True:
            print "acheive briton at: "#, getDate()
        if isAreaOwner(eRome, tGaulCoords1, tGaulCoords2) == True:
            print "acheive gaul at: "#, getDate()
        if isAreaOwner(eRome, tIberiaCoords1, tIberiaCoords2) == True:
            print "acheive spain at: "#, getDate()
        if isAreaOwner(eRome, tGermaniaCoords1, tGermaniaCoords2) == True:
            print "acheive germania at: "#, getDate()
        if isAreaOwner(eRome, tGreeceCoords1, tGreeceCoords2) == True:
            print "acheive greece at: "#, getDate()
        if isAreaOwner(eRome, tEgyptCoords1, tEgyptCoords2) == True:
            print "acheive egypt at: "#, getDate()
        else:
            print "no acheive at: "#, getDate()

those random conditions are pretty difficult...
I get the feeling somethign won't work can you check the intire Mission class and the rand functions please?

I am not really sure now to make the random missions happen it is all a llittle overwhelming right now :D
 
I'll get back to you another day.

How is testing going otherwise? Did my fix solve the catapult construction bug?
 
Well... I distinctly remember checking the logs and seeing valid catapult constructors and there were no errors in game while I was fighting gaul so until I actually see one I must presume so :D
 
mmm sorry to bother your hard earned reading of other things (:D) but can I ask what you are getting back to me on and also when is the mysterious other day of which you speak?
 
:lol: I started up my PC for the first time today just an hour ago, and right now I'm pretty much already counting sheep. I might get some time tomorrow though, but do keep reminding me if the shortness of my attention span gets the better of me. :D
 
Yeah, I'll try to go up early and make sure the reply is worth the wait :D
 
I could find the methods but not the code itself can you post it here?
This is the ChangeYields class from PyScenario:
Spoiler :
Code:
class ChangeYields(Spawn):

        def __init__(self, *args): #iFood, iProduction, iCommerce, iHappiness, iHealth):
                self.food, self.production, self.commerce, self.happiness, self.health = args

        def fire(self, pContext):
                self.setKeys(pContext)
                pContext.debug(("ChangeYields.fire()", self.food, self.production, self.commerce, self.happiness, self.health, \
                                "Context:", pContext.player, pContext.coords), {"CyPlot":True, "CyCity":True, "plotList":True})
                if isValid(pContext.plotList):
                        for tCoords in pContext.plotList:
                                pPlot = getPlot(tCoords)
                                if checkPlotCityOwner(pContext.player, pPlot):
                                        self.changeYields(pPlot.getPlotCity())
                elif pContext.CyCity:
                        self.changeYields(pContext.CyCity)
                elif pContext.CyPlot:
                        if checkPlotCityOwner(pContext.player, pContext.CyPlot):
                                self.changeYields(pContext.CyPlot.getPlotCity())
                elif isValid(pContext.player):
                        for city in PyPlayer(pContext.player).getCityList():
                                self.changeYields(city.GetCy())

        def changeYields(self, pCity):
                if self.food != None:
                        pCity.changeBaseYieldRate(0, self.food)
                if self.production != None:
                        pCity.changeBaseYieldRate(1, self.production)
                if self.commerce != None:                        
                        pCity.changeBaseYieldRate(2, self.commerce)
                if self.happiness != None:
                        [B]pCity.changeExtraHappiness(self.happiness)[/B]
                if self.health != None:
                        pCity.changeExtraHealth(self.health)
Note that ChangeYields is a sub-class of the Spawn class, which in turn is a sub-class of the Action class. And all Action based classes have a fire() method - and all the Condition based classes have a check() method. The other method is where the actual action takes place (highlighted).

also how would the free civic change and free tech be done? I just need help with those functions atm...
I included this helper in Glory & Greatness:
Spoiler :
Code:
def giveFreeTech(pPlayer, header=freeTechMessage):
        if pPlayer.isHuman():
                pPlayer.chooseTech(1, header, False)
        else:
                pPlayer.AI_chooseFreeTech()
Note that the freeTechMessage string needs to be defined as a constant.

Regarding the free civic change I'm not sure - how would it work? Would the player get to choose or is the Senate deciding on the civic? There is a CyPlayer.setCivics() method however. Look it up.

and of course the conditions themselves I have no clue on:
#wonder built
#peace
#war
#military deficiency
#naval deficiency
#not owning area + date (could be rand)
#city not owned + date
I am just not with it this week :D
Right now you're utilizing the beginGameTurn or endGameTurn callback in the Event Manager, right? You wanna make a senate mission happen once one of those game events take place, right? The available game events are found here. So I'd suggest hooking up with cityBuildingBuilding for the wonder, changeWar for the peace/war, combatResult on the defiencies. And you already did the area/city owned, right? (Because those would be checked on a turn-to-turn basis - if the date matches then the code looks for the ownership condition.)

those random conditions are pretty difficult...
I get the feeling somethign won't work can you check the intire Mission class and the rand functions please?
What seems to be the problem then?

I am not really sure now to make the random missions happen it is all a llittle overwhelming right now :D
You probably don't wanna have a random starting date and a random ending date. Start with the random starting date already at the __init__() method, because it should only be defined once. And then you add either a static number - - or a random number - of turns/years from the starting date.

See if you can't figure it out. :D
 
ok thanks for the free tech things, what should I do with the changeYeild class provided just look at the code and figure something out?

the civic swap could work on a a return basis, the player gets a popup asking which civic it wants to swap to and that is then returned to the code and encorporated into the changeCivic method :D

There isn't a problem as such as I have not hooked up the code at all yet :p just want to make sure what I have done is all correct

I see what you mean about the starting and ending dates, I will see if I can work it out

what is the args list exactly I have always wondered about it and never thought to ask...

I will look a bit more into the conditions and callbacks before coming back here (which is inevitable :p)
 
Back
Top Bottom