• 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

In CIV4CorporationInfo.xml there is the tag <PrereqBonuses> which can contain up to 6 resources but it you add more the just doesn't start.
Anyone knows where this "max 6 resources" limit is defined? Exe, dll or some python file?
GlobalDefines.xml
Code:
    <Define>
        <DefineName>NUM_CORPORATION_PREREQ_BONUSES</DefineName>
        <iDefineIntVal>5</iDefineIntVal>
    </Define>
 
Does anyone know if there's a way to check if two given plots are bordered by the same (i.e. connected) river? I don't mind corner cases like different tributaries of a larger river being considered "the same" even though neither city is downstream from the other.

From the looks of it there is CvPlot::getRiverID, but that seems to be used during map generation and seems useless after that. Is it possible at all?
 
Does anyone know if there's a way to check if two given plots are bordered by the same (i.e. connected) river? I don't mind corner cases like different tributaries of a larger river being considered "the same" even though neither city is downstream from the other.

From the looks of it there is CvPlot::getRiverID, but that seems to be used during map generation and seems useless after that. Is it possible at all?
I'd try using the isNOfRiver and isWOfRiver functions. For example, if your plot and its northern neighbor both return true for isWOfRiver, that probably means they are connected. There are quite a few cases to cover, but I don't know of a simpler method.

On another note: is there a way to create bink (.bik format for wonder movies) video files on Linux? FFmpeg can decode bik files with audio, but can not encode them. The RAD encoder doesn't seem to work with wine at all, and the only encoder I've found for Linux (here) can't encode audio. I even tried mixing audio with a bik file generated by this, but RAD tools isn't willing to accept it as a valid file.
Maybe there is an online encoder somewhere? Or are there some other Windows encoders that I should try with wine?
 
On another note: is there a way to create bink (.bik format for wonder movies) video files on Linux? FFmpeg can decode bik files with audio, but can not encode them. The RAD encoder doesn't seem to work with wine at all, and the only encoder I've found for Linux (here) can't encode audio. I even tried mixing audio with a bik file generated by this, but RAD tools isn't willing to accept it as a valid file.
Maybe there is an online encoder somewhere? Or are there some other Windows encoders that I should try with wine?
How many videos are we talking about? I can convert you some mp4 files to bik if that is good enough for you.
 
How many videos are we talking about? I can convert you some mp4 files to bik if that is good enough for you.
It's just one small video I quickly cut together from an appropriate youtube video after finding a wonder I wanted to add. Would be great if you converted it!
 

Attachments

I'd try using the isNOfRiver and isWOfRiver functions. For example, if your plot and its northern neighbor both return true for isWOfRiver, that probably means they are connected. There are quite a few cases to cover, but I don't know of a simpler method.
Oh that's a good idea, basically A*-ing your way along the river between the two plots? That could work, thanks.
 
Does anyone have an idea as to how to disable road pillaging? I don't really want to mess around with the DLL and was hoping to pull if off in the XML or through Python.
 
[...] From the looks of it there is CvPlot::getRiverID, but that seems to be used during map generation and seems useless after that. Is it possible at all?
For most map scripts (those that don't override CvMapGenerator::addRivers), river ids do seem to persist. To actually make them useful beyond map generation, I guess one would indeed have to (re-)trace rivers and (re-)assign river ids at game start so that they're available for all map scripts and scenarios. Or ignore river ids and look for a path on the fly. :think: Rivers could change throughout the game (e.g. through WB), so river ids would have to be kept up to date ...
I'd try using the isNOfRiver and isWOfRiver functions. For example, if your plot and its northern neighbor both return true for isWOfRiver, that probably means they are connected. There are quite a few cases to cover, but I don't know of a simpler method.
CvPlot::isRiverConnection should already have this covered. Usage example from CvPlot::isTradeNetworkConnected:
pPlot->isRiverConnection(directionXY(pPlot, this))
And I guess depth-first search. I've implemented one in the DLL before; don't know if that's any help: GitHub.com/f1rpo/AdvCiv/.../CvMap.cpp#L1304
 
Right, maybe I missed something with river IDs, but it seemed like it's not as simple as "plot A and plot B are on the same river IFF A.riverID == B.riverID". Iirc, only one "side" of the river will have the ID, and may be overriden when one tile is passed by multiple rivers that are placed consecutively by the map generator (I think).

But yeah, something like isTradeNetworkConnected for river connection only is basically what I need. I've been looking for an O(1) solution but I guess I have to build one if that's really needed.

By the way, for context, I have been thinking about limitations for Hydro Plants (because they are really powerful compared to other sources of Power, especially in my mod where unhealthiness from power is based on power consumption, and there are a lot more buildings that consume power). One idea would be to only allow one Hydro Plant per river, and only for rivers of a certain length. Of course, that would require a way to identify rivers in some way.
 
Right, maybe I missed something with river IDs, but it seemed like it's not as simple as "plot A and plot B are on the same river IFF A.riverID == B.riverID". Iirc, only one "side" of the river will have the ID, and may be overriden when one tile is passed by multiple rivers that are placed consecutively by the map generator (I think).
Oh, I see; there could be multiple rivers per tile, one touching every corner in the worst case. Then a single river id is really no use, would need a container and maybe a class "River" ... :sad:
Does anyone have an idea as to how to disable road pillaging? I don't really want to mess around with the DLL and was hoping to pull if off in the XML or through Python.
All I can think of is USE_CANNOT_HANDLE_ACTION_CALLBACK=1 and then to check in cannotHandleAction (CvGameUtils.py) whether the given action is a mission of type MISSION_PILLAGE etc.
 
Back
Top Bottom