• Civilization 7 has been announced. For more info please check the forum here .

Quick Modding Questions Thread

I was looking for something in the scripts or a pre-made mod - not that your help to enable me to mod myself is not awesome, but i guess i just assumed the game compiles before it starts up(?), or why else would the code be part of the game itself. ?? Did they intentionally give the code out with the game or something for some reason, usually it's just the binaries we buy as a game... ? Not sure.
 
There are 3 parts to the code.

Source Code(SDK) which you have to compile into the .dll file using something like Visual Studio
(Tutorials all about this)
XML which compiles when you load Civ
Python which gets regualrly checked during game and most of it can update while you are running the game.
 
Would it be possible to make a unit "undeletable"? Because the AI always deletes a unit that should never be deleted (the Pharaoh). First the Pharaoh could move, but then it sometimes got captured by barbs or somehow still ceased to exist. (the Pharaoh is capturable, but barbs never capture units, they only destroy them). So I gave them 0 movement speed, so it would always stay in Men-nefer (the capital), but the AI seemed to never built it. When I placed it in the city, the AI deleted it after some turns, or it magically disappeared. I'm confused what I should do now, any suggestions?
 
Yes it's possible. You must cheat AI. Set unit AI to UNITAI_UNKNOWN, and AI will never touch this unit, it's mean that your unit will stay on their plot where is created/built and doing nothing (no move, no attack, no disband, etc ... ).
Second i think that AI never disband Great General Unit, maybe set them a UNITAI_GENERAL.

For more info see this thread http://forums.civfanatics.com/showthread.php?t=353919
 
Is there a way to quickly alter a "CivBeyondSwordWBSave" file to replace a leader, like if I wanted to use Mao for China instead of Qin Shi Huang?

Or for that matter, to make it so you can choose leader at start instaed of having a defined leader?
 
1) yes, a "CivBeyondSwordWBSave" file is a text file, so just edit it with a text editor by right-clicking on it first. Note that it is only read once at the start of a game.

2) no.
 
How can I make a naval unit move twice as fast in ocean terrain (like in Leoreth's DoC?) I tried giving the unit a special promotion which gives it double speed in ocean, but this doesn't seem to work and the unit can still only move 2 tiles a turn even if it is in ocean terrain. It's for my Ancient Middle East Mod and the unit is a special unit for Phoenicia.
 
Is it possible for civics to require multiple technologies? I can't figure out how to do so, but...?
 
Or all three. :p

But nah, then I'd be adding dead-end technologies to unlock a civic, because what would be an appropriate technology for Empire? Well... I suppose Nationalism + Astronomy can lead to a technology called Imperialism, but what would it even do... Perhaps some kind of naval wonder... Perhaps an improved Settler... Okay, good idea there!

What about Unitary State? This one is tricky; I'm trying to tie it to the Westphalian concept of nation-state, which would be Nationalism (obvious), Printing Press (can be tied to Protestantism, which, initially, was the reason for the Eighty Years War), and Liberalism (the after-effects of the Napoleonic War had all kinds of fun Westphalian things). Sidenote; the tech tree in this period seems to randomly jump between the mid-late fifteenth century (Astronomy, Printing Press, Gunpowder...) and the early nineteenth century (Liberalism, Steam Power, probably Economics...).

But this is a gigantic issue, as I plan on adding, oh, 75 civics or so? Help, I have gone mad. :p
 
PHP:
bool CvPlayer::canDoCivics(CivicTypes eCivic) const
That is the function you need to change to change requirements for civics. However it requires recompiling the DLL, which appears to be an issue for quite a number of people.

It does allow python code to be used instead. It make use of the callbacks canDoCivic and cannotDoCivic. The idea is simple. It calls the python functions of those names with the arguments (player ID, Civic ID) and they should return 1 if the question is true.

This mean you can write code something like
if player has tech(A) and player has tech(B) and player has tech(C): return 1

Revert this for cannotDoCivic where it returns 1 if the player lacks one or more of those techs. I can't remember the python functions to check that offhand.

Note: look up how to check if a player has a tech in python. I don't know the function call to do that, though it could be something simple like gc.GetPlayer(playerID).hasTech(tech ID)

Personally I would code it in the DLL and add XML tags to set multiple requirements as this is the easiest to expand on and will be one of the fastest solutions possible. However it would also be the most difficult to code, which mean I wouldn't recommend that approach unless you are already modding the DLL.
 
Yeah, I would definitely use a DLL solution, as Python is more of a random and rather messy work-around (that the AI wouldn't fully understand) than structured code, so to say... Except that I've never succeeded in compiling a DLL (I've also been trying to add tags such as BonusCommerceModifiers, BonusCommerceChanges, and BonusYieldChanges)... Oh well, thank you anyway. :)
 
Yes it's possible. You must cheat AI. Set unit AI to UNITAI_UNKNOWN, and AI will never touch this unit, it's mean that your unit will stay on their plot where is created/built and doing nothing (no move, no attack, no disband, etc ... ).
Second i think that AI never disband Great General Unit, maybe set them a UNITAI_GENERAL.
So I tried that, but the unit still ends up disappearing (the AI deleted it)
 
Hello, I've been looking through the ridiculous amount of tutorials in an attempt to find a thread that can help me out with what I am trying to do but just about all of the ones I've viewed have nothing but dead links to the necessary programs..

What I am trying to actually do:
While playing the Fall Further mod for FFH2 I was disappointed by the style and color of certain cities (Illians, Calabim, etc) and I wanted to change that, I figured maybe an unpaking program with a file converter & editor would work but I realize it's a tad more complicated than that, to which I humbly ask: how can I edit the style and color of cities?
 
if you are looking for a program to unpack .fpk files (they contain compressed art), not sure if FFH use those but I imagine they do.

I use dragon unpacker,(or something like that) a quick google search for unpacking .fpk found me that.

As to the larger question of editing, you are probably better off starting a thread so that questions and answers can be kept together (post a link to it from here then people can find it easier and help you out.

You could change colours by playing with the .dds files for them probably, or swap out the styles with other existing city sets.

Beyond that you have got your work cut out for you.
 
So I tried that, but the unit still ends up disappearing (the AI deleted it)
Are iCombat and iCost set to 0 or less? Combat strength < 1 should exempt the unit from being disbanded in CvPlayerAI::AI_doTurnUnitsPost, and production cost < 1 should take care of CvPlayerAI::AI_disbandUnit. (Based on a cursory look at the code of the unmodified DLL.)
 
Even though I see various mods using it - Fall From Heaven, vincentz' Infinite Project (?), and so on - I don't believe UnitClassTargets works? It doesn't in my game, at least...:

Code:
			<UnitClassTargets>
				<UnitClassTarget>
					<UnitClassTargetType>UNITCLASS_AXEMAN</UnitClassTargetType>
					<bUnitClassTarget>1</bUnitClassTarget>
				</UnitClassTarget>
			</UnitClassTargets>
 
Top Bottom