• Civilization 7 has been announced. For more info please check the forum here .

Capture Slaves

How often should slaves occur?

Just merged the files with my own mod started a game (in which i used the Worldbuilder for quick testing), adopted slavery and defeated about 30 enemies (about 10 barbs, 20 from other civs) - no slaves occured!

\Skodkim

Hmm, odd. Either you were extremely unlucky or the code doesn't work. I'll do some testing. One question though, what units were you killing?
 
Hmm, odd. Either you were extremely unlucky or the code doesn't work. I'll do some testing. One question though, what units were you killing?

Swordsmen, axemen and warriors. Btw I took the download from the first post but used the *py file provided later in the thread (pg 3 i think).

\Skokdim
 
Swordsmen, axemen and warriors. Btw I took the download from the first post but used the *py file provided later in the thread (pg 3 i think).

\Skokdim

I think strategyonly has already updated the eventmanager in the download so you should use it. I tested it and killed 12 warriors and got 5 slaves. I'll test the download also.

EDIT: Yes, the one in the download works also. Are you sure you were running slavery? Were the units in cities?
 
And I actually set my slave occurance lower (to 10%) and got a slave after every victory practically! Is the percentage screwed up? Like should I set it higher to get a lower chance of getting slaves?
 
And I actually set my slave occurance lower (to 10%) and got a slave after every victory practically! Is the percentage screwed up? Like should I set it higher to get a lower chance of getting slaves?

Well I think I've heard that in civ the random number isn't random. :eek:
I got 5 in a row with 20%. So I quess it's because of the random number creating. I'll try reading the threads mayby I find something.
Do you have a better idea how to do the randomness?
 
Well, randomness could als mean complete excess or complete lack. Flipping a coin could result in heads, heads, heads, heads, heads, just as easily as it could result in tails, tails, tails, tails, tails, or heads, tails, heads, tails, heads or whatever else. So I'm not sure if you can even really change the percentage of liklihood or not. I have it switched to 1 in my game right now so after a bit more testing I could probably tell you what the results are. So far I have killed 1 barbarian swordsman under the slavery civic, and I won a slave, so we'll see what happens over time.

In the meantime though, if you want to try and improve it, I won't stop you. :goodjob:
 
I think strategyonly has already updated the eventmanager in the download so you should use it. I tested it and killed 12 warriors and got 5 slaves. I'll test the download also.

EDIT: Yes, the one in the download works also. Are you sure you were running slavery? Were the units in cities?

Well I did actually find an error in my py file where one part of the mod was pasted in at a slighty wrong location. :mischief:

Unfortunately work has come in the way and I can't test it now - will get back to you.

\Skodkim
 
It works!

Just pasted the corrected py file in my mod folder and tried again and now everything seems fine.

Sorry for the inconvenience!

\Skodkim
 
It works!

Just pasted the corrected py file in my mod folder and tried again and now everything seems fine.

Sorry for the inconvenience!

\Skodkim
Well good that you got it work. :goodjob:

Well, randomness could als mean complete excess or complete lack. Flipping a coin could result in heads, heads, heads, heads, heads, just as easily as it could result in tails, tails, tails, tails, tails, or heads, tails, heads, tails, heads or whatever else.
Hmm, that's a good point. I quess I'll leave it as it's.
 
And I actually set my slave occurance lower (to 10%) and got a slave after every victory practically! Is the percentage screwed up? Like should I set it higher to get a lower chance of getting slaves?

Ok strategyonly, seems like there was a bug in the code.
Code:
#mod#
		if (pWinner.isMadeAttack()):
			iAttacker = pWinner.getOwner()
			attacker = PyPlayer(iAttacker)
			if gc.getPlayer(iAttacker).isCivic(CvUtil.findInfoTypeNum(gc.getCivicInfo,gc.getNumCivicInfos(),'CIVIC_SLAVERY')):
				if ((pLoser.plot()).isCity() == 0):
					if (pLoser.isAnimal() == 0):
						if (pLoser.getCaptureUnitType((gc.getPlayer(pLoser.getOwner())).getCivilizationType()) == -1):
							# you can change the chance of getting slaves with this between 0-99, 0 means 0% and 99 100%
							iChance = 40

							iRandNum = CyGame().getSorenRandNum(99, "Slave")
							[COLOR="Blue"]if iChance < iRandNum:[/COLOR]
								attacker.initUnit(gc.getCivilizationInfo(gc.getPlayer(iAttacker).getCivilizationType()).getCivilizationUnits(CvUtil.findInfoTypeNum(gc.getUnitClassInfo, gc.getNumUnitClassInfos(), 'UNITCLASS_SLAVE')), pWinner.getX(), pWinner.getY(), UnitAITypes.NO_UNITAI)
#mod#
This check in blue is done wrong, it should be if iChange > iRandNum. I'm sorry I caused you troubles doing such a mistake.
 
Ok strategyonly, seems like there was a bug in the code.
Code:
#mod#
		if (pWinner.isMadeAttack()):
			iAttacker = pWinner.getOwner()
			attacker = PyPlayer(iAttacker)
			if gc.getPlayer(iAttacker).isCivic(CvUtil.findInfoTypeNum(gc.getCivicInfo,gc.getNumCivicInfos(),'CIVIC_SLAVERY')):
				if ((pLoser.plot()).isCity() == 0):
					if (pLoser.isAnimal() == 0):
						if (pLoser.getCaptureUnitType((gc.getPlayer(pLoser.getOwner())).getCivilizationType()) == -1):
							# you can change the chance of getting slaves with this between 0-99, 0 means 0% and 99 100%
							iChance = 40

							iRandNum = CyGame().getSorenRandNum(99, "Slave")
							[COLOR="Blue"]if iChance < iRandNum:[/COLOR]
								attacker.initUnit(gc.getCivilizationInfo(gc.getPlayer(iAttacker).getCivilizationType()).getCivilizationUnits(CvUtil.findInfoTypeNum(gc.getUnitClassInfo, gc.getNumUnitClassInfos(), 'UNITCLASS_SLAVE')), pWinner.getX(), pWinner.getY(), UnitAITypes.NO_UNITAI)
#mod#
This check in blue is done wrong, it should be if iChange > iRandNum. I'm sorry I caused you troubles doing such a mistake.

Ok also you have the word iChance changed to iChange?
 
No, that's a typo. Only the < must be changed to >.

:lol: i thought so, i just wanted to make sure, and thx so much for helping, you dont know how it makes people like me feel, when people like you are around to help, so again thx:goodjob:


Already updated first post and d/l, thx.
 
BTW, here's the comp you requested. I wasn't entirely sure what you wanted but could you test it and tell me what you think about it? All changes in python files are marked with NotSoGood. Could you tell me when you have downloaded it so I can clean some space?
 
BTW, here's the comp you requested. I wasn't entirely sure what you wanted but could you test it and tell me what you think about it? All changes in python files are marked with NotSoGood. Could you tell me when you have downloaded it so I can clean some space?

ok i got it thx. Yes pls erase.
 
NotSoGood@

When the wooden ship won the fight a slave was captured but on the "water"??



Dancing Hoskuld
Apr 20, 2010 04:27 PM
Dancing Hoskuld
I wondered why there was no DOMAIN_LAND check in the code. Without it the above should happen.
 
NotSoGood@

When the wooden ship won the fight a slave was captured but on the "water"??

Dancing Hoskuld
Apr 20, 2010 04:27 PM
Dancing Hoskuld
I wondered why there was no DOMAIN_LAND check in the code. Without it the above should happen.

:mad: I always forget things! :mad:
So, do you suggest to only get slaves from land combat?
 
Top Bottom