Request: Alerts about other CIVs tech advance acquisition

Jorunkun

AdvCiv for life
Joined
Oct 8, 2005
Messages
372
Location
Paris
Has anybody come up with a mod/in-game-tool that alerts you if another CIV that you are in contact with acquires a tech advance?

This is a feature that was in previous versions of CIV and that I miss. The notifications should only appear after you have access to the alphabet and should only include information that can be gleaned from the tech-trading screen, i.e. no notifications of techs when you do not know the prerequisite tech or have yet to meet the civilisation.

This would come in handy in situations when you are hoarding a tech but plan to give it away once the first competitor has it (i.e. Alphabet) or when your military plans hinge in an opponent not getting access to a tech like Feudalism.

Please let me know if this exists - or you would be willing to mod it. Would sure be much appreciated.

Thanks,

J.
 
I don't know if anyone's done it before, but it only took 10 minutes so I just hacked something together for you. If you have your own mod going, you'd add this in your event manager in a function called for a 'techAcquired' event:

Code:
# --------------- Begin tech notification mod ------------------------
                if( iPlayer > -1 and not iTeam == gc.getActivePlayer().getTeam() ) :
                    if (gc.getGame().isFinalInitialized() and not gc.getGame().GetWorldBuilderMode()):
                        iAlphabet = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_ALPHABET')
                        activeTeam = gc.getTeam( gc.getActivePlayer().getTeam() )

                        if( activeTeam.isHasTech(iAlphabet) and activeTeam.canContact(iTeam) ) :
                            mess = "The %s have acquired %s."%(gc.getPlayer(iPlayer).getCivilizationDescription(0), gc.getTechInfo(iTechType).getDescription())
                            CyInterface().addImmediateMessage(mess,"")

		# --------------- End tech notification mod ------------------------

Will display a notification message when you have alphabet and can contact the team that acquired the tech. If you just want this feature, here's a copy of CvEventManager.py with this coded added. The easy but very bad way to add this would be to (after backing up the original) replace the one in Assets\Python. I think it will work if you place it in your CustomAssets\Python folder, but I haven't tried that.

Note that this is a Warlords CvEventManager!
 

Attachments

I saw this request a couple days ago and wrote up something, but didn't get a chance to post. This has the same function as jdog5000 with a few differentes.

It doesn't use getActivePlayer so is more OOS friendly and it also iters through all players and sends the message to all human players and not just the one on the active machine, again for multiplayer compatibility. I will prob put this in a modcomponent when I get some free time this week. :)

EDIT: Oops, forgot to acually put the code block up, here ya go..

Code:
		iTotalPlayers = gc.getMAX_PLAYERS()

		for iTempPlayer in iTotalPlayers:
                        pTempPlayer = gc.getPlayer(iTempPlayer)
                        iTempTeam = pTempPlayer.getTeam()
                        pTempTeam = gc.getTeam(iTempTeam)
                        if (iTempPlayer > -1) and (iTeam != iTempTeam) and (pTempPlayer.isHuman()):
                                if (gc.getGame().isFinalInitialized()) and (not gc.getGame().GetWorldBuilderMode()):
                                        iAlphabet = gc.getInfoTypeForString("TECH_ALPHABET")
                                        if (pTempTeam.isHasTech(iAlphabet)) and (pTempTeam.canContact(iTeam)):
                                                strMessage = "The %s have acquired %s."%(gc.getPlayer(iPlayer).getCivilizationDescription(0), gc.getTechInfo(iTechType).getDescription())
                                                CyInterface().addMessage(iTempPlayer, True, gc.getDefineINT("EVENT_MESSAGE_TIME_LONG"),
                                                                         szString, None, 0, None, ColorTypes(-1),
                                                                         0, 0, True, True)

EDIT2: Also, just FYI, I haven't acually tryed this code yet, so if someone can try it an let me know if it works that would be great. :thanx:
 
Jeckel said:
It doesn't use getActivePlayer so is more OOS friendly and it also iters through all players and sends the message to all human players and not just the one on the active machine, again for multiplayer compatibility. I will prob put this in a modcomponent when I get some free time this week. :)
I was thinking that since it's just putting up messages, not determining any kind of game state, it wouldn't cause OOS errors ... is this wrong? I admit I don't really understand how the multiplayer side of things works.
 
jdog5000 said:
I was thinking that since it's just putting up messages, not determining any kind of game state, it wouldn't cause OOS errors ... is this wrong? I admit I don't really understand how the multiplayer side of things works.


I also don't play multiplayer games, well other then hotseat and those don't seem to have OOS errors ever, but from what I've read I take it to be that getActivePlayer tends to cause OOS errors under alot of surcomstances you wouldn't think it would. So I tend to follow the rule that it is best just not to use it. I guess you could consider this idea to be a bit of "cargo code" (<== neat little term and quite common practice in both coding and the rest of life, if anyone hasn't heard it before just google it or look it up on wikipedia :p), but if nothing else, the main difference between the ways we did it, is my code block will put it on the screen for each human on other teams where as yours would only show it on the screen of the human player that is active when the AI acually learns the tech, which in hotseat games I play always ends up being after the last human player ends their turn and all the ais are take their turns. :cry:



Bottom line, don't take me to be the definitive word on what will be OOS error and what won't, but just know getActivePlayer is known to OOS error and gc.getPlayer(iPlayer) has never been known to cause it. Beyond that its really just a personal choice and won't ever matter to most people as we all tend to just play SP games anyway. :cool:


Anyway, hope that clears it up for ya. :)
 
Back
Top Bottom