Mod Component Requests Thread

EDIT: Yes, when they are attacked there should be a chance (maybe something high, like 40-60%) they can escape the attack, if that is possible.

I can't get them withdraw at the moment, but rest of the code is ready. It's again nearly midnight here. :sleep: I'll try to get it work tomorrow.
You can't do that in normal game, so I have to write some python code. But somehow my computer doesn't want to do anything corectly when I should be sleeping. :lol:
 
I can't get them withdraw at the moment, but rest of the code is ready. It's again nearly midnight here. :sleep: I'll try to get it work tomorrow.
You can't do that in normal game, so I have to write some python code. But somehow my computer doesn't want to do anything corectly when I should be sleeping. :lol:

The withdrawal thing isn't that important, so if you don't feel like doing that, it's fine. I basically just wanted these things to be sort of difficult to kill/hunt down.
 
The withdrawal thing isn't that important, so if you don't feel like doing that, it's fine. I basically just wanted these things to be sort of difficult to kill/hunt down.

Well, I got the animal escaping work. I used tsentom's survival promotion as start. So all credits should go there. But I haven't fixed yet that animals escape to ocean. :lol: Seahorses. :p
So now the modcomp should work as you wanted. I'll test it little to be sure.
 
Well, I got the animal escaping work. I used tsentom's survival promotion as start. So all credits should go there. But I haven't fixed yet that animals escape to ocean. :lol: Seahorses. :p
So now the modcomp should work as you wanted. I'll test it little to be sure.

Do what you gotta do, I'd rather have it perfect than quickly. :goodjob:
 
How is the "Sea Horse" bug going?

It's tough. Somehow I can't get them not to spawn in water when they are completely surrounded. But I might have found the reason, not sure yet. Midnight again, nearly. :sleep:
If I can't get it work before like weekend, I'll ask help from these forums.
BTW, if it isn't clear yet, I'm doing this with python.
 
It's tough. Somehow I can't get them not to spawn in water when they are completely surrounded. But I might have found the reason, not sure yet. Midnight again, nearly. :sleep:
If I can't get it work before like weekend, I'll ask help from these forums.
BTW, if it isn't clear yet, I'm doing this with python.

Well, I don't really need them to respawn anywhere. If you can't get it to work that's fine. I guess withdrawing from combat doesn't work when you are getting attacked, does it?

I just envisioned that you could attack them, and sometimes they'd "withdraw" (i.e. the combat would end like any unit that withdraws normally), but if you can't get that to work that is the least important part of it. As long as the rest works fine it's okay.
 
Well, I don't really need them to respawn anywhere. If you can't get it to work that's fine. I guess withdrawing from combat doesn't work when you are getting attacked, does it?
I don't think so, and I tested it by slaughtering lots of cavalry with riflemen.

I just envisioned that you could attack them, and sometimes they'd "withdraw" (i.e. the combat would end like any unit that withdraws normally), but if you can't get that to work that is the least important part of it. As long as the rest works fine it's okay.
I can't get that part work, so do you think something other needs to be tweaked?

Currently:
  • Elephants, horses and deer have 2:move:
  • They can't attack you
  • When you kill them and you have animal husbandry, a bonus is placed on the plot
What about strenghts? Anything else comes to your mind?
 
Well, I wanted to give them 2 movement each to make them more difficult to hunt down, but I suppose if you give the Elephant more strength and less movement it serves the same purpose. This part isn't as important as the python though, because nearly anyone with half a brain could change XML. Python is a different beast altogether.
 
Okay this might sound complicated, but I was wondering if anyone could help me do this. I want to add the Capture Slaves modcomp to my mod. In the mod you capture a slave unit (not a regular worker) that can be used for various things. One of these features is that it allows the slave unit to join the city as a citizen specialist. I want to change this to a slave specialist, which is easy enough I just add a slave specialist to the game. The issue is, that I want this specialist to only work while the civ that utilizes the feature is running the slavery civic. So if it switches to something like emancipation, or caste system, the slave specialist should no longer be effective, i.e. it should not work or disappear altogether.

Is there any way this can be done?
 
Mmmhh...will be somehow ugly.
In CvEventManager.py,
PHP:
	def onCityDoTurn(self, argsList):
		'City Production'
		pCity = argsList[0]
		iPlayer = argsList[1]
		###from here
		pPlayer = gc.getPlayer(iPlayer)
		if not pPlayer.isCivic(gc.getInfoTypeForString("CIVIC_SLAVERY")):
                        iSlaveSpecialist = gc.getInfoTypeForString("SPECIALIST_YOUKNOWWHATTOPUTHERE")
                        iSlaveSpecialistInCity = pCity.getSpecialistCount(iSlaveSpecialist)
                        pCity.alterSpecialistCount(iSlaveSpecialist,-iSlaveSpecialistInCity)
                ###to here
		CvAdvisorUtils.cityAdvise(pCity, iPlayer)

Problem here: AI does completly not understand it, and there's no real way to tell it the AI.



And you've requested some time ago the code for being able to train the UU of the previous owner of a city.
Could you maybe try this, in CvGameUtils:
PHP:
	def canTrain(self,argsList):
		pCity = argsList[0]
		eUnit = argsList[1]
		bContinue = argsList[2]
		bTestVisible = argsList[3]
		bIgnoreCost = argsList[4]
		bIgnoreUpgrades = argsList[5]
		###from here on
		pPlayer = gc.getPlayer(pCity.getOwner())
		if pPlayer.getBuildingClassCount(gc.getInfoTypeForString("BUILDINGCLASS_WHATEVER"))>0:
                        iObsoleteTech = gc.getBuildingInfo(gc.getInfoTypeForString("BUILDING_WHATEVER")).getObsoleteTech()
                        if (iObsoleteTech ==-1) or ( gc.getTeam(pPlayer.getTeam()).isHasTech(iObsoleteTech) == false ):
                                iPreviousOwner = pCity.getPreviousOwner ()
                                if iPreviousOwner>-1 and iPreviousOwner <=gc.getMAX_CIV_PLAYERS ():
                                        pPreviousOwner = gc.getPlayer(iPreviousOwner)
                                        iUniqueUnit = gc.getCivilizationInfo(pPreviousOwner.getCivilizationType ()).getCivilizationUnits(eUnit)
                                        iDefaultUnit = gc.getUnitClassInfo(eUnit).getDefaultUnitIndex()
                                        if (iDefaultUnit > -1) and (iUniqueUnit > -1) and (iDefaultUnit != iUniqueUnit):
                                                return True
                ### to here                              

		return False

Please note, that it's in the second line BUILDINGCLASS_ and in the third line BUILDNG_ (i'll might change that later).
And don't forget to enable canTrain in the PythonCallbackDefines.xml
The code itself is 50% from tsentom and 50% from me, but i guess, he's already on your credit list.

Edit: Might happen, that you're able to train a unit without the resources or the needed technology, but i'm not sure, please test it :).
 
Thanks The_J, you da' man!

I'm not too worried if the AI doesn't understand the slave specialist thing because it would probably be switching out of the civic for a better one anyway, and none of my leaders (except maybe Pol Pot) have slavery as a favorite civic. I'll definitely try these out, and thanks again for your work and your assistance! :goodjob:

I'll test both of these out in a couple of hours and let you know how it went.
 
I have something in onDoCityTurn already (it prevents unhappiness from defying a UN resolution while running the Police State civic), so is this how I'd add the first bit of code? (the code you added is in red)

Code:
	def onCityDoTurn(self, argsList):
		'City Production'
		pCity = argsList[0]
		iPlayer = argsList[1]
[COLOR="Red"]        ###from here
        pPlayer = gc.getPlayer(iPlayer)
        if not pPlayer.isCivic(gc.getInfoTypeForString("CIVIC_SLAVERY")):
                        iSlaveSpecialist = gc.getInfoTypeForString("SPECIALIST_SLAVE")
                        iSlaveSpecialistInCity = pCity.getSpecialistCount(iSlaveSpecialist)
                        pCity.alterSpecialistCount(iSlaveSpecialist,-iSlaveSpecialistInCity)
                ###to here[/COLOR]
		
# no anger defying UN resolutions start #
		iGovernmentCivicOption = CvUtil.findInfoTypeNum(gc.getCivicOptionInfo,gc.getNumCivicOptionInfos(),'CIVICOPTION_GOVERNMENT')
		iPoliceState = CvUtil.findInfoTypeNum(gc.getCivicInfo,gc.getNumCivicInfos(),'CIVIC_POLICE_STATE')
		pPlayer = gc.getPlayer(iPlayer)
		iGovernmentCivic = pPlayer.getCivics(iGovernmentCivicOption)

		if (iGovernmentCivic == iPoliceState):
			pCity.changeDefyResolutionAngerTimer(pCity.getDefyResolutionAngerTimer())
# no anger defying UN resolutions end #
 
Top Bottom