• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

Quick Modding Questions Thread

@ DiMarzio: I think that you need to change the code in the dll to have a different text:

- TXT_KEY_MISC_SOMEONE_DECLARED_WAR comes from CvTeam.cpp:

Code:
szBuffer = gDLL->getText("TXT_KEY_MISC_SOMEONE_DECLARED_WAR", getName().GetCString(), GET_TEAM(eTeam).getName().GetCString());


- TXT_KEY_MISC_CITY_HAS_BEEN_RAZED_BY comes from CvPlayer.cpp:

Code:
swprintf(szBuffer, gDLL->getText("TXT_KEY_MISC_CITY_HAS_BEEN_RAZED_BY", pCity->getNameKey(), getCivilizationDescriptionKey()).GetCString());

1 and 2 come from the order of declaration.
 
I repeat:
Would it be possible to make a building buildable by the AI only?
 
Would it be possible to make a building buildable by the AI only?
I think you would have to modify CvCity::canConstruct(). It looks like it calls canConstruct in python as well. You would also have to either hardcode which buildings are AI only or add a bool to XML.

However you have to consider if it really is a good idea. Why shouldn't human players be able to use something the AI is using? What happens if a city builds an AI only building and then a human conquers it? There are a number of issues you should consider.
 
Well the AI seems to research techs very slow in my mod, even the ones that have many cities. So I'd like to give them some boost to help them research techs faster. A building that gives a science boost should be available to the AI only, because human players are very capable of producing techs fast enough. If a human players captures a city with the building, it just disappears (conquestprob set to zero).
 
Well the AI seems to research techs very slow in my mod, even the ones that have many cities. So I'd like to give them some boost to help them research techs faster. A building that gives a science boost should be available to the AI only, because human players are very capable of producing techs fast enough. If a human players captures a city with the building, it just disappears (conquestprob set to zero).
In that case the answer lies in CIV4HandicapInfo.xml in GameInfo. iResearchPercent is a modifier for AI research. If it for some reason produce way too little, you can increase this number and it will research faster, though it allows the AI to cheat. The real solution is to change the priorities of the AI and make it value research higher. However that can't be done by changing a single number like this.
 
%s1_civ_adjective Chose: To Kill Him

I think this might be the one you want.. I can't remember what it puts out though exactly..

Sorry, what do you mean? I believe that would return: American Chose: To Kill Him. I don't want the adjective, I want the short description (America).
I have to try it though, to be sure.

@ DiMarzio: I think that you need to change the code in the dll to have a different text:

- TXT_KEY_MISC_SOMEONE_DECLARED_WAR comes from CvTeam.cpp:

Code:
szBuffer = gDLL->getText("TXT_KEY_MISC_SOMEONE_DECLARED_WAR", getName().GetCString(), GET_TEAM(eTeam).getName().GetCString());


- TXT_KEY_MISC_CITY_HAS_BEEN_RAZED_BY comes from CvPlayer.cpp:

Code:
swprintf(szBuffer, gDLL->getText("TXT_KEY_MISC_CITY_HAS_BEEN_RAZED_BY", pCity->getNameKey(), getCivilizationDescriptionKey()).GetCString());

1 and 2 come from the order of declaration.

Thanks, but I don't feel that being the right way to do it. Those two are not the only ones I want to change, they were just examples. I would want to change almost every instance of leader name to civ name. So I would have to find all of their codes and change them. Not good. It isn't a good practice to change the code when you can just change the parameters.

If I really have to touch the code I could simply add the keyword for civ's short description. No need to take the detour.

EDIT:Correcting tpyos
 
In that case the answer lies in CIV4HandicapInfo.xml in GameInfo. iResearchPercent is a modifier for AI research. If it for some reason produce way too little, you can increase this number and it will research faster, though it allows the AI to cheat. The real solution is to change the priorities of the AI and make it value research higher. However that can't be done by changing a single number like this.
Really? The modiki says that it just increases the technology cost for the human player. That is not what I want, I want the human player to advance normally, but the AI to advance faster.
EDIT:Confirmed through testing. Now my question still stands.
How do I make the AI advance faster? It is miles behind me on technology even on higher difficulty levels, even the most advanced civs.
 
Thanks, but I don't feel that being the right way to do it. Those two are not the only ones I want to change, they were just examples. I would want to change almost every instance of leader name to civ name. So I would have to find all of their codes and change them. Not good. It isn't a good practice to change the code when you can just change the parameters.

If I really have to touch the code I could simply add the keyword for civ's short description. No need to take the detour.

I guess the thing is you simply can't do it without changing every single instance of "gDLL->getText( "YOUR_TXT_KEY", ... ).

The code isenchine posted shows that "TXT_KEY_MISC_SOMEONE_DECLARED_WAR" is passed two parameters: the two team's names. Whithout changing that, you only can use these as "%s" in your text files. To answer your second question, %s1 means the first, %s2 means the second string passed in "gDLL->getText(...)" (actually, I believe the "_PlyrName" doesn't do anything at all).
 
So does anyone know how to make AI advance faster on technological level?
 
Civciv5: The iResearchPercent value of HANDICAP_NOBLE should apply to the AI. That is, if you play on Noble difficulty, the value will apply to both you and the AI, and if you play on any other difficulty, say, on Prince, the Noble value will still apply to the AI, and you'll get the Prince value. If you want a solution that works for Noble as well, creating a new Handicap specifically for the AI should work. You'd have to set AI_HANDICAP in GlobalDefines.xml to that new Handicap. Probably easier: Change the global research speed for all map sizes in GameInfo/CIV4WorldInfo.xml.

DiMarzio: You could change e.g. TXT_KEY_LEADER_ALEXANDER to "Greece" in CIV4GameTextInfos_Objects.xml. That should replace all instances of "Alexander" with "Greece" (which is probably not quite what you want).
 
I'm confused now. Won't setting the global research speed help the human player, because if so I can't use that? Also, my mod works with just one (or a few more) maps. The difficult level set for the AI is always noble in the world builder file, will be creating a new handicap called "AI" with a faster research be enough? Also, can't the human player just select that handicap to just advance even faster?
 
I'm confused now. Won't setting the global research speed help the human player, because if so I can't use that? Also, my mod works with just one (or a few more) maps. The difficult level set for the AI is always noble in the world builder file, will be creating a new handicap called "AI" with a faster research be enough? Also, can't the human player just select that handicap to just advance even faster?
I didn't think this through. I thought you could make human research slow through the Handicap XML, and global research fast through the World XML, so that it would even out for the human player. However, the real problem is how to change the AI research speed (or cost) independently of the human.
Good point about the player being able to select the new handicap; that's a bit awkward. I have little experience with world-builder files. It could be that the AI difficulty would have to be changed in each WBSave. So, perhaps, changing HandicapInfos is not an ideal solution.
 
How do I change the food/hammer/coin yield of resources?

Also, to change which building gives extra happy/health from a resource?
 
For the resources you want bonusinfos.xml in the terrain folder.

look at the modiki in the top bar for the meaning of the xml tags the tag is something like yieldchanges, I forget exactly but you can find it in the modiki in the civ4 XML section.

For the bonus to buildings, you need buildinginfos.xml in the building folder tags are:
BonusHappinessChanges
BonusHealthChanges

look at a building that already does it to see how it is written.

Also, it is recommended to make a new mod folder with the files and folder structure that you want to change, rather than changing the base game files.
 
OK I've got a copy of the file open and I'm looking at Fish. I see where it defines the +1 food when undeveloped, but I don't see how to change the value when developed. Is that a feature of the 'Fishing Boat' improvement?

EDIT: nvm I found it.
 
Has anyone looked at how to make autosaves happen at the end-of-turn rather than the beginning-of-turn (which imho is rather useless)? I think the current method is really a bad design, i would rather save all the moves i've done for a turn than none of them each turn, any thoughts, does a mod exist, can this be modded?

AutoSave appears to *only save at beginning of turns*, thus it never saves any of our moves each turn, if one goes back to a turn all the made moves are lost; but if it saved just before the end of turns all our moves would be saved as well.

(Is this one of the places to ask, or should i post in the Civ4 - Creation & Customization forum itself?)
 
Has anyone looked at how to make autosaves happen at the end-of-turn rather than the beginning-of-turn (which imho is rather useless)? I think the current method is really a bad design, i would rather save all the moves i've done for a turn than none of them each turn, any thoughts, does a mod exist, can this be modded?
I haven't thought about it, but I like this idea. The code you want to look at is CvGame::doTurn(). It contains the line
PHP:
gDLL->getEngineIFace()->AutoSave();
Maybe all you have to do is to move it to the right location. Moving it from the end to the start of that function might be enough.
 
I haven't thought about it, but I like this idea. The code you want to look at is CvGame::doTurn(). It contains the line
PHP:
gDLL->getEngineIFace()->AutoSave();
Maybe all you have to do is to move it to the right location. Moving it from the end to the start of that function might be enough.
When does that compile?
 
When does that compile?
:eek::think:

Either you are asking for how to set up a compiler, in which case you should follow the link in my sig. Alternatively you ask when the function executes and that is when all players click end turn.

Actually now that I think about it, I wonder when the AI takes turns. Maybe it would be a good idea to use new random seeds on reload and then make a test game to see where to autosave to allow the AI to make different things during the AI turn. The place in the code you are looking for is after the human turns and before the AI turns.
 
Back
Top Bottom