Quick Modding Questions Thread

Is there a XML tag in the base game that lets unit be built faster if you have a resource? In particular I am asking about unitinfos.xml
 
Is there a XML tag in the base game that lets unit be built faster if you have a resource? In particular I am asking about unitinfos.xml
BonusProductionModifiers
 
Is there a way to set a custom resolution for the game other than the preset ones?
1693861744214.png

For example 1920x760?
 
For windowed mode, yes, through ScreenWidth, ScreenHeight in CivilizationIV.ini. Will fail to start with a semi-helpful error message when attempting to use custom dimensions for fullscreen mode.
 
I have two questions.

Where would I put my function, that makes a popup, for it to appear in the main menu screens?

How do I retrieve my edit box data to pass to a function?
 
Nobody answered the two week old questions? :hmm:
Where would I put my function, that makes a popup, for it to appear in the main menu screens?
Unintuitively there are two menus called "main menu" in the code. One can be modded by opening CvDLLButtonPopup.cpp and search for BUTTONPOPUP_MAIN_MENU. This is the ingame menu with world builder, save, retire and other stuff like that. The other one is the menu you get when you start the game and you click stuff like new game. This menu is in the exe and can't be modded.
How do I retrieve my edit box data to pass to a function?
This time it's python, more specifically CvEventManager.py.
PHP:
    def __eventEditCityNameBegin(self, city, bRename):
        popup = PyPopup.PyPopup(CvUtil.EventEditCityName, EventContextTypes.EVENTCONTEXT_ALL)
        popup.setUserData((city.getID(), bRename))
        popup.setHeaderString(localText.getText("TXT_KEY_NAME_CITY", ()))
        popup.setBodyString(localText.getText("TXT_KEY_SETTLE_NEW_CITY_NAME", ()))
        popup.createEditBox(city.getName())
        popup.setEditBoxMaxCharCount( 15 )
        popup.launch()
    
    def __eventEditCityNameApply(self, playerID, userData, popupReturn):    
        'Edit City Name Event'
        iCityID = userData[0]
        bRename = userData[1]
        player = gc.getPlayer(playerID)
        city = player.getCity(iCityID)
        cityName = popupReturn.getEditBoxString(0)
        if (len(cityName) > 30):
            cityName = cityName[:30]
        city.setName(cityName, not bRename)
You need the functions createEditBox, setEditBoxMaxCharCount and getEditBoxString.
 
Have a question. Took a quick look at the DLL code provided by AdvCiv mod. My main interest right now is map generation because I have been trying for years to add a geologic and climate simulator with the produced map. I think I may finally have a starting algorithm idea down (that isn't so complicated that it will take forever... my original downfall). I want to be able to take the entire map generated by the script from the start of the game and clear all terrain data (including plot types), feature data, bonus data, and river data, while saving all paced units and whether a plot is ocean or land. "Thats it." However, I want the user to be able to pick the original map script of their choice. The reason I want to keep this data is because I want to use the original map script to create the world they desire. Then run a geology and climate simulator to produce a realistic map (the algorithm for which I have been developing slowly for years). I just need to know where in the beginning of the game to do this and I think I have narrowed it down to two methods (I listed the third because I am curious about it):

DllExport void setInitialItems();
DllExport void regenerateMap();
void showDawnOfMan(); // advc.004j

Is regenerateMap() called at the beginning? Or is this ONLY for regeneration after a map is already in place? If the latter, I suppose I can use setInitialItems() to put in my code (or a call to external code). Otherwise I am guessing I can put it at the end of regenerateMap(). Would anyone know?

Also... does anyone know if there is a way to call code in a .NET library, or external library for the purpose of calling code in a .NET library from the civ DLL? This isn't necessary but would save me some time. I am using .NET to test my code (mixed language app) because building a UI there is just so much faster.
 
Also... does anyone know if there is a way to call code in a .NET library, or external library for the purpose of calling code in a .NET library from the civ DLL? This isn't necessary but would save me some time. I am using .NET to test my code (mixed language app) because building a UI there is just so much faster.
We have a very high degree of freedom when modding the C++ code so adding a bridge to .NET is likely possible. However I'm not sure it's a good idea to do so. On top of performance issues, the code organization will end up getting super messy in no time.
 
I would like some units to move faster/slower than others. Is there a XML method to change a unit movement speed?
 
I would like some units to move faster/slower than others. Is there a XML method to change a unit movement speed?
Of course; a Horseman moves faster than a Spearman, no?
I am confident it would have taken you less effort to find the answer to your question and to do what you want to do, rather than to make this question, but okay: Navigate to /Assets/XML/Units/CIV4UnitInfos.xml, find the unit you want to modify, and modify the value for <iMoves>.
 
Of course; a Horseman moves faster than a Spearman, no?
I am confident it would have taken you less effort to find the answer to your question and to do what you want to do, rather than to make this question, but okay: Navigate to /Assets/XML/Units/CIV4UnitInfos.xml, find the unit you want to modify, and modify the value for <iMoves>.

Nice to meet you, king of all the emperors, but:
-first, change your tone, and read the question again, cause you're completly off the mark.
-second, <iMoves> is the maximum absolute number of tiles the unit can displace to, not its speed. So no, a Horseman doesn't move faster than a Spearman. It moves further.

Now one has been corrected and has learned from his mistake -according to your signature- let's forget about your answer (which is more a response actually) and start afresh, if you don't mind.

I am not refering to a gameplay modification but a graphical matter. I am talking about reducing the velocity of the physical displacement of a nif object from a tile to an other, with the objective of having its velocity synchronized to the velocity of the skeleton movement during the animation flow of the sequence launched by the _MD_run.kf file. Because I want to suppress the horrible "sliding"/"moonwalk" effect on several units.

Then I get back to my initial question and rephrase: is the speed of a unit ruled by a XML tag, or is it only kf(m) relative?
 
@Jarmrik ... um. Your question really isn't that clear (specific). I am not saying that @need my speed isn't making a false assumption, but "speed" is a very general word and in terms of the game, and without a specific context, generally <iMoves> is the go to (default) assumption one would make (even if it isn't the only one, or the logical one in your eyes). Just sayin... your clarification is helpful though.
 
To try ti answer the question itself:

I would not know that there is any setting in the xml that can influence the speed of a specific animation of a specific unit or how fast the unit is moved during the run animation (CIV4ArtDefines_Unit.xml would be the place to go). What can be done is to change the "Frequency" entry in the specific animation kf file. The larger the number, the faster the animation is played. This might cause jumps in the run loop though, did not test enough to be sure about that.

Other than that, I guess a cleaner solution would be to load the animation file into Blender (or a similar program), change the frames per second value, and save again as a new file. The so created kf file will need some corrections though (at least when using Blender). From what I remember, the "Target Name" will need to be changed to "MD" again and "NiTextKeyExtraData" will need to be filled with the audio information.
 
@Jarmrik ... um. Your question really isn't that clear (specific). I am not saying that @need my speed isn't making a false assumption, but "speed" is a very general word and in terms of the game, and without a specific context, generally <iMoves> is the go to (default) assumption one would make (even if it isn't the only one, or the logical one in your eyes). Just sayin... your clarification is helpful though.
I understand, and admit it with no difficulty. I can clarify if it's needed, as english is not my native language, even make a drawing if necessary.
But I have been a bit surprised by the formulation of the answer and, to be honest, didn't expect to get such a "veteran-to-noob" level exchange on CFC. Now it's said, it's okay for me. :thumbsup:
 
To try ti answer the question itself:

I would not know that there is any setting in the xml that can influence the speed of a specific animation of a specific unit or how fast the unit is moved during the run animation (CIV4ArtDefines_Unit.xml would be the place to go). What can be done is to change the "Frequency" entry in the specific animation kf file. The larger the number, the faster the animation is played. This might cause jumps in the run loop though, did not test enough to be sure about that.

Other than that, I guess a cleaner solution would be to load the animation file into Blender (or a similar program), change the frames per second value, and save again as a new file. The so created kf file will need some corrections though (at least when using Blender). From what I remember, the "Target Name" will need to be changed to "MD" again and "NiTextKeyExtraData" will need to be filled with the audio information.
Then I guess it will be complicated for me. I was praying for a tag with a non-explicit label that would have been put somewhere at the end of an XML file I would have missed. Thanks!
 
didn't expect to get such a "veteran-to-noob" level exchange on CFC
That was not how I intended my response, but I know I (being Dutch) can occasionally come across as blunt-or-insert-other-appropriate-words-here.
For what it's worth, I liked and smiled slightly at how you worded your reply. :)

I don't have an answer, but maybe (most probably not) this could be another avenue to explore : https://forums.civfanatics.com/threads/zlatko-mini-formation.476669/
There are also the <UnitMeshGroups> tags in the Civ4UnitInfos.xml, but I would be careful with touching them (who knows what they can break).
 
That was not how I intended my response, but I know I (being Dutch) can occasionally come across as blunt-or-insert-other-appropriate-words-here.
For what it's worth, I liked and smiled slightly at how you worded your reply. :)

I don't have an answer, but maybe (most probably not) this could be another avenue to explore : https://forums.civfanatics.com/threads/zlatko-mini-formation.476669/
There are also the <UnitMeshGroups> tags in the Civ4UnitInfos.xml, but I would be careful with touching them (who knows what they can break).
I'm a bit tired and then possibly felt offended more than necessary :lol: . Red lights came back to green since then, so no hard feelings.

Thanks for the hints. I haven't seen anything interesting in formationinfo but I'll check Zlatko's work just in case; there's actually a <fMaxSpeed> tag in <UnitMeshGroups> that really intrigues me as it's not refenced in the various XML help/explanations pages I looked at.
 
there's actually a <fMaxSpeed> tag in <UnitMeshGroups> that really intrigues me as it's not refenced in the various XML help/explanations pages I looked at.
Yes, that is what caught my eye too, but then in the thread where I found Zlatko's tool someone recommended against changing it because it caused a crash with ships or somesuch. That is why I specified the 'careful with touching them' part in my message.
 
Back
Top Bottom