• 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

Copying a piece of code from vanilla seems like a good approach. A fully patched vanilla has very few bugs, which makes it a good example on how to avoid bugs.

I disagree :D
Some are logic bugs which don't cause errors and you will never catch any while debugging. They just display the wrong info since python is used for most screens.
Some are redundant codes which don't do anything useful, leftover from god knows what. Doing calculations for variables which are then not used at all.
 
I disagree :D
Some are logic bugs which don't cause errors and you will never catch any while debugging. They just display the wrong info since python is used for most screens.
Some are redundant codes which don't do anything useful, leftover from god knows what. Doing calculations for variables which are then not used at all.
Point well taken, but I don't think we aim at 100% the same. I was thinking about copying 1-2 lines like in this case as a template for how to loop plots. You talk about something, which is calculated and then not used. That's clearly more than one liner "templates". The larger the chunk of code you copy, the less likely it is to go smoothly without modifying, hence the approach to just copy code from vanilla really is best used for 1-2 lines of code. It's helpful to get function names and similar (which you can look up in the DLL code if you want to know what they do).

Having said that, copying existing code isn't without danger. I managed to write code, which worked well, then copied it and suddenly it caused desyncs because apparently network traffic doesn't like getting generated during doTurn. In fact doing that will make the code execute on the local computer only (learned that the hard way). All sorts of things can go wrong by just copying existing code and you will always have to careful consider what you are doing and test well. Copy pasting code isn't an excuse to not proofread code or test.

I think we agree more than first meets the eye by the last few posts.
 
New question:

Is there a way to make a building give a flat yield bonus with a resource? For example, making a grocer give +2 food with access to bananas?
 
Can you aswer some questions for me please?
I am playing now mod Rise of Mankind: A New Dawn and there its is restricter how much Wonders you can build and its only one per city for world and 4 national. How can i chage that? What XML file shal i alter and where i can fine this line in it?
WSecon question is about good mods to play, what mods are good for the game? How about realism invictus?
Thanks
 
Is there a way to make a building give a flat yield bonus with a resource? For example, making a grocer give +2 food with access to bananas?
It's determined in the DLL, meaning it is technically possible. I don't know if any code exist, which will do it or if it needs to be written from scratch, but it doesn't sound like it's complex to implement relative to many other DLL modifications.

Can you aswer some questions for me please?
I am playing now mod Rise of Mankind: A New Dawn and there its is restricter how much Wonders you can build and its only one per city for world and 4 national. How can i chage that? What XML file shal i alter and where i can fine this line in it?
WSecon question is about good mods to play, what mods are good for the game? How about realism invictus?
Thanks
How about asking in the RoM forum? It sounds fairly mod specific.
 
It's determined in the DLL, meaning it is technically possible. I don't know if any code exist, which will do it or if it needs to be written from scratch, but it doesn't sound like it's complex to implement relative to many other DLL modifications.


How about asking in the RoM forum? It sounds fairly mod specific.
i thing its not mod specific, there should be file that regulates quantity of wonders per city
 
GlobalDefines.xml is what you are looking for.

<Define>
<DefineName>MAX_WORLD_WONDERS_PER_CITY</DefineName>
<iDefineIntVal>-1</iDefineIntVal>
</Define>

(Now that I looked at it I found something else I didn't knew was there, time to mod it a bit)
 
GlobalDefines.xml is what you are looking for.

<Define>
<DefineName>MAX_WORLD_WONDERS_PER_CITY</DefineName>
<iDefineIntVal>-1</iDefineIntVal>
</Define>

(Now that I looked at it I found something else I didn't knew was there, time to mod it a bit)
Thank you so much! I have found also option in custom play settings allowing to have unlimited wonders
 
when i loaded the pre-alpha version of my civ i experience alot of bugs, most of these were simply caused by misspelling in the code but i narrowed it down to only these two and i dont understand them or the files they are connected to

Failed loading XML file
modules\aniyvnwiya\longrifle\longrifle4unitinfos.xml
Reason: text is not allowed in this context according to DTD/Schema
Expecting: {x-schema:Longrifle_CIV4UnitSchema.xml}UnitInfo


Failed loading XML fil
Modules\aniyvnwiya\aniyvnwiya_civ4civilizationinfos.xml
Reason: Element content is invalid according to the dtd/schema
expecting{x-schema:Aniyvnwiya_CIV4CivilizationsSchema.xml}City


after narrowing down all the other glitches now it crashes after the first one pops up

What are these schema files i dont understand them and didnt make them
 
++ increase

<CommerceChanges>
<iCommerce>0</iCommerce> - gold
<iCommerce>0</iCommerce> -science
<iCommerce>4</iCommerce> -culture
<iCommerce>4</iCommerce> -espionage
</CommerceChanges>

%% increase

<CommerceModifiers>
<iCommerce>0</iCommerce>
<iCommerce>10</iCommerce>
<iCommerce>25</iCommerce>
<iCommerce>25</iCommerce>
</CommerceModifiers>
 
Boolean
All of these can either be 1 (on, or true) or 0 (off, or false). Be careful, as you can wind up with a double-negative, which the game will interpret as "True".

Tag Name Description
bNoCoast
Whether the feature is allowed on a tile next to the coast
bNoRiver Whether the feature is allowed on a tile next to a river
bNoAdjacent Whether the feature is allowed on a tile next to a tile with the same feature
bRequiresFlatlands Whether the feature requires a flat tile (as in, not hills or peaks)
bRequiresRiver Whether the feature must be next to the river
bAddsFreshWater Whether the feature is counted as fresh water
bImpassible Whether the feature is impassible or not
bNoCity Whether or not the feature removes the ability to found a city on the tile
bNoImprovement Whether or not the feature makes it impossible to build an improvement on the tile
bVisibleAlways unknown
bNukeImmune Whether the feature is immune to destruction by nukes or not
 
terrain booleans by themselves allow the bonus on the terrain without a feature ( if set grass, then allowed on grass, but as long as featurebooleans are empty, not on grass+jungle)
- feature booleans + FeatureTerrainBooleans --> bonus is allowed on these FeatureTerrainBooleans when on these featureBooleans.
 
Hi, I hoped someone might be able to offer some advise on modding civics if possible please?

I'm experimenting with some new civics and I have an idea for a group of political ideology civics. I've added the extra group, got the civics screen working so that the extra group is added and I plan to add an extra 7 civics to this group. The civic that every civ starts with is 'Egalitarianism' to represent the sharing nature of a small tribal hunter gatherer band.

For this civic I want to do some very simple changes;
I want it to add +1:) throughout the civilization which is easy and I have done that without problem.
I also want to change the amount of food a building stores when this civic is chosen.

The building I want to store food is the hunters cabin, which provides +1:food: to the city that it's built in.

When 'Egalitarianism' is adopted I also want the hunters cabin to store +10% food after growth to represent the social ownership of surplus food in hunter gatherer societies.

Now I know I have to somehow make a change to the <iFoodKept>0</iFoodKept> line, but I have no idea how to make this work in the CIV4CivicInfos file? Can anyone offer any advice please?
 
Arses! I feared that might be the case. Beyond my capabilities. I'll have to come up with something else. Thanks for the advice.
 
terrain booleans by themselves allow the bonus on the terrain without a feature ( if set grass, then allowed on grass, but as long as featurebooleans are empty, not on grass+jungle)
- feature booleans + FeatureTerrainBooleans --> bonus is allowed on these FeatureTerrainBooleans when on these featureBooleans.
So for example:
<TerrainBooleans> grass
and
<FeatureBooleans> jungle
and <FeatureTerrainBooleans> (empty)
allows it on either grass OR jungle but NOT on grass with jungle, right?

So the relation is:
[ <TerrainBooleans> OR <FeatureBooleans> ] AND FeatureTerrainBooleans>, right?

Arses! I feared that might be the case. Beyond my capabilities. I'll have to come up with something else. Thanks for the advice.
Are you modding BTS or some other mod? Many mods have civic buildings (building is only active with the specified civics).
Rise of Mankind - A New Dawn 2 and C2C for example has this feature (I think KMOD too. I heard many advising to mod KMOD instead of BTS)

BTW I also have a modmod compilation for AND2 (http://forums.civfanatics.com/threads/zns-addons.523763/page-24) and one of them is about civics.
You can try it for more ideas and I also would like to see yours :)
 
Back
Top Bottom