How do you create a Dawn of Man pop-up at the start of a scenario?

wotan321

Emperor
Joined
Oct 25, 2001
Messages
1,228
Location
NC, USA
I have tried looking at the Desert war and the AmRev scenarios, but I am not making progress. Could someone tell me how this is done, please? What python files and code need to be there to get the DawnOfMan text info to show up?

Thanks for any help.
 
that's a very good question. it was on my schedule to ask also.
:)
 
How about some help here? Where are the mod makers who can do this? What python files need to be editted to make this work? I have looked over the Scenarios that have this feature but unless you have a knowledge of python it doesn't help.

I would appreciate any help.
 
I had a look in the event manager and found this:
Code:
def onGameStart(self, argsList):
		'Called at the start of the game'
		if (gc.getGame().getGameTurnYear() == gc.getDefineINT("START_YEAR")):
			for iPlayer in range(gc.getMAX_PLAYERS()):
				player = gc.getPlayer(iPlayer)
				if (player.isAlive() and player.isHuman()):
					popupInfo = CyPopupInfo()
					popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
					[B]popupInfo.setText(u"showDawnOfMan")[/B]
					popupInfo.addPopup(iPlayer)

You might already know this.
 
Thank-you ArneHD,

I have that in my file too, but no pop-up occurs. But I will double check to make sure I have now missed something.
 
That code shown in post #4 is what causes the Dawn of Man screen to appear on the first turn of Ancient Era starts. Games that start in eras other then Ancient, and generally scenarios, don't show it because they start with the turn counter at numbers other then 0. I am currently looking at making a small mod comp that will have the screen show at the first turn no matter the era or the scenario. :)

EDIT: The acual code of the Dawn of Man Screen is in /Assets/Python/Screens/CvDawnOfMan.py.
 
Jeckel,

thanks so much for this information. I look forward to your mod comp. How can I get my scenario to have a pop-up screen if it starts later? I have seen it in other mods, but cannot mimic it.
 
i've tried to get it from the WW1-mod/scen, but because of the lack of python-knowledge it won't work....
hope for your help Jeckel! :)
 
Ok, I think I figured it out.

As mentioned in an above post, you have this code in the event manager.

Code:
def onGameStart(self, argsList):
		'Called at the start of the game'
		[B]if (gc.getGame().getGameTurnYear() == gc.getDefineINT("START_YEAR")):[/B]
			for iPlayer in range(gc.getMAX_PLAYERS()):
				player = gc.getPlayer(iPlayer)
				if (player.isAlive() and player.isHuman()):
					popupInfo = CyPopupInfo()
					popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
					popupInfo.setText(u"showDawnOfMan")
					popupInfo.addPopup(iPlayer)

You need to change the bolded line to.

Code:
if (gc.getGame().getGameTurn() == gc.getGame().getStartTurn()) or (gc.getGame().countNumHumanGameTurnActive() == 1):

The first part (gc.getGame().getGameTurn() == gc.getGame().getStartTurn()) will cause the Dawn of Man screen to show in games that start in eras other then ancient.

The second part (gc.getGame().countNumHumanGameTurnActive() == 1) should cause the screen to show on the humans first turn when they start a scenario.

I haven't tested this code so please let me know if it does or doesn't work. :)
 
Alright, for those that don't like modding files, I whipped up a little modcomp that implements this change. For modders that want to incorp this with other mods it uses Dr. Elmer Jiggle's customeventmanager and does NOT modify the normal event manager file. I alse included a config.ini file with only a on/off option.

Here is the link to the thread

Thanx for the insperation, I'd been meaning to make this for awhile as it always bothered me. :)
 
Oops, had one small error in that file. Sorry to the person who dled it already, but I have uploaded the corrected version now. :)
 
..BUT I have another question.

I am working from the WW2SF&B mod and wanting to incorporate other mods into it, but still retain the events of that mod, and add the dawnofman screen at the beginning of the scenario. Below is from the CvEventInterfance.py file.

import CvUtil
import CvEventManager
import CvWWIIsfnbEvents
from CvPythonExtensions import *

#WWII SF&B OVERRIDE
wwiisfnbEventManager = CvWWIIsfnbEvents.CvWWIIsfnbEvents()
normalEventManager = CvEventManager.CvEventManager()

def getEventManager():
return wwiisfnbEventManager

def onEvent(argsList):
'Called when a game event happens - return 1 if the event was consumed'
return getEventManager().handleEvent(argsList)

def applyEvent(argsList):
context, playerID, netUserData, popupReturn = argsList
return getEventManager().applyEvent(argsList)

def beginEvent(context, argsList=-1):
return getEventManager().beginEvent(context, argsList)

Can you step me through this so I can understand what is going on? What file(s) will events be pulled from? Whats gonna happen when I try to incorporate Dr. Elmer Jiggle's stuff into this? Help me out here, please. I want to learn!
 
wotan321 said:
Wow Jeckel, you are impressive! Thanks.

Thanx, glad to help.

wotan321 said:
..BUT I have another question.

I am working from the WW2SF&B mod and wanting to incorporate other mods into it, but still retain the events of that mod, and add the dawnofman screen at the beginning of the scenario. Below is from the CvEventInterfance.py file.

Well, first, what is WW2SF&B? Give me a link to it so I can check it out and I can help ya better. :)
Specificly to integrating these mods, the best idea is to make this WW2SF&B mod use the Dr. custom event manager, but that might be a tall order depending on your python knowledge, time constraints, and how that mod is written. The simplest solution is to make that one line change I posted in post #9. The mod I made with this change is just for those people that dislike making any changes in python on their own.

But to the more general question, I'm happy to help ya out with some explanation, here is the basics of what that file you posted is doing. Its pretty simple once ya get the hang of it.

Code:
from CvPythonExtensions import *
import CvUtil

This is importing the main python methods and classes and whatnot. For what all these make available, do a google for the Civ4 python API.

Code:
import CvEventManager

This just registers the normal event manager.

Code:
import CvWWIIsfnbEvents

#WWII SF&B OVERRIDE
wwiisfnbEventManager = CvWWIIsfnbEvents.CvWWIIsfnbEvents()
normalEventManager = CvEventManager.CvEventManager()

First this is importing the two event manager files to the local python name space. The bottom two lines are initializing a class instance of each event manager.

Code:
def getEventManager():
return wwiisfnbEventManager

This method just returns the class instance set in the above blurp.

Code:
def onEvent(argsList):
'Called when a game event happens - return 1 if the event was consumed'
return getEventManager().handleEvent(argsList)

def applyEvent(argsList):
context, playerID, netUserData, popupReturn = argsList
return getEventManager().applyEvent(argsList)

def beginEvent(context, argsList=-1):
return getEventManager().beginEvent(context, argsList)

These three methods just get data from the hardcode when events are run and they pass it to the mentioned methods in the file CvWWIIsfnbEvents.py. This whole file is what is know as a 'wrapper' in that it doesn't really do anything but take information and pass it on to somthing else. It seems like most of the work is done in the CvWWIIsfnbEvents.py file, look through it and if you have any questions just post them and i'll be happy to help.
 
Thanks again Jeckel,

WW2SF&B is Paasky's World War 2, Small Fast and Beautiful mod/scenario, its in the general "Creation & Customization" directory.

There is a file in his Python directory called CvWWIIsfnbEvents.py, but not a CvEventManager.py as there is in many mods. Does it find the default version of that file back in the Vanilla Python directory?

Also, just to make sure I am clear on this, are you saying that both of those .py files are available for use for events during the game?

Thanks again.
 
..so what I did was take that piece of code.... btw Jeckel, I am not a python programmer so much of your discussion of "pass to methods" and stuff like that just goes right over my head... but I am attempting to understand. I appreciate your patience.

...so what I did was take that piece of code from the vanilla CvEventManager (since this WW2sfb doesn't have that file in the mod directory) and plopped it into the CvWWIIsfnbEvents.py file under the onGameStart section. I then edited that one line as per your earlier instructions, and ka-ching!, it worked like a charm.

So here is my next query. If I am to integrate DEJ code into this whole process, should all the code Dr. Jiggle puts in the CvCustomEventManager.py file instead be put in ww2sfb's mod's CvWWIIsfnbEvents.py file. Would that work? Or would it make more sense, due to the fact many of the components I want to add use Dr. Elmer Jiggles schema, to instead take the code from the CvWWIIsfnbEvents.py file and put it in DEJ's CvCustomEventManager.py file, and run it that way?

I need more coffee....<g>
 
No you can't just copy pasky's code into dej's eventmanager. I dled the files up attached in DEJ's civ4lerts thread and looked through it and it is a bit complex.

Before you try combining or changing it your going to have to have some understanding of python. Have you read any nonciv python tutorials?

I recomend reading and bookmarking this main python tutorial.

If you are really not trying to have ta learn python, then I would suggest bugging pasky to change his mod to use the DEJ's customevent manager, it shouldn't be to hard for paasky to change it over.

If I get some free time over the next couple days I'll look through those files and see if I can break down to you a simple way to combined that stuff together. :)
 
If I get some free time over the next couple days I'll look through those files and see if I can break down to you a simple way to combined that stuff together.

If you do that, I will be eternally grateful. I have begrudgingly read a number of the tutorials available on this site regarding python, and DON'T want to have to make the effort to learn it, but it seems that I should, and am out of necessity, and that's just fine. Its simply lack of free time and laziness that stands in my way of learning, I am a computer techinician and trainer by vocation.... but not a programmer... though I can whip up one impressive batch file if needed.... I enjoy the modding POWER that learning this gives, so I expect I will pursue it... but in the mean time I can use all the info I can get, and your shared knowledge will really help.

If you explain this process as you look over the files, you will be helping me and a bunch of other noobs who really want to understand the process. If I can get a useful grasp of it, I would like to put together some step by step instructions directed specifically to the files in question, instead of "python in general".

Again, thanks. You have already been a great help.

I have quizzed Paasky about it, and hopefully all the folks contribuiting insight will properly educate me.
 
Back
Top Bottom