Cool Popups that don't work

renegadechicken

Warlord
Joined
Aug 12, 2007
Messages
227
Location
Civ II Verne Scenario
Preamble: I'm adding events to the Final Frontier mod, and they're coming along nicely, and actually nearing completion. However, I had a thought: how cool would it be to add visuals to these events? This led me to...

My Goal: I would like to add a PopUp that appears when an event is triggered just before the actual event box and options come up. For example, I have an event where your colonists can discover the ruins of an advanced alien civilization on one of the worlds in one of your systems (in Final Frontier, a system is a city). Wouldn't it be cool to have a PopUp appear with a picture of some alien ruins? It would be titled as such, and you would click "Ok", and then make your choices on what to do (like any normal event), like plunder any wealth, or study the ruins for beakers, etc.

The Problem: Try as I might, I can't get ANY custom PopUps to work. The event triggers perfectly and I can make whatever choice I want with no problems, but the PopUp simply does not...well, pop up!

The Technical Stuff: Here is what I have, so you can see what I've done and point out what I've done wrong. :)

First off, since I want the PopUp to appear before the event choices come up, I went into the Civ4EventTriggerInfos.xml file and added a Python tag to the correct section:
Spoiler :

<EventTriggerInfo>
<Type>EVENTTRIGGER_ALIEN_RUINS</Type>​
<WorldNewsTexts>​
<Text>TXT_KEY_EVENTTRIGGER_ALIEN_RUINS</Text>​
</WorldNewsTexts>​
<TriggerTexts>​
<TriggerText>​
<Text>TXT_KEY_EVENT_TRIGGER_ALIEN_RUINS</Text>​
<Era>NONE</Era>​
</TriggerText>​
</TriggerTexts>​
<bSinglePlayer>0</bSinglePlayer>​
<iPercentGamesActive>100</iPercentGamesActive>​
<iWeight>-1</iWeight>​
...​
<iMinPopulation>4</iMinPopulation>​
...​
<Events>​
<Event>EVENT_ALIEN_RUINS_1</Event>​
<Event>EVENT_ALIEN_RUINS_2</Event>​
<Event>EVENT_ALIEN_RUINS_3</Event>​
</Events>​
...​
<bPickCity>1</bPickCity>​
...​
<PythonCallback>doAlienRuinsPopUp</PythonCallback>​
</EventTriggerInfo>

This event has been edited to be non-random for testing purposes. Basically I've set it up to trigger once ANY city reaches size 4 so that I can easily test it. Once any city reaches size 4, the PopUp is supposed to trigger, the player will press ok, and then they are presented with 3 choices (EVENT_ALIEN_RUINS_1, 2, and 3). However, the event fires, skips the PopUp, and goes right to the choices. In other words, it works perfectly and just like any normal BTS event, but the PopUp never shows up!

Now let's move on to the Python code I've added that should create the custom PopUp. Since I'm dealing with a random event, I went into the CvRandomEventInterface.py file and added the following code to the end of the document:

Spoiler :

######## Alien Ruins ########

def doAlienRuinsPopUp(argsList):
kTriggeredData = argsList[1]​
player = gc.getPlayer(kTriggeredData.ePlayer)​
if player.isHuman():​
popup = PyPopup.PyPopup(-1)​
popup.addDDS('art/interface/popups/alienruins.dds', 0, 0, 256, 512)​
popup.addSeparator()​
popup.setHeaderString('Alien Ruins')​
popup.setBodyString('The ruins of an ancient alien civilization have been discovered on one of our worlds!')​
popup.setPosition(256,128)​
popup.setSize(512,512)​

popup.launch(true, PopupStates.POPUPSTATE_QUEUED)​

Now, I'm no expert at Python, but I do know enough to get me by. This PopUp code is basically copied and pasted from Kael's "HOW TO: Add Popups" article here on CivFanatics, so it should work, right? Basically, I want the PopUp to appear only if the triggered player is human (I don't want to push PopUps onto the AIs, because they probably wouldn't know what to do), I want it to be a simple "press OK to continue" deal, I want it to display a picture, and I want it to have a bit of descriptive text. And, as stated previously, I want it to occur right before the actual event options appear. Once again, however, the PopUp fails to appear, though the event triggers and executes perfectly.

To sum up, I'm wondering why the PopUp isn't appearing. Is it because I have the Python code in the wrong place? Have I screwed up the Python? Is what I want, simple though it may be, impossible? :)

Thank you in advance for any help or insights you can share!
 
I would suggest downloading the DCM mod! It has a popup that pops up after a few turns, and has a nice little box you could copy and put into your mod. I did exactly that with my mod, just used his popup and changed when it popped up and what it said....

Also, not completely sure but I don't think that <PythonCallback> is a valid XML definition, but I could be wrong.

sorry I couldn't be more helpful.

Shiggs
 
Is the DCM mod Dale's Combat Mod? I'll check it out and see if the popup works. I've been trying to use popups from FFH2 and from the tutorial on this site, but it simply won't pop up. I can't even get popups to appear just based on the game turn number! They simply will not work for me in Final Frontier.

Maybe I'm missing a Python file? I added CustomFunctions.py and "something"Popups.py from FFH2, but they still don't work. It's very frustrating, because I've been working for about 5 days just trying to get a single popup to appear, and it has never worked once. I'm pretty sure the code is solid, since no one has said otherwise, and it's copied and pasted from popups that I know work, so...I just don't get it.

Oh, and I have it confirmed that <PythonCallback> is a valid definition. Thanks for the ideas and suggestions, though!

Anyone else have any ideas?
 
Top Bottom