Mod Component Requests Thread

Once the found button is pressed, the city is built already.

Sounds like one would need to edit the DLL; code there that when a city is found on a water tile, it'd first 'raise' the plot and then build the city.
I know how to edit and compile the DLL but I don't know how to write/create C++.

Or do you have an idea how to work around it in Python?
 
Raze the city, clear the plot.
Change the tile then rebuild the city.
Still may not work though but possible to try.

Else make a new python mission button like what I did for enhanced great people or bad people
Ensure the button can be pressed only when the plot is totally clean except for that unit.
Kill the unit, change the tile and build the city.

There is another project I did before, palm islands.
It changes 3 ocean plots to islands and place cities on them.
 
Raze the city, clear the plot.
Change the tile then rebuild the city.
Still may not work though but possible to try.

Else make a new python mission button like what I did for enhanced great people or bad people
Ensure the button can be pressed only when the plot is totally clean except for that unit.
Kill the unit, change the tile and build the city.

There is another project I did before, palm islands.
It changes 3 ocean plots to islands and place cities on them.

I will have a good look into those works and try to come with a solution myself with this help and infromation:)
When I have good or bad news I'll let it know here; I hope I can succesfully release some kind of modcomp here.
 
This gets ugly.

With a python button the AI does not know how to use it (right?).

When I made the city raze itself immediately after being built, I was reminded that you get a message that the city got destroyed and one of the city names in your City-name-list gets destroyed with it.
Also I do not know how to refer to the plot I called 'city' after 'city' got razed. I am pretty sure I'm not good enough yet in Python for this.

I also noticed that when using this canFoundCitiesOnWater callback; you don't have this 'settlement range': you can build two cities straight next to each other. I don't know how to make the unit look for a city in a radius of 2 and then block it from founding cities on water if there is a city in that radius.

As I said, I'm just not good enough yet for this task. If we got someone here with C++ knowledge it could be made in a clean way by defining that pressing the 'found city button' on water first raises the plot and then builds the city. Then it can also define the radius of 2 to avoid cities that are too close too each other.

Besides that: for a proper use of canFoundCitiesOnWater callback you already need a custom DLL. I don't know who's aware of this, but there are 2 issues with activating that callback in Vanilla/BtS, I had already fixed that with the Better BUG AI. So, for me, editing the DLL seems like the solution. I don't know how to do that properly either. I'm afraid someone else will need to help the original requester with this modcomp.
 
Because when you use return true directly for the callback, it doesn't check for any restrictions.
You want restrictions you have to add a chunk of if else statements.

Whether it is done via python or SDK, unless you can educate the A.I. to found cities in midst of oceans where yields are all 0, don't bother to attempt.

It is like setting a whole continent of desert with no resources.
A.I. Will not settle
 
Because when you use return true directly for the callback, it doesn't check for any restrictions.
You want restrictions you have to add a chunk of if else statements.

Whether it is done via python or SDK, unless you can educate the A.I. to found cities in midst of oceans where yields are all 0, don't bother to attempt.

It is like setting a whole continent of desert with no resources.
A.I. Will not settle

That's why I wanted to make it available for coastal plots only (including lakes probably). This way you simply have an 'extended land mass' when you want to settle. In some situations this could turn out pretty profitable.

But thanks for the advise regarding the radius.

The problem I have with the way I am trying to do it now is that when it razes the city to build a new one on it, it tells you it got razed and it tells you it built a new city, plus one city name in the city-name-list gets deleted like this.

If cities didn't get destroyed when changing the plot level, it wouldn't be much of a problem I suppose. That is something I should check in the SDK if I can fix that, although I have no idea where to look.
 
It was surprisingly easy to find the place and the way to mod in the sdk that cities found on water tiles turn into land tiles. It still crashes the game though. I'm now trying to figure out where I can adjust the order of things happening - first kick out the units, then raise the plot, then build the city.
I already was quite surprised that I managed to do it, albeit the wrong way. If someone knows more about this, please help. What I probably need to know is where in the SDK 'settling' in general is located.
 
CvUnit::found and CvPlayer::found

Thanks! This helped a lot.

I am pretty sure I have to write the code in the CvUnit::found, but I need it to take more arguments (int iX, int iY, bBumpUnits and bUpgradePlots or something like that). I have merged two SDK mods and edited simple things but never really wrote anything. How do I make Bool CvUnit::found take these arguments? I already figured out I had to write those arguments in CvUnits.h as well, but now this is what is a problem to me: CvSelectionGroup.cpp tells me to do something with the MISSION_FOUND. It tells me that in MISSION_FOUND, 'found()' does not take 0, 1 or 2 arguments (depending on some things I copied in between the brackets from looking at other codes what seemed logical but it doesn't work).

EDIT:
I will try to show what I'm trying to do. I'm a beginner on this so don't be surprised if it doesn't make sense:

Code:
bool CvUnit::found(int iX, int iY)
{
	CvPlot* pPlot;

	pPlot = GC.getMapINLINE().plotINLINE(iX, iY);

	if (!canFound(plot()))
	{
		return false;
	}

	if (GC.getGameINLINE().getActivePlayer() == getOwnerINLINE())
	{
		gDLL->getInterfaceIFace()->lookAt(plot()->getPoint(), CAMERALOOKAT_NORMAL);
	}

	if (pPlot->getPlotType() == PLOT_OCEAN)
	{
		pPlot->setPlotType(PLOT_LAND);
		GET_PLAYER(getOwnerINLINE()).found(getX_INLINE(), getY_INLINE());
	}

	if (pPlot->getPlotType() != PLOT_OCEAN)
	{
		GET_PLAYER(getOwnerINLINE()).found(getX_INLINE(), getY_INLINE());
	}

	if (plot()->isActiveVisible(false))
	{
		NotifyEntity(MISSION_FOUND);
	}

	kill(true);

	return true;
}

(and then I still want to use 2 booleans, to push units out and to upgrade the surrounding tiles)
 
What are the different scenarios where you need the booleans to be true and false? Can you not infer the values from the plot type in which case they don't need to be params.

In your code sample below you also have two if statements based on the plot type. The Player->found() call is common to both cases so should be left alone. All you need inside an if is the code that is only applied when the plot is an ocean

PHP:
bool CvUnit::found(int iX, int iY)
{
	CvPlot* pPlot;

	pPlot = GC.getMapINLINE().plotINLINE(iX, iY);

	if (!canFound(plot()))
	{
		return false;
	}

	if (GC.getGameINLINE().getActivePlayer() == getOwnerINLINE())
	{
		gDLL->getInterfaceIFace()->lookAt(plot()->getPoint(), CAMERALOOKAT_NORMAL);
	}

	if (pPlot->getPlotType() == PLOT_OCEAN)
	{
		/* Move any units here */
		pPlot->setPlotType(PLOT_LAND);
		/* Change any other plots as required */
		/* Move the units back */
	}

	GET_PLAYER(getOwnerINLINE()).found(getX_INLINE(), getY_INLINE());

	if (plot()->isActiveVisible(false))
	{
		NotifyEntity(MISSION_FOUND);
	}

	kill(true);

	return true;
}
 
Thanks!
When I build the DLL with this code, it says 'overloaded member function not found in CvUnit'. It did that before already actually. I probably am not using your advice the way I should; C++ still is pretty new to me.
 
That message sounds like you have modified CvUnit.h to add a new method definition, which you shouldn't need to do to test the change above.
 
That message sounds like you have modified CvUnit.h to add a new method definition, which you shouldn't need to do to test the change above.

I didn't change CvUnit.h yet, but I did change this:

bool CvUnit::found(int iX, int iY)

int iX and int iY are not there originally.

I don't know how I can change the plot without making use of iX and iY, so I wonder if there's a way around that or if you can tell me how to add new method definitions.

and what is the code to push out all units? that's what I wanted to use this boolean for; I saw in the SDK that the bBumpUnits boolean was used to push away units when cultural borders expand for example (for units that do not have open borders with the expanding city).
I don't need to put the units back though;)

this other boolean I was talking about, bUpgradePlots, I wanted to use to change the surrounding plots with (ocean bordering to land would change into coast with this). that these are booleans are confusing for me too because in python a boolean would work different from the way I say it of course; that's why I ask if you know how to do that.

Thanks!
 
The method definition in CvUnits.h has to match the method declaration in CvUnits.cpp, you can't change one and not the other.

There is already code in the method to get the X & Y coords if you look at the call to the Player->found():

Code:
getX_INLINE()
getY_INLINE()

bBumpUnits is just there to tell the code that it needs to bump the units, it doesn't actually do the bumping itself. You would need to look at the code in an existing method, like when borders expand, to see how it was used there and put similar code in your method

The same with the other boolean, it would just be used to pass information into the method, but you can work that out for yourself when you test if the plot is an ocean plot.
 
I don't know how I can change the plot without making use of iX and iY, so I wonder if there's a way around that or if you can tell me how to add new method definitions.

Since you're in the CvUnit file, the unit already has functions to determine what plot it's on.

pPlot = plot();

Then if you need the X and Y coordinates, the code would be plot()->getX() and plot()->getY().

I learned C++ by modding. You can often just look around in the same file to find code that does something similar and then copy the way its being done.
 
Thanks guys, I learn quick this way!

bBumpUnits is just there to tell the code that it needs to bump the units, it doesn't actually do the bumping itself. You would need to look at the code in an existing method, like when borders expand, to see how it was used there and put similar code in your method

The same with the other boolean, it would just be used to pass information into the method, but you can work that out for yourself when you test if the plot is an ocean plot.

I just can't find how this is done. I will give you an example:

Code:
void CvPlot::updateCulture(bool bBumpUnits, bool bUpdatePlotGroups)
{
	if (!isCity())
	{
		setOwner(calculateCulturalOwner(), bBumpUnits, bUpdatePlotGroups);
	}
}

This is the whole code for 'CvPlot::updateCulture'. This is also where I got those boolean from, but they are very confusing because they are not used the way you'd normally use a boolean in, well, XML for example.
 
Lack of internal strive is biggest oversimplification in all the Civ series (apart from "Your decision was overruled by Senate" from Civ 2, if anyone remembers).

I mean real life leaders spend most of their time battling domestic political rivals, not foreigners. Civ series mainly concentrate on foreign relations and foreign diplomacy. There is no comprehensive modmod addressing reality of internal politics. Imagine how cool would it be to deal with your satraps, nobles, governors, or leaders of the rival political party!

Can someone design a comprehensive modmod? It is an enormous challenge but also revolutionary addition which will change gameplay forever!

 
Lack of internal strive is biggest oversimplification in all the Civ series (apart from "Your decision was overruled by Senate" from Civ 2, if anyone remembers).

I mean real life leaders spend most of their time battling domestic political rivals, not foreigners. Civ series mainly concentrate on foreign relations and foreign diplomacy. There is no comprehensive modmod addressing reality of internal politics. Imagine how cool would it be to deal with your satraps, nobles, governors, or leaders of the rival political party!

Can someone design a comprehensive modmod? It is an enormous challenge but also revolutionary addition which will change gameplay forever!


Well, total war has governor loyalty. In addition, Total war (and C2C) both have an election system for representational governments. I've been trying to merge the two, with some success.

In addition, Active Senate from Total War will be in my next advanced diplomacy version release.
 
I'd like something that would randomize city names when founded. The first city would always be the same (London, Washington, etc), but every other city would have a random name from the given list of city names. I find that I usually only have the first 6 or so cities, and I'd appreciate the variety. Thanks!
 
Top Bottom