Capture Slaves

Ok, I knew that would be difficult to understand. :D Because I'm not native English speaker, It was quite hard to get anything to write there. Basicly I mean units that can be captured. Like workers, settlers. Did you get it?

Don't worry, you should see my Finnish!

And that's good, I figured that's what it meant, but since I don't know much about coding and stuff I thought there is a chance it might be some crazy techno-babble I don't know about. Good work, as usual, NSG! :goodjob:

EDIT: Finally, everything I need in the python is marked #mod# correct?
 
Ok, now I uploaded a updated version. Everything it does:
  1. You can get slaves only if you've adopted the slavery civic
  2. There's a chance, that defines the probability to get the slave after combat
  3. Only the attacker gets slaves
  4. You can't get slaves from killing animals
  5. You can't get slaves from killing units in cities
  6. You can't get slaves from killing units that can be captured
  7. You get atleast two slaves from razing a city, it should be about 2/3 of the city population
I think that should be all.

Great!
One last important thing left out, but I'm not sure it's in python
When joining cities can they be not citizen specialist, instead a new class of specialist?
This way they can "obsolete" when you switch from slavery

Oh, there was one other thing, but I'm not even sure it's a good idea to be honest.
Only include this if The Capo wants it for his mod.
Maybe you should also get a slave when you capture a city (not raze it).
It can represent the units defeated in that city during the siege, and of course there is a population decrease anyway when you capture a city so it can mean some of the citizens too
Furthermore it was very common in history to slave some of the conquered cities population even if the agressor did not raze them, so it's pretty accurate
 
Well, the more he changes the longer I have to wait to add it. It is entirely up to NSG though. Either one is good for me, but I'm pretty sure creating a new slave-specialist category that only works when you've adopted slavery (i.e. they do nothing when you do not) will probably involve some type of python. If you want me to I could make a little specialist icon for him though.
 
Great!
One last important thing left out, but I'm not sure it's in python
When joining cities can they be not citizen specialist, instead a new class of specialist?
This way they can "obsolete" when you switch from slavery
That can't be done with python nor xml. It would require SDK changes, I think.
Oh, there was one other thing, but I'm not even sure it's a good idea to be honest.
Only include this if The Capo wants it for his mod.
Maybe you should also get a slave when you capture a city (not raze it).
It can represent the units defeated in that city during the siege, and of course there is a population decrease anyway when you capture a city so it can mean some of the citizens too
Furthermore it was very common in history to slave some of the conquered cities population even if the agressor did not raze them, so it's pretty accurate
Actually part of that is already in. You get a slave from capturing a city. Sorry forgot to mention about that one. :sad: But the city population isn't changed.
What do you think The Capo or anyone else?
I don't have much ideas, I'm more like someone who does things. :rolleyes:
 
I just meant that the city population automatically decreases by one when you capture a city.
Or was that in Civ3?? Hmm, I may not remember that correctly. Sry than

Anyway, if a slave when you capture is already in, that's awesome. Thank you :goodjob:
 
Isn't there a specialist infos file though? I already started working on the Specialist button... :(

EDIT: Actually, even if you can just add it, I think it would require some gamefont changes, and that's a whole mess to deal with.
 
Isn't there a specialist infos file though? I already started working on the Specialist button... :(

EDIT: Actually, even if you can just add it, I think it would require some gamefont changes, and that's a whole mess to deal with.

Yes, there's a SpecialistInfos.xml file in GameInfo folder. I'm not sure about it, but you should be able to add you button/icon to it with the <Texture> tag, and you can make the slave unit to join the city as a specialist in UnitInfos. But the problem was that it cannot be obsolated.
 
Well, I'm going to look into it, if I'm going to add this to my mod I might as well do it right and make it look polished, right?

In case anyone was wondering here's the button I came up with. :goodjob:

I think it fits the look of the other specialists, of course he looks sad compared to the rest of them, as he should. I'd be sad too if some lazy civ-playing douchebag made me a slave.

Anyway, although there would be no difference between having this specialist and a citizens specialist in the city (well I was probably going to skew the slave towards only production) if I can't get it to obselete (or not work when in slavery) then I probably shouldn't have it. It would make no sense for a civ with emancipation to have a slave specialist in their city after all. What I might do is try to figure out how to get this to work before adding it then.
 

Attachments

  • slave.png
    slave.png
    7.8 KB · Views: 137
I saw some similar modcomps earlier, I'm sure there you will find some help what to do with this.
There is a Great Doctor, a Great Statesman/Diplomat, and even a Great Citizen.
And here is the 3 combined by tsentom.


EDIT: I just found this, maybe this is the closest thing what we want. Really hope this helps

Well, that TheLopez' mod would allow the Slavery Civic to give Slave Specialists. But that isn't really what we want here, we want the slave unit to be able to join the city as a slave, then we want that slave specialist to disappear when the civ adopts a different civic. That's the problem. Another problem that we might want to resolve is, do you keep the slave units themselves when you move out of slavery?

As far as those other mods (the Tsentom1 mods) go, they don't really achieve what we want either. I can add a slave specialist to the game, but the problem is getting it to disappear.
 
Okay, so the slave thing works pretty well, the only issue I have with it right now is that I keep getting an Assert Failure (I am running the DebugDLL) which looks like it refers to the Unit AI but I could be wrong:


This occured when I got the slave unit, it also occurs everytime I select the slave unit (but only once per turn). So I'm thinking something is wrong with the UNITAI or something like that. :confused:
 

Attachments

  • SlaveAssertFailure.jpg
    SlaveAssertFailure.jpg
    23.5 KB · Views: 182
Oh yeah, one more thing, it seems to have disabled the animal bonus modcomp you came up with. I killed an elephant and a deer and no resource showed up on the plot. Here's the code in case I merged it wrong:

Code:
	def onCombatResult(self, argsList):
		'Combat Result'
		pWinner,pLoser = argsList
		playerX = PyPlayer(pWinner.getOwner())
		unitX = PyInfo.UnitInfo(pWinner.getUnitType())
		playerY = PyPlayer(pLoser.getOwner())
		unitY = PyInfo.UnitInfo(pLoser.getUnitType())

# Animal bonus start
		player = pWinner.getOwner()
		winnerOwner = gc.getPlayer(player)
		team = winnerOwner.getTeam()
		winnerTeam = gc.getTeam(team)
		pLoserType = pLoser.getUnitType()

		if (pLoserType == gc.getInfoTypeForString('UNIT_ELEPHANT')):
			if winnerTeam.isHasTech(gc.getInfoTypeForString('TECH_ANIMAL_HUSBANDRY')):
				pLoser.plot().setBonusType(gc.getInfoTypeForString('BONUS_IVORY'))

		if (pLoserType == gc.getInfoTypeForString('UNIT_HORSE')):
			if winnerTeam.isHasTech(gc.getInfoTypeForString('TECH_ANIMAL_HUSBANDRY')):
				pLoser.plot().setBonusType(gc.getInfoTypeForString('BONUS_HORSE'))

		if (pLoserType == gc.getInfoTypeForString('UNIT_DEER')):
			if winnerTeam.isHasTech(gc.getInfoTypeForString('TECH_ANIMAL_HUSBANDRY')):
				pLoser.plot().setBonusType(gc.getInfoTypeForString('BONUS_DEER'))
# Animal bonus end 

#slave 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 = 30

							iRandNum = CyGame().getSorenRandNum(99, "Slave")
							if iChance < iRandNum:
								attacker.initUnit(gc.getCivilizationInfo(gc.getPlayer(iAttacker).getCivilizationType()).getCivilizationUnits(CvUtil.findInfoTypeNum(gc.getUnitClassInfo, gc.getNumUnitClassInfos(), 'UNITCLASS_SLAVE')), pWinner.getX(), pWinner.getY(), UnitAITypes.NO_UNITAI)
#slave mod#
 
So if I put this in there:

Code:
			<UnitAIs>
				<UnitAI>
					<UnitAIType>UNITAI_WORKER</UnitAIType>
					<bUnitAI>1</bUnitAI>
				</UnitAI>
				<UnitAI>
					<UnitAIType>UNITAI_ENGINEER</UnitAIType>
					<bUnitAI>1</bUnitAI>
				</UnitAI>                
			</UnitAIs>

That would mean they'd use it as a worker (for tile improvements) and as an engineer (for rushing production and joining a city as a specialist)? Also what should I do about the conflict with the animal mod?
 
Oh yeah, one more thing, it seems to have disabled the animal bonus modcomp you came up with. I killed an elephant and a deer and no resource showed up on the plot. Here's the code in case I merged it wrong:
...

The code seems fine to me. Is there anything else in your EventManager onCombatResult? Have you checked for duplicates? (Do you remeber the machu picchu?) Does the slave code run fine?

EDIT:

^
| Yes that should work. Remeber to change the default unitai too. It should be near the start where are the unittype and unitclass.
 
The slave code runs fine...

I'm an idiot. I don't think I had animal husbandry when I playtested it, because I shot directly to bronze to get slavery going. :blush:

Sorry.
 
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
 
Top Bottom