Quick Modding Questions Thread

I suppose adding this would be the only thing needed? :

pXML->GetChildXmlValByName(szTextVal, "RenaissanceArtDefineTag");
setMiddleArtDefineTag(k, szTextVal);
Sadly no. setMiddleArtDefineTag does precisely what it sounds like and you will have to add a new function for renaissance. You will then have to add the data to the header to store the data. After that you would have to figure out where it is called from and make those place(s) call the renaissance art when the era is right.

Personally I think it would be best to once and for all make it rely entirely on xml if this part is modded. It's not much more work because it touches all the same places.
 
Sadly no. setMiddleArtDefineTag does precisely what it sounds like and you will have to add a new function for renaissance. You will then have to add the data to the header to store the data. After that you would have to figure out where it is called from and make those place(s) call the renaissance art when the era is right.

Personally I think it would be best to once and for all make it rely entirely on xml if this part is modded. It's not much more work because it touches all the same places.


Crap ;) Well actually I recently seen a dll mod by someone who added art tag for EVERY period. If I could merge that with my own little mod - that would work for me.
I guess what you saying makes much more sense - these tags should be all just xml.
It would be much better solution. I guess I am willing to wait, Ren general art can wait ;)


EDIT: here is the mod I mentioned that someone has done, maybe it will be useful in your work:
http://forums.civfanatics.com/downloads.php?do=file&id=14324
 
Old repost, since I didn't get a clear answer and I still kinda need it.

Is there a way to make a civilization declare war on another civilization through python?
So say I would like Macedon to declare war on Persia on turn lalala, how would I do that?
Aren't there any mods that include such a thing?

Also, how could I make a message appear to the human player.
Say around 1800 BC I want a message to appear like "The Sumerian civilization has collapsed into anarchy!" how could I do that?
 
PHP:
.def("canChangeWarPeace", &CyTeam::canChangeWarPeace, "bool (int /*TeamTypes*/ eTeam)")
.def("canDeclareWar", &CyTeam::canDeclareWar, "bool (int /*TeamTypes*/ eTeam)")
.def("declareWar", &CyTeam::declareWar, "void (int /*TeamTypes*/ eTeam, bool bNewDiplo, int /*WarPlanTypes*/ eWarPlan) - Forces your team to declare War on iTeam")
.def("makePeace", &CyTeam::makePeace, "void (int /*TeamTypes*/ eTeam) - Forces peace between your team and iTeam")
.def("canContact", &CyTeam::canContact, "bool (int /*TeamTypes*/ eTeam)")
.def("meet", &CyTeam::meet, "void (int /*TeamTypes*/ eTeam, bool bNewDiplo) - forces team to meet iTeam")
.def("signOpenBorders", &CyTeam::signOpenBorders, "void (int /*TeamTypes*/ eTeam)")
.def("signDefensivePact", &CyTeam::signDefensivePact, "void (int /*TeamTypes*/ eTeam)")
Vanilla python functions for teams.

Available warplans (also vanilla)
PHP:
python::enum_<WarPlanTypes>("WarPlanTypes")
.value("NO_WARPLAN", NO_WARPLAN)
.value("WARPLAN_ATTACKED_RECENT", WARPLAN_ATTACKED_RECENT)
.value("WARPLAN_ATTACKED", WARPLAN_ATTACKED)
.value("WARPLAN_PREPARING_LIMITED", WARPLAN_PREPARING_LIMITED)
.value("WARPLAN_PREPARING_TOTAL", WARPLAN_PREPARING_TOTAL)
.value("WARPLAN_LIMITED", WARPLAN_LIMITED)
.value("WARPLAN_TOTAL", WARPLAN_TOTAL)
.value("WARPLAN_DOGPILE", WARPLAN_DOGPILE)

This mean you need to do something like:
PHP:
myTeam.declareWar(enemyTeam, true, WarPlanTypes.WARPLAN_TOTAL)
I didn't test this line, but it is something like that.
 
There is a Python mod out there that can be used to spawn barbarian invasions or even nations for scenarios. It is by The_J and is called Spawn A Civ. It may have what you are looking for with regards to dates etc. See here post #2 - it looks like it is triggered by technology not date.

If you really want a date then you will probably need to put something in the Start Turn function to test for the date you want.
 
I'd like to have a Setler witch can't move out of the own Culture.

I can't see any tags that would let you do this in XML, so it requires Python or dll coding. It would use one of the canMove functions, bad in Python because this is a "real" python call back (rather than just a call to python), one of the slow ones (it is programmed in the dll to be slow).

Most of the "real" python call backs (as defined in the dll I think) are poorly coded in the dll this is the main reason they are so are slow. Ksohling did a lot of work in Caveman2Cosmos to up the quality and efficiency of that code that is how I know:D.
 
There is a Python mod out there that can be used to spawn barbarian invasions or even nations for scenarios. It is by The_J and is called Spawn A Civ. It may have what you are looking for with regards to dates etc. See here post #2 - it looks like it is triggered by technology not date.
I am aware of the first mod, but i don't think it can be used to declare war, or can it?
 
It would use one of the canMove functions, bad in Python because this is a "real" python call back (rather than just a call to python), one of the slow ones (it is programmed in the dll to be slow).
That's even worse than it sounds at first. The AI can't "see" where it makes sense to move units. Instead it tries all combos to see if they are valid and if it likes the outcome. This mean anything related to canMove is called over and over by the AI and slow code here really slows down the AI.

I can't recommend doing anything to the move code other than using optimized DLL code. I don't know what to recommend if modding the dll is out of the question :sad:
 
I am aware of the first mod, but i don't think it can be used to declare war, or can it?
Probably not, but you can use it as a cheat sheet of sorts: look up how it checks for specific dates, then copy that and instead of spawning a civ use the methods Nightinggale linked to start a war.
 
Probably not, but you can use it as a cheat sheet of sorts: look up how it checks for specific dates, then copy that and instead of spawning a civ use the methods Nightinggale linked to start a war.
The date thing is stored in the XML part and I don't have the experience to create something in python myself.

How is it done in your mod, there is a scripted declaration in it (Alexander's invasions)?

Or is there any other mod where I can find what I'm looking for.
 
Look here: DoC plugs into the onBeginGameTurn event trigger for this (regular BtS might do that with CvEventManager.py). The linked Python module makes a call to a different module that actually spawns the units. In this case that is the checkTurn method in AIWars.py, which calls the checkConquest methods for the specific stages of the spawned invasions.

I am always hesitant to point people to my mod for examples on how to mod stuff in BtS, because RFC is already heavily modified and modularized, so emulating it might not work because you're missing the required utility methods, or needlessly complicated because your own use case is much simpler. So take everything you see with a grain of salt. It's useful to understand how everything is connected, not so much for outright copying code.
 
RFC is already heavily modified and modularized
What is the benefit in modules anyway? Usually a module is something you install or just place at a specific place and it adds a certain feature. However modding DLL, python and xml doesn't seem module friendly. Add atag to xml means modifying the xml, the schema, the dll and python for pedia and that's even before using the tag. WIth this in mind, what is the idea of using modules rather than just placing everything into one big "module"?
 
I meant module in the more general way, and also in Python parlance (i.e. every file is a Python "module").

I agree that modules don't make a lot of sense because a mod is usually monolithic. I am using modules only for additional art or sound resources (extended soundtracks, civ specific graphics). That way this stuff can be added independently of the main mod and easily removed if no longer desired.
 
You're probably looking for CIV4ColorVals.xml, actually, in the Interface folder, where you also find CIV4PlayerColorInfos.xml.
 
Back
Top Bottom