As a French person I feel like it's my duty to explain strikes to you. - AdrienIer

Create an account  

 
Modding Discussion Thread

How to use newly added item power in items.ini?
Reply

Where could I find CoM2 standard terrain tile data? I like most of its tiles except for mountains and legacy mountains as given ioption in modding.ini. How could I mod this?
Reply

\data\tiles
Reply

Thank you.
Reply

@Seravy

Do conditions "(ISCOMBAT()>0)" and "( INCOMBAT(U) )" in unitcalc.cas trigger when ai perform auto-calculate combat?

I modified tactician retort to be based on combat tile but combat tile might or might not valid during auto-calculate combat, so I try to create circumvent rule that make fight between AI using simplified form of script instead but I'm not sure if both conditions above could be using during auto-calculate combat or not. So this is reason I ask this question.
Reply

Hello, I started modding Caster of Magic 2 Windows last month.  First off, its amazing, and helped to much to revise Master of Magic and make it relevant again.  Much better balance, much better AI, etc.  However, I do have a few questions because of course I can't resist modding it.

The first: is there any way to modify the logic of AI settler use?  I'm working on a mod that significantly modifies that desirability of settling various areas, with some locations being highly undesirable.  But I'm curious what tools exactly I have at my disposal.

Second: Is there a way to evaluate the terrain type of city tiles in the EcoMaxPop file?  In other words, would there be a way to iterate through the tiles of a city, evaluate the terrain, and then modify the terrain max pop variable based on things like race, buildings, etc?

I'll have a lot more questions in the future, and thanks in advance :-)
Reply

(January 2nd, 2023, 12:30)Demiansky Wrote: Hello, I started modding Caster of Magic 2 Windows last month.  First off, its amazing, and helped to much to revise Master of Magic and make it relevant again.  Much better balance, much better AI, etc.  However, I do have a few questions because of course I can't resist modding it.

The first: is there any way to modify the logic of AI settler use?  I'm working on a mod that significantly modifies that desirability of settling various areas, with some locations being highly undesirable.  But I'm curious what tools exactly I have at my disposal.

Second: Is there a way to evaluate the terrain type of city tiles in the EcoMaxPop file?  In other words, would there be a way to iterate through the tiles of a city, evaluate the terrain, and then modify the terrain max pop variable based on things like race, buildings, etc?

I'll have a lot more questions in the future, and thanks in advance :-)

There is script for modifying settler unit upon creation (if I recalled correctly, it called correctly, it called settler.cas).
Reply

Quote:The first: is there any way to modify the logic of AI settler use?

You can modify the rules for when the AI builds a settler unit through the production script file, but there is no way to change where they are sent when they are already produced. It should be fairly simple to add custom priority support for settler locations in the next update though.

Quote:Second: Is there a way to evaluate the terrain type of city tiles in the EcoMaxPop file?

There is a GetTerrain() function for that but I can't find one to get the position of the city. Please double check the scripts.txt file, if there really isn't one, I'll add it.

Edit : Maybe a TileinRange() function that works the same as OreInRange() would be a better addition? It should be much faster if the engine handles iterating through the tiles instead of the script.
Reply

Thanks for the reply!  Does GetTerrain() actually get the base terrain type though, as opposed to just special qualities? (the list of legitimate values beneath the function doesn't mention terrain, but it might be implicit).  I couldn't find any reference value for terrain types anywhere else in the code that would fit in the range between 9 - 99.  And yeah, a function like TileInRange(tileDistance,BaseTerrainType) would be great, because I could just check for the number of each terrain type in maxpop calculation, check the race of the city, then apply values to each terrain type based on race.  The general idea behind both my questions is that I'd like to calculate the total available population of a tile based on the race settling it.  So lizard men settlers would want to settle among swamps, rivers, and coasts.  Elves in woods.  Gnolls on plains and hills.  High men on plains, rivers, and coasts.  Etc.

With this model though, you wouldn't want Elves or Humans settling excessively swampy areas, for instance, which is why there would need to be a way to evaluate settler decision making.  Thank you for your time!
Reply

Also, another question for you Seravy, is there a way to alter the starting building of a settlement once its founded?  Or a way to alter it based on race?  I've looked fairly thoroughly and nothing stands out in the files.
Reply



Forum Jump: