Unique Unit triggered Golden age idea

Impaler[WrG]

Civ4:Col UI programmer
Joined
Dec 5, 2005
Messages
1,750
Location
Vallejo, California
Civ 3 used UU to trigger its golen ages, and we all love golden ages so what do people think of a mod that could trigger a golden age assosiated with Unique Units?

The question is adsactly what it should trigger off of, if its combat victory then India will be screwed, if its just Building the first instance of the UU then the Inca and Indians will likly get their golden ages in the first few turns of the game which sucks because you get almost nothing out of it at that point. Perhaps a different trigger would better like have a total of 3 of the Units so the player has a bit more control over when they spring it and it requires a bit more effort to actualy trigger it.

As far as implementation goes I imagine a little python script will fire off after onUnitProduced, it will check a boolean that gets flipped once you have had your UU golden age. If you haven't had it yet it checks if the Unit was the UU for the Civ your playing. If it is it counts up how many of them you currently have (its counting currently active alive units not just each time you built one). If its high enough the Golden Age begins and the boolean is set to keep you at one such GA per game.

Dose this sound like a mod people would like to play?
 
I think it would be too hard to tie it to the UU, because the Germans will have a much more effective "free" golden age than the Indians (I couldn't restrict myself to only two workers and have much of a chance to survive)
 
Hmmm. It could be done on wonder production (the other method of doing it in Civ 3) - wonders tied into traits, and if you had the trait and the built the wonder there was a chance it would trigger the GA.
 
Theirs always going to be a downside to early game golden ages, you get less out of the GA in terms of raw money when your only at one City, but if that golden age say helps you get a settler made a few turns earlier it can potentialy snowball the whole remainder of the game. The downside of late game GA is that the game will be mostly won or lost by that point and I find most players are already triggering plently of golden ages with Great People and Tash Mahall.

I think that if the level of output a plot needs before it gets GA boni would help make early GAs better. Likewise perhas add a little script that would add some Commerce directly to the Cities pool (hense bypassing terrain harvesting) would help sweeten early ones bu have little effect on the late ones.

How to make an apropriate conection between a wonder and a Trait is kind of tricky. We would need to deside which wonders go witch which traits. Then I guess we could give a ProductionTrait to the wonder say 25-50%. Then check if the leaders Traits match one or more of the Production Traits of the wonder upon completion. Anyone care to come up with a list of sugjestions as to which wonders link to which traits?
 
Anyone have an idea for creating a python script that can determin if a Unit is a Unique Unit? Unique Units have the same UnitClassType as the Unit they replace but have a Unique :crazyeye: UnitType. There dosn't seem to be any way to compare these 2 directly to answer the question.

So I figured I should get the Players Civilization and then get from the Civilization the Unique Unit and compare the UnitType against that. Only thing is I dont see anything that obviosly referes to that under API listings found at

http://civilization4.net/files/modding/PythonAPI/

I suspect it might be CivilizationInfo #9
INT getCivilizationUnits(INT i)

But this returns an INT and I want a UnitType, further more I am not shure if its returning UnitClassType or UnitType, the XML stores the UU of a Civ like follows

<Units>
<Unit>
<UnitClassType>UNITCLASS_MARINE</UnitClassType>
<UnitType>UNIT_AMERICAN_NAVY_SEAL</UnitType>
</Unit>
</Units>

This raises the question of how Unique units are actualy made Unique, is it simply the precence of the unit under any Civilization Unit element mean that its restricted to just them or is something else happening behind the sceens. Ok well in any case I will start experimenting with simply trying to detect the UU and trigger things off of it, then I can start worrying about starting the golden age.

Any advice and tips from the peanut gallery would be welcome if people think the plan is doomed AND you have a better idea.
 
I'm pretty sure the unique unit code means that for a certain unit class, instead of getting this unit type, you'll get that one.

I supose you could check all the civs to see if they could train the unit in question, and see if they had the relavent tech to train the unit (though I'm not sure about this second one - there is only one thing which returns a TechType from a CyUnit entity... and I don't think it's what we want).

It'd be cluncky, but I can't think of any other way of doing it myself.
 
Quite by chance I think I might just have stumbled across a solution.

If you check out PyHelpers.py, it has these few lines:
Code:
class PyGame:
	### Lots of boring functions we don't care about
	
	def getListUniqueUnits(self):
		lUniqueUnits = self.getListUniqueUnitID()
		lUnitInfos = []
		for i in range(len(lUniqueUnits)):
			lUnitInfos.append(PyInfo.UnitInfo(lUniqueUnits[i]))
		return lUnitInfos
	
	def getListUniqueUnitID(self):
		listUU = []
		unitClass = []
		for i in range(gc.getNumUnitInfos()):
			iUnitClass = PyInfo.UnitInfo(i).getUnitClassType()	
			if iUnitClass in unitClass:
				listUU.append(i)			
			else:
				unitClass.append(iUnitClass)
		return listUU
These seem to produce a list of unique unit classes, and a list of unique unit IDs. I'm not quite sure how the unique classes work, as it seems that they are unique types, but I think the second one might be more useful, as, unless I'm mistaken, it identifies a list of all the unique units.

I'm not certain about this code - I may be reading it wrong, but I've a feeling it will help.
 
Back
Top Bottom