Gurra09
Aug 14, 2008, 04:57 AM
I'm going to create a Slave unit that is a supercheap Worker who destroys it self after completing a work like the work boat.
I think that the Slave unit would only be able to build if you have the Slavery civic. Otherwise not. But how can I make a civic needed for unit creation? I can't find any tag for that in CIV4_UnitInfos.xml.
Gurra09
Ninja2
Aug 14, 2008, 05:11 AM
This can be done in Python. Look for the Inquisitor mod component, which has a rule that Inquisitors cannot be built unless you have Theocracy or Organized Religion (IIRC).
Gurra09
Aug 14, 2008, 06:34 AM
Then I have to put this idea down, can't mod in Python...
Gurra09
Zebra 9
Aug 14, 2008, 07:06 AM
I think I have a python snippet that does this, if not I'll post one. let me check...
Yup I do follow the link in my sig. ;)
Gurra09
Aug 15, 2008, 05:54 AM
Are your python snippet for that compatible for BTS? Because the code you said was in unmodded game was different in my original BTS Python files and when I used the snippet the civilopedia didn't worked and when I played a game I couldn't see menus or anything except for the main map.
This is my Python Code:
def cannotTrain(self,argsList):
pCity = argsList[0]
eUnit = argsList[1]
bContinue = argsList[2]
bTestVisible = argsList[3]
bIgnoreCost = argsList[4]
bIgnoreUpgrades = argsList[5]
civic = "CIVIC_SLAVERY" ## The Civic
unit = "UNIT_SLAVE" ## The Unit
## If The Civ Doesn't Have The Correct Civic Tell the SDK Not To Allow The Player To Train This Unit
if eUnit == gc.getInfoTypeForString(unit):
if not gc.getPlayer(pCity.getOwner()).isCivic(gc.getInfoT ypeForString(civic)):
return True
return False
Gurra09
zyphyr
Aug 16, 2008, 06:02 PM
Spacing is absolutely critical in Python. One thing I am noticing is the location of the 'return False'. As it is currently placed, it is a part of the 2nd if, and will never be called. So, the function doesn't terminate. Plus, that will cause problems with everything that comes after it in the file.
Everything you added from 'unit =' down to 'return True' should have 8 more spaces put in front of them.
Gurra09
Aug 17, 2008, 02:45 AM
I've got everything to work now except for self-destroying of the unit. I can't find any tag in unit infos...
Gurra09