View Full Version : Question for a mod ?


frenchman
Oct 29, 2006, 12:20 PM
Does some know if it's possible to let appear a screen like the ones of the era when a civ is destroyed by an other ?
In the game, we have just a text and I have still not find the XML or python file which manages this ...

NikNaks
Oct 31, 2006, 04:37 AM
Well Patricius did something similar when a Great Person was born. His mod is here (http://forums.civfanatics.com/showthread.php?t=153506). Why don't you try and see what sort of thing to do from that.

NikNaks
Oct 31, 2006, 08:21 AM
I notice that Fall From Heaven 2 does that...

Vehem
Oct 31, 2006, 11:18 AM
I notice that Fall From Heaven 2 does that...

Using this as the basis for the answer...

Fall from Heaven accomplishes this using the "onSetPlayerAlive" event in CvEventManager.py.

The code is called as;

def onSetPlayerAlive(self, argsList):
'Set Player Alive Event'
iPlayerID = argsList[0]
bNewValue = argsList[1]

#If the player is dead...
if bNewValue == False:
pPlayer = gc.getPlayer(iPlayerID)
#Find out who died then report it...
if pPlayer.getLeaderType() == gc.getInfoTypeForString('LEADER_ALEXIS'):
cf.FFHAddPopup(CyTranslator().getText("TXT_KEY_POPUP_DEFEATED_CALABIM",()),'art/interface/popups/Alexis.dds')
if pPlayer.getLeaderType() == gc.getInfoTypeForString('LEADER_AMELANCHIER'):
cf.FFHAddPopup(CyTranslator().getText("TXT_KEY_POPUP_DEFEATED_LJOSALFAR",()),'art/interface/popups/Amelanchier.dds')

...


...with additional entries for each additional civilisation with specific text.

Obviously "FFHAddPopup" is a custom function too, but it works as follows

def FFHAddPopup(self, szText, sDDS):

#Get a string from the current game date
szTitle = self.szGameDate = CyGameTextMgr().getTimeStr(CyGame().getGameTurn(), false)
#Create a PyPopup object to use
popup = PyPopup.PyPopup(-1)
#Add the image file for the civilization that was passed in
popup.addDDS(sDDS, 0, 0, 128, 384)
#Add the separator, make a heading out the the date string, add the body text and launch the popup.
popup.addSeparator()
popup.setHeaderString(szTitle)
popup.setBodyString(szText)
popup.launch(true, PopupStates.POPUPSTATE_QUEUED)



All the code above is taken straight from Fall from Heaven 2 016d, which I am not affiliated with (just obsessed with...). Only the comments are mine, all coding credit to the authors - hopefully you'll find it useful.

frenchman
Oct 31, 2006, 01:57 PM
:thanx:

I will try this as soon as possible...

Here a preview of the static leaders I'm working on this is Alexander:
http://forums.civfanatics.com/uploads/34626/Alexander-preview2.jpg


I have done the draft of Cyrus, Joan of Arc, Isabella, Elizabeth, Catherine...
I would like to manage the different attitude of these leaders cautious, annoyed, etc...
And to add a screen when the civ is destroyed...
To be continued...

:thanx:

frenchman
Nov 01, 2006, 03:20 PM
Using this as the basis for the answer...

Fall from Heaven accomplishes this using the "onSetPlayerAlive" event in CvEventManager.py.

The code is called as;

def onSetPlayerAlive(self, argsList):
'Set Player Alive Event'
iPlayerID = argsList[0]
bNewValue = argsList[1]

#If the player is dead...
if bNewValue == False:
pPlayer = gc.getPlayer(iPlayerID)
#Find out who died then report it...
if pPlayer.getLeaderType() == gc.getInfoTypeForString('LEADER_ALEXIS'):
cf.FFHAddPopup(CyTranslator().getText("TXT_KEY_POPUP_DEFEATED_CALABIM",()),'art/interface/popups/Alexis.dds')
if pPlayer.getLeaderType() == gc.getInfoTypeForString('LEADER_AMELANCHIER'):
cf.FFHAddPopup(CyTranslator().getText("TXT_KEY_POPUP_DEFEATED_LJOSALFAR",()),'art/interface/popups/Amelanchier.dds')

...


...with additional entries for each additional civilisation with specific text.

Obviously "FFHAddPopup" is a custom function too, but it works as follows

def FFHAddPopup(self, szText, sDDS):

#Get a string from the current game date
szTitle = self.szGameDate = CyGameTextMgr().getTimeStr(CyGame().getGameTurn(), false)
#Create a PyPopup object to use
popup = PyPopup.PyPopup(-1)
#Add the image file for the civilization that was passed in
popup.addDDS(sDDS, 0, 0, 128, 384)
#Add the separator, make a heading out the the date string, add the body text and launch the popup.
popup.addSeparator()
popup.setHeaderString(szTitle)
popup.setBodyString(szText)
popup.launch(true, PopupStates.POPUPSTATE_QUEUED)



All the code above is taken straight from Fall from Heaven 2 016d, which I am not affiliated with (just obsessed with...). Only the comments are mine, all coding credit to the authors - hopefully you'll find it useful.

I have tried all the day but nothing work... When I destroy a civ nothing appears (of course I havemodified the files, replaced all the names by the classical ones... and put the picture in the right place)...
:confused: