Wonder movie trigger question

Lemon Merchant

Not Quite Sonic
Retired Moderator
Joined
Jun 27, 2008
Messages
8,773
Location
Red Sector A
@ Phungus:

I'm experimenting with Wonder movies in my game, and I was trying to add movies for the National Wonders. I found the bik files from Arian, and the religion bik files, too. I was using the movie XML structure in LoR as a tutorial example, and after some fiddling, I can get the religion movies to work.

But I can't, for the life of me, get the Nat Wonder movies to trigger, and I can't find the right code in LoR to show me the way. I tried the Modiki, but that example code doesn't seem to be in LoR at all. I have the pathing, and all of the files in the right spots. I just seem to be missing a critical piece of code to make it happen. Could you please help out the "Dumb Learning to Mod Chick?" :D
 
LoR had the National Wonder movies stop working when the RevDCM core was updated to 2.5. I've left all the XML files in and kept things the same so that when it gets fixed they'll be working again, but for now they just don't work. I'm pretty sure this is a python thing, probably something in CvMainInterface.py or a similar file; my hunch is that the BUG 4.0 merge broke them. I've got too much other stuff I'd rather work on then this, it's just not an important thing for me. This sounds like a project you could pick up, with the added bonus you'd get to fiddle with python and learn some elite programming skills; post a thread on it in the Python/SDK forum :p
 
This sounds like a project you could pick up, with the added bonus you'd get to fiddle with python and learn some elite programming skills; post a thread on it in the Python/SDK forum :p
Oh my! Me? "Elite programming skills?" :lol:

But thanks for the answer. I have a terrific reason to learn this stuff, so I'm fooling around atm, trying to absorb what I can. I'll check the Python forum. :crazyeye:

-Lemon the Great Big Sponge
 
I don't know exactly, how it's in LoR, but in normal civ, in CvEventManager.py after onBuildingBuilt there's a check, if a building is a worldwonder, and only then a movie is shown. I'm not sure, how you can enable that in general for national wonders, but you can hardocde it for specific buildings, if you want and if that's enough.
 
Thanks the_J

So for LoR you would need to copy CvEventManager.py into the main Python folder (this function is not in any of BUG's files, and CvEventManager is imported in BugEventManager, so despite the fact EF tells you to move things out of CvEventManger that are in most python mods into a BUG style format, for this you have to alter a BtS CvEventManeger function, so you have to use it). Just removed the striked out code, and it should work. I haven't tested it yet, so you will need to check it to make sure this works:

Code:
	def onBuildingBuilt(self, argsList):
		'Building Completed'
		pCity, iBuildingType = argsList
		game = gc.getGame()
		if ((not gc.getGame().isNetworkMultiPlayer()) and (pCity.getOwner() == gc.getGame().getActivePlayer())[s] and isWorldWonderClass(gc.getBuildingInfo(iBuildingType).getBuildingClassType())[/s]):

The_J do you know where the function that creates the global UnitKilled sound for a unit with a Great General Promotion is located? I can't find it, and I'd like to add a check for global limited units (Legends), so that a global message is sent when a Legendary unit is killed, just like a unit lead by a Warlord.
 
Edit: Actually that probably wol't work. This code works though, just tested it:

Code:
	def onBuildingBuilt(self, argsList):
		'Building Completed'
		pCity, iBuildingType = argsList
		game = gc.getGame()
		bCoolBuilding = False
		if ( (gc.getBuildingClassInfo(gc.getBuildingInfo(iBuildingType).getBuildingClassType()).getMaxGlobalInstances() > -1) or (gc.getBuildingClassInfo(gc.getBuildingInfo(iBuildingType).getBuildingClassType()).getMaxPlayerInstances() > -1) or (gc.getBuildingClassInfo(gc.getBuildingInfo(iBuildingType).getBuildingClassType()).getMaxTeamInstances() > -1) ):
			bCoolBuilding = True
		if ((not gc.getGame().isNetworkMultiPlayer()) and (pCity.getOwner() == gc.getGame().getActivePlayer()) and bCoolBuilding):
			# If this is a wonder...


Edit2:
Actually, this is the code that will be going into RevDCM and LoR, as it uses the initial check (if the building is a world wonder), and so maintains normal BtS behavior (always gives you the little highlight and close up of city with a pop up if you build a wonder), while at the same time adding the same effect to any building the modder decides to add a movie to:

Code:
	def onBuildingBuilt(self, argsList):
		'Building Completed'
		pCity, iBuildingType = argsList
		game = gc.getGame()
		bCoolBuilding = False
		if ( (gc.getBuildingInfo(iBuildingType).getMovie()) or (isWorldWonderClass(gc.getBuildingInfo(iBuildingType).getBuildingClassType())) ):
			bCoolBuilding = True
		if ( (not gc.getGame().isNetworkMultiPlayer()) and (pCity.getOwner() == gc.getGame().getActivePlayer()) and bCoolBuilding ):
			# If this is a wonder...
 
The_J do you know where the function that creates the global UnitKilled sound for a unit with a Great General Promotion is located? I can't find it, and I'd like to add a check for global limited units (Legends), so that a global message is sent when a Legendary unit is killed, just like a unit lead by a Warlord.

Haven't seen anything like that in any files, i don't know, sorry :dunno:.
But because some great general related things are hardcoded in the SDK, i would also guess it for that.

Edit: Actually that probably wol't work. This code works though, just tested it:

Why did the first one not work?
 
Thank you boys. I've been eavesdropping, :eek:

I'm going to try and see if I can get my thing to work this way. I'll post if it works for me.

A big hug for both of you. :D
 
Why did the first one not work?
Well it worked. It just made it so any building that was built would cause the city zoom with flash and pop up, like occurs for a wonder. You don't want that for every building, so i needed to put back in a couple checks so you'd only get the wonder effect if the building was set up to have a movie in the XML, or has a set MaxGlobalInstances.
 
A big hug for both of you. :D

:)

Well it worked. It just made it so any building that was built would cause the city zoom with flash and pop up, like occurs for a wonder. You don't want that for every building, so i needed to put back in a couple checks so you'd only get the wonder effect if the building was set up to have a movie in the XML, or has a set MaxGlobalInstances.

Ah, okay, thanks. -> so i will not change that in my mod to this easy looking version :D.
 
Hi boys. :)

I'm assuming that this nifty little snippet of code:

bCoolBuilding = False

Is actually an XML tag which needs to be defined in the DLL in order to be accessible, so that it can be used in the CvEventManager.py file as well as the XML files, right?

If I'm thinking right, I would need to define this tag in the Buildings.XML for the event manager to see it and use it to key the movie. I don't think that I can put this into the XML files without fiddling with the DLL, or am I way off base here?

I do get confused rather easily. ;)
 
No, we are creating a new variable bCoolBuilding and setting it to false. Then we write some code that is basically a test, if the conditions in the test are valid, the code will set bCoolBuilding to true.
Code:
if ( (gc.getBuildingInfo(iBuildingType).getMovie()) or (isWorldWonderClass(gc.getBuildingInfo(iBuildingType).getBuildingClassType())) ):
	bCoolBuilding = True
ie, if the if check passes (the above if check is: Does the building have a movie set in the XML, OR is the building a world wonder) are met, bCoolBuilding becomes true. Then we replace the normal isWorldWonder class check in the original BtS code with a check to see if the variable bCoolBuilding is true:
Code:
[B]if[/B] ( (not gc.getGame().isNetworkMultiPlayer()) and (pCity.getOwner() == gc.getGame().getActivePlayer()) [B]and bCoolBuilding[/B] ):
And run the function if this test passes.

Is that clear? I can break up all the conditions if need be, but you're a smart girl, I think you can figure this out.

Edit, this is actually one of the important differences with C++ and Python.
With python to declare a variable, you just declare it and set it to something, and that something can be pretty random, like even dictionaries and lists are valid:

dPhungus = {}
That creates a new dictionary stored in the variable dPhungus
Something like:
iLemon = 0
Creates a new integer veriable, iLemon and sets it equal to zero. You can totally change these as you want, like you can do this, declare your variables and then go:
dPhungus = blabla
And suddenly you've wiped out everything stored in the dictionary in the variable dPhungus and turned it into a string with the value "blabla" stored in it. Of course storing a string in a variable dSomething is bad form, as d preceding the variable name should mean that the variable is a dictionary, and i should be an integer, and b should be boolean, etc. But that's just convention to keep you from confusing yourself or others that read your code. You don't have to follow these conventions though, but you'll find it easier if you do.

Anyway with C++, it's an old language that was designed when computer RAM was at a premium. So when you create a variable in C++ you must declare what type it is (and strangely you don't need to set a value either, which can cause problems later. I've noticed some coders here just automatically set variables to something when they declare them to keep any unexpected behavior from popping up. This is also why sometimes you'll see debug dll's not crash, and the standard gamecore will, because a debug dll automatically sets any declared integer variable to 0, and a release gamecore will not).
So with C++ we'd have to write:

bool bCoolBuilding = false;

The bool initializes the variable, and must be done for all variables used, you must initialize them properly, and declare what type of data you intend to store in them (int declares an integer, char declares a character, etc, you can look these up on google). You also don't need to set them to anything, so bool bCoolBuilding; would work, but when you call it later, you should set it to something, otherwise the value returned will be random.
 
Is that clear? I can break up all the conditions if need be, but you're a smart girl, I think you can figure this out.
Yup. Quite clear, thank you. :)

I was just confused by the 'b' in the variable name. It had me thinking it was referencing a boolean XML tag, rather than being the simple boolean python variable it is.

It's coming back to me slowly, and the movies trigger now. Progress. :goodjob:
 
Top Bottom