Help Required for New Civ!

Viregel

, The Rt. Hon.
Joined
Jun 10, 2013
Messages
1,944
Location
Kingdom of the Britons
Hello all! I have a few questions regarding the code for a new civ, Italy!

Firstly, what's the easiest way of changing a diplomatic penalty for something? In this case, conquest or bullying of city-states. I want to lower it because... um... reasons. The basic point is that nobody gets super annoyed at you when you take over a couple of
city-states (but when you've got about five by the Medieval Era, then they get worried).

Secondly, how would you grant a building upon the conquest of a particular type of city-state? The basic point is that I take over a city-state, and I get a building dependant on if it was religious, mercantile, maritime, militaristic, or cultural.

On that note, I have some XML done for the buildings, but I need to know how to define them. They are stand-alone buildings given upon conquest, so I don't know if I should create a new BuildingClass, or simply have them as a Courthouse replacement. Pretty much whatever's easier.

Also, for general utility, is it possible to take part of an ability and give it to a unit? I tried doing that once, but the game crashed, so I guess I'm taking the wrong approach, and I'd have to put it in as a promotion.

So, thank you very much for any help! It's vastly appreciated, seriously. :D
 
Firstly, what's the easiest way of changing a diplomatic penalty for something? In this case, conquest or bullying of city-states. I want to lower it because... um... reasons. The basic point is that nobody gets super annoyed at you when you take over a couple of
city-states (but when you've got about five by the Medieval Era, then they get worried)

It depends if you want to change the diplo modifier for just one civ or in general. If it's in general it's the file regalman pointed out. If you're looking to do it only for one civ it is much less moddable. The easiest way would be to use one of the "unused" scenario diplo modifiers in lua.

Code:
GameEvents.GetScenarioDiploModifier1.Add(function(ePlayer1, ePlayer2)

I believer there's 3 of them. The problem is, there is only 3 of them, meaning if another mod is also using the same one they will probably interfere with each other.

Secondly, how would you grant a building upon the conquest of a particular type of city-state? The basic point is that I take over a city-state, and I get a building dependant on if it was religious, mercantile, maritime, militaristic, or cultural

Assuming, city state players don't lose their typing when conquered, it would probably be something like:

Code:
GameEvents.CityCaptureComplete.Add(
function(iOldOwner, bIsCapital, iX, iY, iNewOwner, iPop, bConquest)
	local plot = Map.GetPlot(iX, iY);	
	local pCity = plot:GetPlotCity();
	local iNewOwner = pCity:GetOwner();
	local iPreviousOwner = pCity:GetPreviousOwner();
	local nPlayer = Players[iNewOwner];
	local oPlayer = Players[iPreviousOwner];
	if (nPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_XXXX) then
		if oPlayer:IsMinorCiv() then
			if (oPlayer:GetMinorCivTrait() == MinorCivTraitTypes.MINOR_CIV_TRAIT_MILITARISTIC) then

And then wherever/however you want to grant the building (in that city, in your capital, all cities, etc.). CIVILIZATION_XXXX would be whatever mod civ you want it to fire for, and MINOR_CIV_TRAIT_MILITARISTIC is of course militaristic city states (the XML should have the xml names for the other types).

On that note, I have some XML done for the buildings, but I need to know how to define them. They are stand-alone buildings given upon conquest, so I don't know if I should create a new BuildingClass, or simply have them as a Courthouse replacement. Pretty much whatever's easier. D

If they're not buildable on their own, there is no real reason to make them separate buildingclasses as you can grant more than one of the same building class to a city with lua. So you can make them all Courthouse replacements and not have to define anything new. The exception would be if they each use different XML that affects unitclass not type.

Otherwise you need to make sure to define every new buildingclass like:

Code:
<BuildingClasses>
	<Row>
		<Type>BUILDINGCLASS_XXX</Type>
		<DefaultBuilding>BUILDING_XXX</DefaultBuilding>
		<Description>TXT_KEY_BUILDING_XXX_DESC</Description>
	</Row>
</BuildingClasses>

In addition to the regular building XML entry (in <Buildings>) where you define what the building does.

Also, for general utility, is it possible to take part of an ability and give it to a unit? I tried doing that once, but the game crashed, so I guess I'm taking the wrong approach, and I'd have to put it in as a promotion.

It depends on what you're trying to transfer. Some abilities have identical tags in both the traits and unit/promotions xml schema, others don't but you can replicate the ability with lua, and then there are some you probably won't be able to transfer at all.
 
Top Bottom