Requesting following features

ah right so it is your function that is wrong becuase it doesn't match the C++ version I will try with mine to see if there is a problem with the path

edit: as I suspected.... No module called winsound

:rolleyes:

How do I import winsound? I guess it is back to you to try and fix that function...
 
right I think I have got it

you have been using the wrong order
def addMessage(tag, tValues, eColor, tCoords=(-1, -1), sound="")

addMessage(peaceMessage, (instance(eTeam1).getName(), instance(eTeam2).getName()), eGreen, peaceSoundPath)

you didn't account for the tCoords :rolleyes:

I will fix and check

edit: right, exception is gone I fixed it, however the sound isn't working so I will try and put the sound in the python folder and see if that works (it didn't :think:), may need the XML? Also the message is:

"Gallic has made peace with Iberian" which should be "Brennus has made peace with Virathrus"

how do I get the leaders names and not the civ adjective? not using getName?

found this in the xml: (audiodefines.xml)
Code:
		<SoundData>
			<SoundID>SND_MAKEPEACE</SoundID>
			<Filename>Sounds/TheirMakePeace</Filename>
			<LoadType>DYNAMIC_RES</LoadType>
			<bIsCompressed>1</bIsCompressed>
			<bInGeneric>1</bInGeneric>
		</SoundData>
		<SoundData>
			<SoundID>SND_THEIRMAKEPEACE</SoundID>
			<Filename>Sounds/TheirMakePeace</Filename>
			<LoadType>DYNAMIC_RES</LoadType>
			<bIsCompressed>1</bIsCompressed>
			<bInGeneric>1</bInGeneric>
		</SoundData>
should I be using soundPath = "SND_MAKEPEACE"? actually this didn't work so I think I need this: AS2D_MAKEPEACE which is the Audio2DScript YES! I HAVE DONE IT! I am so happy right now :D:D:D For future reference (this is you learning now) when you wanna make a sound you have got to define it and call it from the XML. you need the sound in Audio2DScripts or Audio3DScripts
in a string form... Now we need to make it so that it doesn't happen for rebels and show the leaders in the message... any ideas?

Code:
	<TEXT>
		<Tag>TXT_KEY_CUSTOMFEATURES_PEACE</Tag>
		<English>%s1_PlyrName has made peace with %s2_PlyrName!</English>
		<French>%s1_PlyrName a fait la paix avec %s2_PlyrName !</French>
		<German>%s1_PlyrName hat mit %s2_PlyrName Frieden geschlossen!</German>
		<Italian>%s1_PlyrName ha siglato la pace con %s2_PlyrName!</Italian>
		<Spanish>%s1_PlyrName ha firmado la paz con %s2_PlyrName.</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_CUSTOMFEATURES_PEACE_YOU</Tag>
		<English>You have made peace with %s1_PlyrName</English>
		<French>Vous avez fait la paix avec%s1_PlyrName</French>
		<German>Ihr habt Frieden mit Team %s1_PlyrName geschlossen!</German>
		<Italian>Hai fatto pace con %s1_PlyrName</Italian>
		<Spanish>Hab&#233;is firmado la paz con %s1_PlyrName</Spanish>
	</TEXT>

for the audio
	<Script2DSound>
		<ScriptID>AS2D_MAKEPEACE</ScriptID>
		<SoundID>SND_MAKEPEACE</SoundID>
		<SoundType>GAME_INTERFACE</SoundType>
		<iMinVolume>80</iMinVolume>
		<iMaxVolume>80</iMaxVolume>
		<iPitchChangeDown>0</iPitchChangeDown>
		<iPitchChangeUp>0</iPitchChangeUp>
		<iMinLeftPan>-1</iMinLeftPan>
		<iMaxLeftPan>-1</iMaxLeftPan>
		<iMinRightPan>-1</iMinRightPan>
		<iMaxRightPan>-1</iMaxRightPan>
		<bLooping>0</bLooping>
		<iMinTimeDelay>0</iMinTimeDelay>
		<iMaxTimeDelay>0</iMaxTimeDelay>
		<bTaperForSoundtracks>0</bTaperForSoundtracks>
		<iLengthOfSound>0</iLengthOfSound>
		<fMinDryLevel>1.0</fMinDryLevel>
		<fMaxDryLevel>1.0</fMaxDryLevel>
		<fMinWetLevel>0.0</fMinWetLevel>
		<fMaxWetLevel>0.0</fMaxWetLevel>
		<iNotPlayPercent>0</iNotPlayPercent>
	</Script2DSound>
 
Oh boy. I'll get back to you with this tonight. :p
 
That post was edited so many times it looks like me speaking live as I test :p I will eagerly await your reply because I really want to restrict the messages and make the leaders name appear... then I have to work on chaning the message if the player is involved
 
Change the addPeaceMessage() function to this:
Code:
def addPeaceMessage(bWar, eTeam1, eTeam2):
        if ( not bWar
             and eTeam1 != Game.getActivePlayer() != eTeam2
             and isMajorCiv(instance(eTeam1))
             and isMajorCiv(instance(eTeam2)) ):
                addMessage(peaceMessage, (getLeaderName(eTeam1), getLeaderName(eTeam2)), eGreen, (-1, -1), peaceSoundPath)
And add this helper:
Code:
def getLeaderName(ePlayer):
        return gc.getLeaderHeadInfo(instance(ePlayer).get(CyPlayer).getLeaderHeadType()).getDescription()
I don't know where you currently store the helper functions, so I guess it would go where the rest are located.
 
Helpers of course :rolleyes:

then again you have some in custom features (which I might move :p)

what does the function you changed do? And I didn't know you could use brackets in conditions like that!

edit: should this function even have from helpers import in it as the module itself imports helper?
Code:
def showPopup():
        from Helpers import showPopup
        showPopup(popupHeader, popupMessage)
 
what does the function you changed do?
It uses the leader names instead of the Civ names, and it rules out non major players involved in peace deals. That is what you ordered, right?

And I didn't know you could use brackets in conditions like that!
You mean the parenthesis? You can always split code up into several lines by wrapping it up in parenthesis. This is one of the few actual uses for parenthesis with Python, while people regularly use them when the do nothing, at all.

edit: should this function even have from helpers import in it as the module itself imports helper?
I understand how that looks weird, but it works, right? I guess its just a ad-hoc solution I opted for before because of things being named the same thing in modules. It shouldn't be anything to worry about.
 
ok exception time!

raceback (most recent call last):

File "CvEventInterface", line 23, in onEvent

File "CvEventManager", line 187, in handleEvent

File "CvEventManager", line 857, in onChangeWar

File "CustomFeatures", line 173, in addPeaceMessage

File "Helpers", line 369, in getLeaderName

AttributeError: 'CyPlayer' object has no attribute 'getLeaderHeadType'
ERR: Python function onEvent failed, module CvEventInterface

looks like your leaderhead type doesn't work as planned....

Also the rebels and all the minor civs do not get peace messages... Niether does the human (I know why and will add in the nessicary code to give them the message back when the exception is fixed!) so congratulations on that part!
 
looks like your leaderhead type doesn't work as planned....
Typo... It should be getLeaderType() - no "Head" in there.
Niether does the human (I know why and will add in the nessicary code to give them the message back when the exception is fixed!) so congratulations on that part!
No, you don't need to add anything. Everything should already be in place. Focus on testing what I submitted.
 
Nope I have to add something or the player doesn't ever get peace messages :p

anyway I will test
 
Nope I have to add something or the player doesn't ever get peace messages :p
What? The human player should only get the "You made peace..." messages, right? So I conditioned out the human player for the "That leader made peace with this leader" messages for the human player.
 
yes you did, however... no one put any human peace messages in :p I will do that now

Also you will be happy to know that "Brennus has made peace with Alexander" :p (if you havent guessed already that means it works! Rebels get none, I will add in ones for human and the sound works!)
 
Code:
def addPeaceMessage(bWar, eTeam1, eTeam2):
        if not bWar:
                if (eTeam1 != Game.getActivePlayer() != eTeam2
                    and isMajorCiv(instance(eTeam1))
                    and isMajorCiv(instance(eTeam2)) ):
                        addMessage(peaceMessage, (getLeaderName(eTeam1), getLeaderName(eTeam2)), eGreen, (-1, -1), peaceSoundPath)
                elif ( eTeam1 == Game.getActivePlayer()
                       and isMajorCiv(instance(eTeam2)) ):
                        addMessage(peaceMessage2, getLeaderName(eTeam2), eGreen, (-1, -1), peaceSoundPath)
                elif ( eTeam2 == Game.getActivePlayer()
                       and isMajorCiv(instance(eTeam1)) ):
                        addMessage(peaceMessage2, getLeaderName(eTeam1), eGreen, (-1, -1), peaceSoundPath)
This function doesn't allow any rebels to get messages and for both Human and AI to

(getLeaderName(eTeam1),) actually :rolleyes:

It works perfectly, In fact this python method means that the message is displayed on the diplomacy section of the worldbuilder (which it doesn't normally), a very handy side effect!
 
No, you shouldn't need that. Asaf only disabled the first peace message, right?
 
nope everything regarding it... and belive me I did need it :p now it works just like normal (it didn't before I put that in, seriously I tested around 1000 times last night and the human never got any :p) if he only disabled one then it would still say "You have made peace with rebel" the thing we wanted gone in the first place :p
 
That means that Asaf disabled both variety of peace messages. Good job! :goodjob:
 
good job me or him :p It was a good thing he did otherwise the rebels would stil make peace the the human..

Good job for you to :p I am very proud of myself for yesterdays work though :D
 
Good jobs all-around. :king:

Next up: Historical City Naming.
 
any idea when that will be btw? looking forward to working on it! (yes I will try and be a bigger part of it and actually do more ocding than usual, I really need to improve my civ4 python skills as the focus has been on standard programming recently and I have a lot I need to learn, for I am rarely stumped on a solution except in civ4 :p and there is abviously lots you can teach me)
 
Back
Top Bottom