Possible new Mod-making Slavery-and Serfdom more Interesting

Joined
Jul 21, 2003
Messages
7,819
Location
Adelaide, South Australia
Hi guys.

OK, my key concern is that Slavery-from my experience-has been of precious little use to me in many of my games. In fact, most times I simply stay in Tribalism until I get serfdom. Now, this seems a little wierd given the VERY important role slavery has played in our society-even until the modern age.

So, the first part of making Slavery more interesting is by introducing a new 'Specialist'-The Slave. Now my thought was that the slave generates +1 food, hammers and gold (slave trading), but reduces culture commerce. So this bit is very easy to do, as it simply requires a change to the SpecialistInfo.xml file.
The other thing, though, is that the slave should only be available when you are under the slavery civic.
Now, this is where things get HARD. You see, in order to limit slaves to the slavery civic is via python.
So what I want to do SOUNDS simple enough. Either at the beginning or end of the turn, I want the computer to check the player's labour civic setting and, if it equals 'Slavery', then it will change the # of Free Slave Specialists from 0 to 1. This is VERY important, as I want the slave to be in ADDITION to your normal population. So, the question is-does anyone have any idea how this can be done? I am open to all suggestions.
In the meantime, I plan to keep pouring over the tutorials and see if I can glean the info I need from them. After all, if python will let you add a whole new religion, unit or even city to the game, then surely it must be possible to add a simple specialist!

Yours,
Aussie_Lurker.
 
u can check out great library wonder, when its built, it puts 2 free scientist in the city, but listed at the bottom with great people.
 
Couldn't you just make it like the caste system, except unlimited slaves, and then have no other building or civic allowing them?
 
Aussie_Lurker said:
Hi guys.

OK, my key concern is that Slavery-from my experience-has been of precious little use to me in many of my games. In fact, most times I simply stay in Tribalism until I get serfdom. Now, this seems a little wierd given the VERY important role slavery has played in our society-even until the modern age.

So, the first part of making Slavery more interesting is by introducing a new 'Specialist'-The Slave. Now my thought was that the slave generates +1 food, hammers and gold (slave trading), but reduces culture commerce. So this bit is very easy to do, as it simply requires a change to the SpecialistInfo.xml file.
The other thing, though, is that the slave should only be available when you are under the slavery civic.
Now, this is where things get HARD. You see, in order to limit slaves to the slavery civic is via python.
So what I want to do SOUNDS simple enough. Either at the beginning or end of the turn, I want the computer to check the player's labour civic setting and, if it equals 'Slavery', then it will change the # of Free Slave Specialists from 0 to 1. This is VERY important, as I want the slave to be in ADDITION to your normal population. So, the question is-does anyone have any idea how this can be done? I am open to all suggestions.
In the meantime, I plan to keep pouring over the tutorials and see if I can glean the info I need from them. After all, if python will let you add a whole new religion, unit or even city to the game, then surely it must be possible to add a simple specialist!

Yours,
Aussie_Lurker.

Possible and done:

In CvEventManager.py

In def onBeginPlayerTurn(self, argsList):

Code:
	def onBeginPlayerTurn(self, argsList):
		'Called at the beginning of a players turn'
		iGameTurn, iPlayer = argsList

		player = gc.getActivePlayer()
		if (player.isCivic(gc.getInfoTypeForString("CIVIC_SLAVERY"))):
			for i in range(player.getNumCities()):
				player.getCity(i).setFreeSpecialistCount(gc.getInfoTypeForString("SPECIALIST_ARTIST"), 1)
		else:
			for i in range(player.getNumCities()):
				player.getCity(i).setFreeSpecialistCount(gc.getInfoTypeForString("SPECIALIST_ARTIST"), 0)

tested this and it works, just replace "SPECIALIST_ARTIST" with "SPECIALIST_SLAVE" (or whatever the name of your specialist is)

Hope this helps!
 
I have a unit called 'the slave gang' in my own mod; works at half-speed, costs a quarter of what a regular worker does, can't be upgraded. However, I'm still perplexed as to how one limits units to a specific civic. Where do you set the flag?

Max
 
I've only seen the flag for limiting them to specific religions/state religions. I eventually settled on changingt he slavery civic to give you -10% science in all cities and +2 hammers per mine & quarry. It seems to be working well enough right now, the science penalty isn't a big deal early in the game and the hammer bonus hasn't been enough of a bonus in the late game to offset the science penalty (except in some extreme cases). So it's turned out to be a good early game civic option, now if I could just solve that problem with units specific to a civic I could have slave armies & slave workers :D
 
maxpublic said:
I have a unit called 'the slave gang' in my own mod; works at half-speed, costs a quarter of what a regular worker does, can't be upgraded. However, I'm still perplexed as to how one limits units to a specific civic. Where do you set the flag?

Max

I'm not sure how you would do this, except maybe in python you could check at the begining of the turn to see if the civic is slavery, and if so, set the number of 'slave gangs' the player has to whatever, and if not, set the number of 'slave gangs' to zero. you wouldn't be able to build them, but would get them for free...

in english:

Code:
at begining of turn
   if civic is slavery
      loop through all units
         count # of 'slave gangs'
      if count is zero
         spawn # of 'slave gangs' in capital
   else
      loop through all units
         if unit is 'slave gang'
            kill unit
 
Thankyou Snaitf, you're an absolute GENIUS :)!. It looks like it will work perfectly-it also seems like I was moving in the right direction! The next thing I need to ask is. Does anyone know how to link Civics choices to the buildings available. For instance, again with the Slavery Civic. Lets say I have discovered the tech 'Epic Works', and I want it to allow the National Project 'Slave Labour System'-a Project which can ONLY be built under the Slavery civic and which-if built-adds a second Slave specialist? Thanks again for ALL your help.

Yours,
Aussie_Lurker.
 
Aussie_Lurker said:
Thankyou Snaitf, you're an absolute GENIUS :)!. It looks like it will work perfectly-it also seems like I was moving in the right direction! The next thing I need to ask is. Does anyone know how to link Civics choices to the buildings available. For instance, again with the Slavery Civic. Lets say I have discovered the tech 'Epic Works', and I want it to allow the National Project 'Slave Labour System'-a Project which can ONLY be built under the Slavery civic and which-if built-adds a second Slave specialist? Thanks again for ALL your help.

Yours,
Aussie_Lurker.

one way to do this is modify the above code that if slavey is enabled, then give an unbuildable building to every city (Slave Labour System Foundation, for example) and then make the Slave Labour System require the Slave Labour System Foundation be present in a city to be built via XML. I think that would work...
 
Code:
	def cannotDoCivic(self,argsList):
		ePlayer = argsList[0]
		eCivic = argsList[1]

		# disable Guerrilla for big civs
		if eCivic == CvDesertWar.iGuerrilla:
			if (ePlayer == CvDesertWar.iBritish or ePlayer == CvDesertWar.iAllies \
							or ePlayer == CvDesertWar.iGermans):
				return True
		return False

	def cannotTrain(self,argsList):
		pCity = argsList[0]
		eUnit = argsList[1]
		bContinue = argsList[2]
		bVisibleTest = argsList[3]

		# disable tanks and ships if ME event occurs
		try:
			if dw.isMiddleEast():
				if pCity.getOwner() == CvDesertWar.iBritish:
					if eUnit in CvDesertWar.forbiddenUnitList:
						return True
		# if serialised data not yet setup, do nothing
		except EOFError:
			pass
		return False

These functions are from the Desert War mod. By mixing these functions you should be able to create the options you want. Of course with the buildings your going to have to tie to the building functions but you get the idea.
 
I think you could do this just in the XML...

Notice how the Caste System thing works? Couldn't you do the same thing?
 
Hiya again guys. Thank you all SO MUCH for your advice and suggestions, they have already proven invaluable-and you have definitely given me a LOT to work with :). Just so you know, this Slavery/Serfdom mod is just a 'test-case' for my broader attempts at modding the entire Civic System. Stay tuned for more in this regard :).

Yours,
Aussie_Lurker.
 
I have experimented with Slave specialists and met some difficulties, but right now I make it simple - Slavery gives +25% food and -15% commerce, besides the "whip" ability - great when you need to grow.
 
Hi Snaitf. I took your advice and wrote the python script as you suggested. Only problem is, I keep getting this error message in my pythonerrorlog:

Code:
Traceback (most recent call last):
  File "<string>", line 1, in ?
  File "<string>", line 52, in load_module
  File "CvEventInterface", line 13, in ?
  File "<string>", line 52, in load_module
  File "CvEventManager", line 29, in ?
NameError
: 
name 'CvEventManager' is not defined

ERR: Call function onEvent failed. Can't find module CvEventInterface
ERR: Call function onEvent failed. Can't find module CvEventInterface

Any idea how I solve the problem?

Thankyou in advance.

Yours,
Aussie_Lurker.
 
Hm, i wonder is it possible to mod civ to work so that if you raze enemy city you get slave unit if you have civic slavery. This unit can rush new building Slave camp what allows one or two new free specialist - slave and causes some unhappyness. And if you get emanciapation then this building is going to be destroyed...
 
OK guys, I have solved the above problem, and my very first mod is moving along very nicely-thanks in large part to Snaitf's brilliance ;)!

Now, I have moved to the second part of my mod, which is having a Slave Labour System. This Slave Labour System places a Slave market in every city.
Now, the only problem I seem to be having is with the XML file dealing with the slave market improvement. Unlike with python, though, I am not being told WHY it is wrong. Personally, I have looked over it a dozen or so times, and can see nothing wrong with it. I will post that section of the XML file here, in the hopes that someone can point out what I am doing wrong.

Code:
<BuildingInfo>
			<BuildingClass>BUILDINGCLASS_SLAVE_MARKET</BuildingClass>
			<Type>BUILDING_SLAVE_MARKET</Type>
			<SpecialBuildingType>NONE</SpecialBuildingType>
			<Description>TXT_KEY_BUILDING_SLAVE_MARKET</Description>
			<Civilopedia>TXT_KEY_BUILDING_SLAVE_MARKET</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_SLAVE_MARKET_STRATEGY</Strategy>
			<Advisor>ADVISOR_ECONOMY</Advisor>
			<ArtDefineTag>ART_DEF_BUILDING_FORGE</ArtDefineTag>
			<MovieDefineTag/>
			<HolyCity>NONE</HolyCity>
			<ReligionType>NONE</ReligionType>
			<StateReligion>NONE</StateReligion>
			<PrereqReligion>NONE</PrereqReligion>
			<GlobalReligionCommerce>NONE</GlobalReligionCommerce>
			<VictoryPrereq>NONE</VictoryPrereq>
			<FreeStartEra>NONE</FreeStartEra>
			<MaxStartEra>NONE</MaxStartEra>
			<ObsoleteTech>NONE</ObsoleteTech>
			<PrereqTech>TECH_MASONRY</PrereqTech>
			<TechTypes/>
			<Bonus>NONE</Bonus>
			<PrereqBonuses/>
			<ProductionTraits/>
			<PowerBonus>NONE</PowerBonus>
			<FreeBonus>NONE</FreeBonus>
			<iNumFreeBonuses>0</iNumFreeBonuses>
			<FreeBuilding>NONE</FreeBuilding>
			<FreePromotion>NONE</FreePromotion>
			<CivicOption>NONE</CivicOption>
			<GreatPeopleUnitClass/>
			<iGreatPeopleRateChange>0</iGreatPeopleRateChange>
			<bTeamShare>0</bTeamShare>
			<bWater>0</bWater>
			<bRiver>0</bRiver>
			<bPower>0</bPower>
			<bDirtyPower>0</bDirtyPower>
			<bAreaCleanPower>0</bAreaCleanPower>
			<bDiploVote>0</bDiploVote>
			<bForceTeamVoteEligible>0</bForceTeamVoteEligible>
			<bCapital>0</bCapital>
			<bGovernmentCenter>0</bGovernmentCenter>
			<bGoldenAge>0</bGoldenAge>
			<bMapCentering>0</bMapCentering>
			<bNoUnhappiness>0</bNoUnhappiness>
			<bNoUnhealthyPopulation>0</bNoUnhealthyPopulation>
			<bBuildingOnlyHealthy>0</bBuildingOnlyHealthy>
			<bNeverCapture>0</bNeverCapture>
			<bNukeImmune>0</bNukeImmune>
			<bPrereqReligion>0</bPrereqReligion>
			<bCenterInCity>0</bCenterInCity>
			<iAIWeight>0</iAIWeight>
			<iCost>600</iCost>
			<iHurryCostModifier>200</iHurryCostModifier>
			<iMinAreaSize>-1</iMinAreaSize>
			<iConquestProb>66</iConquestProb>
			<iCitiesPrereq>0</iCitiesPrereq>
			<iTeamsPrereq>0</iTeamsPrereq>
			<iLevelPrereq>0</iLevelPrereq>
			<iMinLatitude>0</iMinLatitude>
			<iMaxLatitude>90</iMaxLatitude>
			<iGreatPeopleRateModifier>0</iGreatPeopleRateModifier>
			<iGlobalGreatPeopleRateModifier>0</iGlobalGreatPeopleRateModifier>
			<iAnarchyModifier>0</iAnarchyModifier>
			<iGlobalHurryModifier>0</iGlobalHurryModifier>
			<iExperience>0</iExperience>
			<iGlobalExperience>0</iGlobalExperience>
			<iFoodKept>0</iFoodKept>
			<iAirlift>0</iAirlift>
			<iAirModifier>0</iAirModifier>
			<iNukeModifier>0</iNukeModifier>
			<iNukeExplosionRand>0</iNukeExplosionRand>
			<iFreeSpecialist>0</iFreeSpecialist>
			<iAreaFreeSpecialist>0</iAreaFreeSpecialist>
			<iGlobalFreeSpecialist>0</iGlobalFreeSpecialist>
			<iMaintenanceModifier>0</iMaintenanceModifier>
			<iWarWearinessModifier>0</iWarWearinessModifier>
			<iGlobalWarWearinessModifier>0</iGlobalWarWearinessModifier>
			<iHealRateChange>0</iHealRateChange>
			<iHealth>0</iHealth>
			<iAreaHealth>0</iAreaHealth>
			<iGlobalHealth>0</iGlobalHealth>
			<iHappiness>0</iHappiness>
			<iAreaHappiness>0</iAreaHappiness>
			<iGlobalHappiness>0</iGlobalHappiness>
			<iStateReligionHappiness>0</iStateReligionHappiness>
			<iWorkerSpeedModifier>0</iWorkerSpeedModifier>
			<iMilitaryProductionModifier>0</iMilitaryProductionModifier>
			<iSpaceProductionModifier>0</iSpaceProductionModifier>
			<iGlobalSpaceProductionModifier>0</iGlobalSpaceProductionModifier>
			<iTradeRoutes>0</iTradeRoutes>
			<iCoastalTradeRoutes>0</iCoastalTradeRoutes>
			<iGlobalTradeRoutes>0</iGlobalTradeRoutes>
			<iTradeRouteModifier>0</iTradeRouteModifier>
			<iGlobalPopulationChange>0</iGlobalPopulationChange>
			<iFreeTechs>0</iFreeTechs>
			<iDefense>0</iDefense>
			<iAllCityDefense>0</iAllCityDefense>
			<iAsset>4</iAsset>
			<iPower>2</iPower>
			<fVisibilityPriority>1.0</fVisibilityPriority>
			<SeaPlotYieldChanges/>
			<GlobalSeaPlotYieldChanges/>
			<YieldChanges/>
			<CommerceChanges/>
			<ObsoleteSafeCommerceChanges/>
			<CommerceChangeDoubleTimes/>
			<CommerceModifiers/>
			<GlobalCommerceModifiers/>
			<SpecialistExtraCommerces/>
			<StateReligionCommerces/>
			<CommerceHappinesses/>
			<ReligionChanges/>
			<SpecialistCounts/>
			<FreeSpecialistCounts>
				<FreeSpecialistCount>
					<SpecialistType>SPECIALIST_SLAVE</SpecialistType>
					<iFreeSpecialistCount>1</iFreeSpecialistCount>
				</FreeSpecialistCount>
			</FreeSpecialistCounts>
			<CommerceFlexibles/>
			<CommerceChangeOriginalOwners/>
			<ConstructSound>AS2D_BUILD_FORGE</ConstructSound>
			<BonusHealthChanges/>
			<BonusHappinessChanges/>
			<BonusProductionModifiers/>
			<UnitCombatFreeExperiences/>
			<DomainFreeExperiences/>
			<DomainProductionModifiers/>
			<BuildingHappinessChanges/>
			<PrereqBuildingClasses/>
			<BuildingClassNeededs/>
			<SpecialistYieldChanges/>
			<BonusYieldModifiers/>
			<Flavors>
				<Flavor>
					<FlavorType>FLAVOR_PRODUCTION</FlavorType>
					<iFlavor>10</iFlavor>
				</Flavor>
			</Flavors>
			<HotKey/>
			<bAltDown>0</bAltDown>
			<bShiftDown>0</bShiftDown>
			<bCtrlDown>0</bCtrlDown>
			<iHotKeyPriority>0</iHotKeyPriority>
		</BuildingInfo>

Thanks in advance guys.

Yours,
Aussie_Lurker.
 
Although it looks like you may have solved your problem... an alternative is to change the citizen specialist to a slave specialist just for that civic, and give it different attributes.
 
@Snaitf. It is giving me an XML error, and is telling me the the 'Slave_Market' label is wrong-but it isn't giving me sufficient details to work with. Is there anyway you can use a National Project to add a specific free specialist to every city in the area-because that would still be my preference. Anyway, I will make another attempt tonight when I get home from work.

@DH_Epic. I'm not sure that I understand-this is exactly how I AM doing it. I have added a new specialist called 'Slave', who adds a hammer and gold. Changing to slavery adds this specialist to every city. The next step I am currently working on is to allow the construction of a 'Slave Labour System' which adds a second Slave to your cities. The thing about slaves, though, is that there is NO way of adding them to your cities beyond these two means.

Anyway, hope that makes sense, and hope to have more info soon.

Yours,
Aussie_Lurker.
 
Aussie_Lurker said:
@Snaitf. It is giving me an XML error, and is telling me the the 'Slave_Market' label is wrong-but it isn't giving me sufficient details to work with. Is there anyway you can use a National Project to add a specific free specialist to every city in the area-because that would still be my preference. Anyway, I will make another attempt tonight when I get home from work.

@DH_Epic. I'm not sure that I understand-this is exactly how I AM doing it. I have added a new specialist called 'Slave', who adds a hammer and gold. Changing to slavery adds this specialist to every city. The next step I am currently working on is to allow the construction of a 'Slave Labour System' which adds a second Slave to your cities. The thing about slaves, though, is that there is NO way of adding them to your cities beyond these two means.

Anyway, hope that makes sense, and hope to have more info soon.

Yours,
Aussie_Lurker.

Hmm, still not sure what's going on here, why don't you u/l the files so I can try and reproduce the error and see if I can find a workaround, glad to help out...
 
Back
Top Bottom