[QUESTION] Unit which requires a civic

Terxpahseyton

Nobody
Joined
Sep 9, 2006
Messages
10,759
Hey,
I was wondering, if there is a way to mod civics that way, that they enable you to have certain units. Or to go the other way: If it would be possible to mod units, so they will require a certain civic to be build.
I'm currently working on a completly new civic-system for modern games and just would hate to have to miss this. So any idea how that could be done?
I would really appreciate it
 
There just came up another thing about the civics I could not find a solution for through using the search function: With the python-code Gunner posted I could make certain promotions only available with certain civics, but what I would like to gain is, that all units automatically get a promotion (city defense) when they are build and u r having the civic. So the civic provides a free promotion for every unit, also if those are actually not suppossed to have this promotion.
I believe to have seen this somewhere, but I don't rember where exactly :(
Does someone know anything about this?
 
Have you checked the rest of that thread I linked? I could have sworn I've seen something exactly like that before.

If that doesn't work, I'm pretty sure that FFH2 has (or at least used to) a promotion that is given to all units in their home territory if you have the correct trait. That would give you a model that should be fairly straightforward to combine with civics.
 
Guners right, its just an intercept in onUnitMove that applies the promotion:

Code:
		pUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_HOMELAND'), False)
		if pPlot.isOwned():
			if (pPlayer.hasTrait(gc.getInfoTypeForString('TRAIT_DEFENDER')) and pPlot.getOwner() == pUnit.getOwner()):
				if (pUnit.getUnitCombatType() == gc.getInfoTypeForString('UNITCOMBAT_MELEE') or pUnit.getUnitCombatType() == gc.getInfoTypeForString('UNITCOMBAT_RECON') or pUnit.getUnitCombatType() == gc.getInfoTypeForString('UNITCOMBAT_ARCHER') or pUnit.getUnitCombatType() == gc.getInfoTypeForString('UNITCOMBAT_MOUNTED') or pUnit.getUnitCombatType() == gc.getInfoTypeForString('UNITCOMBAT_DISCIPLE')):
					pUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_HOMELAND'), True)

You could put a similiar check in onUnitCreated that applies the promotion (since onUnitMove requires the unit to move before it will be placed).
 
Mexico or was it Lopez has done a DLL+XML based system for giving Civics as Prerequisites to a Unit, Thread is in Mod components some ware, the code is in Total realism and will soon be in CCCP.
 
Top Bottom