Technical documentation

it works now thank you. can't believe I missed tStartingYear right at the top of the file.
 
I've added a couple extra Leaderheads, but I was wondering how I make them appear in-game at a certain date?

There is no central mechanism for LH switching in SoI compared to RFC.
You can use gc.getPlayer(iPlayer).setLeader(gc.getInfoTypeForString("LEADER_SOMEDUDE")) to change the leader directly at a given year etc.

Also I thought I added the civilopedia entry for one of the LH's into CIV4GameText_MEM_Civilizations.xml, but nothing appears in the in-game civilopedia...

Check XML and key names for typos, there's nothing else that could be wrong really.
 
Hi Edead,

Is it possible to include a mechanism like what there is in RFC and introduce it into SoI mechanism or not at all?

As for the line of code you gave me:
gc.getPlayer(iPlayer).setLeader(gc.getInfoTypeForString("LEADER_SOMEDUDE"))

would it be something like this:

gc.getPlayer(iByzantium).setLeader(gc.getInfoTypeForString("LEADER_ALEXIOS")) ?
Where do I enter the date?

And finally now strangely enough, (I don't know if you've downloaded my mod), but I changed the Basil II LH and took the current (SoI version) of Basil and made him into Alexios I, calling him "Justinian" in the code, because you seem to have done that.
But now in the civilopedia, the entire text is gone (except for his name labeled on the top), including his face and favorite civic, only his icon remains, when you click on him in the civilopedia. Very strange...
 
I'm not going to work on such mechanism because setLeader is good enough, and SoI handles name/civ/leader changes more manually in DynamicCivs.py

The example you've posted is fine. You put the date in an IF clause within a checkTurn method, like with everything in RFC/SoI, and like you did with Barbs.py etc. This can be in any module you want, but DynamicCivs.py sounds like a logical choice.

XML text keys must match the Description and Civilopedia keys from Civ4LeaderheadInfos (not the Type key, i.e. not LEADER_JUSTINIAN)

BTW Your inbox is full again.
 
I have integrated my calendar, map and civ names. before I started on the civ names I ran it with just the map and calendar changes and got no errors or crashes through lots of autoplay. now I have changes the civ names in the DLL, python and xml. the game loads and runs but I get the following just before the main map comes up:

Spoiler :
Traceback (most recent call last):

File "CvEventInterface", line 22, in onEvent

File "CvCustomEventManager", line 146, in handleEvent

File "CvCustomEventManager", line 157, in _handleDefaultEvent

File "CvRFCEventHandler", line 95, in onGameStart

File "DynamicCivs", line 150, in setup

KeyError: 11
ERR: Python function onEvent failed, module CvEventInterface


and this sometimes but not always at the end of a turn:

Spoiler :
'module' object has no attribute "onEvent"

Attribute error

File "CvAppInterface"

line 47

in onSave


also, I tried to add a dummy religion and it appeared in the game but wasn't founded with the tech I set for it. I was wondering if that might have something to do with all the religions in SoI being already founded?

and even though i edited the regions text file my region names don't appear in the tooltip.

thanks for all the help.
 
@srpt

Always look at the last call of the first traceback:
Code:
File "DynamicCivs", line 150, in setup

KeyError: 11
ERR: Python function onEvent failed, module CvEventInterface

That's where the problem is. KeyError is a python error that happens when you try to reference a non-existing key in a dictionary.

As for the rest, see if it still happens after the above is fixed. The error stops the event manager, so anything that happens afterwards can be related to that.

Religion founding is disabled, however. Re-enable it by uncommenting the following line in CvGame.cpp:
Code:
//doHolyCity(); // edead: disabled
 
I'm guessing I've done something wrong in my dynamicCivs.py file... :sad:

PS. Why does the file look so strange...
 

Attachments

  • DynamicCivs.rar
    2.9 KB · Views: 70
ok I understand what kind of error it is but not how its happening.

here's the part where the exception happens:

Code:
def setup(self):
		
		for iPlayer in range(con.iNumPlayers):
			self.setCivDesc(iPlayer, self.defaultNames[iPlayer])

and its a key error so its passing an iPlayer value that has no entry in the defaultNames dictionary, but there are 31 civs in Consts.py and 31 entries in the dictionary:

Spoiler :
self.defaultNames = {
con.iEgypt : "TXT_KEY_CIV_EGYPT_DESC_DEFAULT",
con.iNubia : "TXT_KEY_CIV_NUBIA_DESC_DEFAULT",
con.iCarthage : "TXT_KEY_CIV_CARTHAGE_DESC_DEFAULT",
con.iCelts : "TXT_KEY_CIV_CELTS_DESC_DEFAULT",
con.iSeleucids : "TXT_KEY_CIV_SELEUCIDS_DESC_DEFAULT",
con.iMauryans : "TXT_KEY_CIV_MAURYANS_DESC_DEFAULT",
con.iArmenia : "TXT_KEY_CIV_ARMENIA_DESC_DEFAULT",
con.iSaba : "TXT_KEY_CIV_SABA_DESC_DEFAULT",
con.iTocharians : "TXT_KEY_CIV_TOCHARIANS_DESC_DEFAULT",
con.iPandyans : "TXT_KEY_CIV_PANDYANS_DESC_DEFAULT",
con.iRome : "TXT_KEY_CIV_ROME_DESC_DEFAULT",
con.iHan : "TXT_KEY_CIV_HAN_DESC_DEFAULT",
con.iBactria : "TXT_KEY_CIV_BACTRIA_DESC_DEFAULT",
con.iParthia : "TXT_KEY_CIV_PARTHIA_DESC_DEFAULT",
con.iSatavahana : "TXT_KEY_CIV_SATAVAHANA_DESC_DEFAULT",
con.iDacia : "TXT_KEY_CIV_DACIA_DESC_DEFAULT",
con.iGoguryeo: "TXT_KEY_CIV_GOGURYEO_DESC_DEFAULT",
con.iKushans : "TXT_KEY_CIV_KUSHANS_DESC_DEFAULT",
con.iAxum : "TXT_KEY_CIV_AXUM_DESC_DEFAULT",
con.iFunan : "TXT_KEY_CIV_FUNAN_DESC_DEFAULT",
con.iSassanids : "TXT_KEY_CIV_SASSANIDS_DESC_DEFAULT",
con.iYamato : "TXT_KEY_CIV_YAMATO_DESC_DEFAULT",
con.iJin : "TXT_KEY_CIV_JIN_DESC_DEFAULT",
con.iGupta : "TXT_KEY_CIV_GUPTA_DESC_DEFAULT",
con.iFranks : "TXT_KEY_CIV_FRANKS_DESC_DEFAULT",
con.iChalukyans : "TXT_KEY_CIV_CHALUKYANS_DESC_DEFAULT",
con.iSrivajaya : "TXT_KEY_CIV_SRIVAJAYA_DESC_DEFAULT",
con.iTang : "TXT_KEY_CIV_TANG_DESC_DEFAULT",
con.iArabs : "TXT_KEY_CIV_ARABS_DESC_DEFAULT",
con.iGhana : "TXT_KEY_CIV_GHANA_DESC_DEFAULT",
con.iCordoba : "TXT_KEY_CIV_CORDOBA_DESC_DEFAULT",
}


and:

Spoiler :
iNumPlayers = 31
(iEgypt, iNubia, iCarthage, iCelts, iSeleucids, iMauryans, iArmenia, iSaba, iTocharians, iPandyans, iRome, iHan,
iBactria, iSatavahana, iParthia, iDacia, iGoguryeo, iKushans, iAxum, iFunan, iSassanids, iYamato, iJin, iGupta, iFranks,
iChalukyans, iSrivajaya, iTang, iArabs, iGhana, iCordoba) = range(iNumPlayers)


I WBed all 31 civs onto the map and all their names displayed correctly.
 
I'm guessing I've done something wrong in my dynamicCivs.py file... :sad:

PS. Why does the file look so strange...
What do you mean by "strange"?

The problem is that you haven't indented your checkTurn() method correctly (it should be an additional tab to the right). However, the method won't do what you'd like it to do anyway, first off because it's never called (you'd have to take care of that in RFCEventHandler.py). Also, you can't give the turn as an argument here (looks like you tried to do that) - it's a method definition, so you have to declare parameter names there.

Anyway, the easiest way to do this is not to use the DynamicCivs file because it doesn't have a checkTurn method and adding one really isn't worth the trouble. Simply use checkTurn in RiseAndFall instead and then add there (make sure of proper indentations):

Code:
if iGameTurn == getTurnForYear(1100):
        gc.getPlayer(iByzantium).setLeader(gc.getInfoTypeForString("LEADER_ALEXIOS")

That's assuming LEADER_ALEXIOS is a valid tag in the XML.
 
strange. I changed the name of my constant from iHan to iHanchina and it got rid of the exception. is there a rule about short words as constants?

everything running fine now. no exceptions or crashes through lots of auto play. thanks again for the mod and the help.

edit: everything but the province names, it still shows the SoI ones
 
Thanks Leoreth for your help! :)

So I did as you suggested but I'm still getting "you have been defeated" messages, whenever I start up a game. I added it to the Rise and Fall file, but it still seems to not be working, does something look wrong with the code?

And yes obviously there is a new LH called "ALEXIOS"
 

Attachments

  • RiseAndFall.rar
    18.9 KB · Views: 61
The check itself is okay, but it needs to be inside the checkTurn() method, right now it's not part of any method. Make sure you indent it one tab further there.
 
The check itself is okay, but it needs to be inside the checkTurn() method, right now it's not part of any method. Make sure you indent it one tab further there.

Thanks for your help Leoreth, but I thought you were a tad vague on what you just said, you mean I should write out something like this:

PHP:
if iGameTurn == getTurnForYear(1100):
                gc.getPlayer(iByzantium).setLeader(gc.getInfoTypeForString("LEADER_ALEXIOS")

Does this look better to you?
 
strange. I changed the name of my constant from iHan to iHanchina and it got rid of the exception. is there a rule about short words as constants?

There you go. Han is the name of the Sultanate of Rum's Unique Building, and iHan is the corresponding variable used in Const.py, declared after civs. Therefore, you used ended up using the same variable twice, and it pointed not to 11, but some other number used by the Han UB :)

edit: everything but the province names, it still shows the SoI ones

The only place where province names are declared is CIV4GameText_MEM_Regions.xml. Note however, that every province is declared TWICE (there's a short version, and a full version for tooltips, with added region data). You probably only changed one of them.
 
Thanks for your help Leoreth, but I thought you were a tad vague on what you just said, you mean I should write out something like this:

PHP:
if iGameTurn == getTurnForYear(1100):
                gc.getPlayer(iByzantium).setLeader(gc.getInfoTypeForString("LEADER_ALEXIOS")

Does this look better to you?

No, as Leoreth said, the code was OK, its the location that was wrong, and indendation of the whole block, not one line. The code has to be placed within a method (methods start with def keyword), and more precisely, within the checkTurn method, and indented like all the code that is within said method.
 
I'm having a strange problem using some regular BtS unit art in my SoI mod. I'm able to use almost all of the unit art defines I wanted to but the following crash the mod during xml checking, but don't generate any error messages: ART_DEF_UNIT_WORKER, ART_DEFINE_UNIT_GALLEY and ART_DEFINE_UNIT_WARLORD_ANCIENT. They crash regular SoI if I try to use them there as well. Any idea what might cause this?
 
I'm having a strange problem using some regular BtS unit art in my SoI mod. I'm able to use almost all of the unit art defines I wanted to but the following crash the mod during xml checking, but don't generate any error messages: ART_DEF_UNIT_WORKER, ART_DEFINE_UNIT_GALLEY and ART_DEFINE_UNIT_WARLORD_ANCIENT. They crash regular SoI if I try to use them there as well. Any idea what might cause this?

1. I removed unused art defines from CIV4ArtDefines_Units (& buildings), including the ones you mentioned, so if you want to use them you must copy them back from unmodded BTS.

2. Make sure they're spelled correctly (ART_DEF_ not ART_DEFINE_)
 
my 11 religions are all functioning properly now as far as I can tell but I'm a bit lost as to how to get them all onto the religion screen and the city screen. can you offer any guidance?
 
my 11 religions are all functioning properly now as far as I can tell but I'm a bit lost as to how to get them all onto the religion screen and the city screen. can you offer any guidance?

I don't remember really, this seems to be about basic religion modding for Civ4/BTS, isn't it? What exactly is wrong with the screens? Assuming everything else is fine, I'm sure you have to edit the icon positions in both files.

CvReligionScreen.py
self.X_RELIGION_START - position of the first icon
self.DX_RELIGION - distance between icons
If you want founding dates back, un-edit it back from unmodded BtS

CvMainScreen.py
search for # Holy City Overlay and decrease the red number until all the icons fit
xCoord = xResolution - 242 + (i * 29)
 
yeah sorry this is not really SoI specific but I thought you would know. I think you've told me enough already but if not I'll move it to a more appropriate forum. thanks again.
 
Top Bottom