CIv II-style Leonardo's Workshop request

draco963

Prince
Joined
Jan 26, 2007
Messages
451
Location
Earth
OK, so, I've been trying to find a copy of a Civ II-style Leo's Workshop, that would cut by a percentage the cost of upgraduing for all my units. Except for the CCCP (which only goes to Warlords) I can't find one. Unfortunately, the SDK is waaay beyond my programming skills...

So, I'm requesting (begging, actually ;)) for someone to write up the changes in the appropriate SDK files, and post them here. I can compile the new DLL myself (intructions I can follow, found some awhile back for compiling a new DLL).

Heck, even just an idea where to go would be nice...
Thanks!!!
 
Thanks for the pointer snipperrabbit, but looking through all the posts started by both Tsentom and Jojoweb, they don't have what I'm looking for.

Tsentom does have a Leo's Workshop, but it works by making a random upgrade available to units that win a battle within the owner's borders. I'm looking for a Civ II-style Workshop, that halves the cost of upgrading for the owner. Basically, a pre-BtS Kremlin, but for units, instead of buildings.
 
I'm not sure about it, but I would think you could write something like this pretty easily in Python. Try asking in that subforum. To get you started though you can overide upgrade costs in CvGameUtils.py This is sample code taken from a mod:
Code:
	def getUpgradePriceOverride(self, argsList):
		iPlayer, iUnitID, iUnitTypeUpgrade = argsList

		pPlayer = gc.getPlayer(iPlayer)
		pUnit = pPlayer.getUnit(iUnitID)
		
		iUnitEarlyFlyer = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_EARLY_FLYER')
		iUnitFighter = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_FIGHTER')
		iUnitJetFighter = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_JET_FIGHTER')
		
		# Upgrading Early Flyer...
		if (pUnit.getUnitType() == iUnitEarlyFlyer):
			# ...To Fighter
			if (iUnitTypeUpgrade == iUnitFighter):
				return 100
			# ...To Jet Fighter
			elif (iUnitTypeUpgrade == iUnitJetFighter):
				return 250
		
		return -1	# Any value 0 or above will be used

Also more sample code in regards to checking if a building is present:
Code:
            elif pCity.getNumRealBuilding(gc.getInfoTypeForString("BUILDING_CARTHAGE_COTHON")) > 0:
                cityDistModifier = 0.7*cityDistModifier
            elif pCity.getNumRealBuilding(gc.getInfoTypeForString("BUILDING_HARBOR")) > 0:
                cityDistModifier = 0.7*cityDistModifier
You should be able to substitute pteam for pcity to check if a team has a wonder (pCity.getNumRealBuilding(gc.getInfoTypeForString("BUILDING_CARTHAGE_COTHON")) > 0: is the key here what's it's doing is saying in pCity, check the #value in the city for a building the XML is defining as Building_Carthage_Cothon, if the value is over 0, then do some action--in this case multiply the value CityDistModifier by .7)), then set up your standard python if/elif/else code to change the uprgade costs to half if that building type is present on a team (ie the wonder you created). Though I doubt you'd want to go through and set up a line for each unit type in the game, there has to be a more efficient way. Not even sure if this would work, but it should definatly help get you started. Like I said, try asking in SDK/Python forums, and read through the Let's Learn To Mod Civ Today thread, it teaches you the basics of Python, which are fundemantly at least pretty straight forward. I've found if you're willing to get your own feet wet, and write the code yourself, people are more then happy to help you out figure out how to write it.
 
Though I doubt you'd want to go through and set up a line for each unit type in the game, there has to be a more efficient way.
There is an existing function (CyUnit.upgradePrice()) that will give you the default upgrade price and you can just take half of it. I'd try something like this (completely untested):

Code:
	def getUpgradePriceOverride(self, argsList):
		iPlayer, iUnitID, iUnitTypeUpgrade = argsList

		pPlayer = gc.getPlayer(iPlayer)
		pUnit = pPlayer.getUnit(iUnitID)
		
		if <whatever test you use to determine this player/team has the wonder>:
			return (pUnit.upgradePrice(iUnitTypeUpgrade) / 2 )
		else:
			return -1	# use default

O/T Nitpick: Half-price upgrades are the civ3 style Leonardo's Workshop. In civ2, it was automatic (free) upgrades :p
 
It is implemented in the new traits they add. So it can be ported to buildings with little trouble. It requires SDK work though.

This is WWCF in Thomas war :
Strategic (Str)
&#8226; -50% Cost to Upgrade Units
&#8226; +25% Production of Advanced Recon and Conventional Missile Units

(Note: I had originally accomplished this through SDK &#8211; with code done by Frizzimod &#8211; but I&#8217;ve been having trouble doing a new complete DLL with all my changes since the patch. So, for the time being I accomplish this trait by giving a Cheap Upgrades promotion to all units. It&#8217;s functionally the same, only the interface looks slightly clumsy and crowded. It is a straight bonus across the board, so please no complaints in the thread saying this trait is overpowered because it looks like it gives a hundred promotions to a hundred different units. In a future version I&#8217;ll reincorporate it into the SDK).

So, it redirects to Kipkhumi's Frizzimod.
 
Back
Top Bottom