Hello,
I'm trying to create an option that renders all traits useless/equal (effectively called the "VANILLA" option, usefule in MP). The difficult part is to have it done by an option, otherwise it's pretty easy to do in XML. I'm very familiar with option in the SDK, understanding the SDK averagely.
I've tried multiple things, helping me render the traits wortheless in much cases, i.e. the Spiritual trait doesn't allow revolution anymore, the Phi trait doesn't grant 100% GP anymore, etc.
Here is an example :
But there are a few things I can't make work :
The building still gets the bonus applied, I can't get my around that, I've tried several things, including the following one, but to my surprise, it doesn't work.
Also, while the starting units do not, the units that get created still receive the free promotion, i.e. a warrior with aggressive. I dunno where to implement that.
I do not get where this code is.
Finally, I'd like to have the possibility to impeach the civ to create it's own UU (so no UU either, full vanilla) and I can't find the code for that either.
I'm especially interested to know this, because I'd like to make another option to be able to produce ALL the UUs with all Civs, upon having extra bonus (define in xml by UUBonus in UnitInfos.xml). So i.e if UUBonusType for Immortal is Pig, then if the UUOption is checked, all civ can build immortal with Horse & pig.
Focusing on the Vanilla (= no UU) feature, here is what I though would work but didn't (tried other unseccful things) :
And (other try) :
Unsuccesful too. I would have believed this was the UU code part though.
Thx for the help !
P&nny
I'm trying to create an option that renders all traits useless/equal (effectively called the "VANILLA" option, usefule in MP). The difficult part is to have it done by an option, otherwise it's pretty easy to do in XML. I'm very familiar with option in the SDK, understanding the SDK averagely.
I've tried multiple things, helping me render the traits wortheless in much cases, i.e. the Spiritual trait doesn't allow revolution anymore, the Phi trait doesn't grant 100% GP anymore, etc.
Here is an example :
Code:
bool CvPlayer::hasTrait(TraitTypes eTrait) const
{
FAssertMsg((getLeaderType() >= 0), "getLeaderType() is less than zero");
FAssertMsg((eTrait >= 0), "eTrait is less than zero");
//µGMM Start
if (GC.getGameINLINE().isOption(GAMEOPTION_VANILLA_MOD))
{
return false;
}
else
{
return GC.getLeaderHeadInfo(getLeaderType()).hasTrait(eTrait);
}
//GMM End
}
But there are a few things I can't make work :
The building still gets the bonus applied, I can't get my around that, I've tried several things, including the following one, but to my surprise, it doesn't work.
Code:
int CvPlayer::getProductionModifier(BuildingTypes eBuilding) const
{
int iMultiplier = 0;
for (int iI = 0; iI < GC.getNumTraitInfos(); iI++)
{
if (hasTrait((TraitTypes)iI))
{
if (!(GC.getGameINLINE().isOption(GAMEOPTION_VANILLA_MOD)))
{
iMultiplier += GC.getBuildingInfo(eBuilding).getProductionTraits(iI);
if (GC.getBuildingInfo(eBuilding).getSpecialBuildingType() != NO_SPECIALBUILDING)
{
iMultiplier += GC.getSpecialBuildingInfo((SpecialBuildingTypes) GC.getBuildingInfo(eBuilding).getSpecialBuildingType()).getProductionTraits(iI);
}
}
}
}....
Also, while the starting units do not, the units that get created still receive the free promotion, i.e. a warrior with aggressive. I dunno where to implement that.
I do not get where this code is.
Finally, I'd like to have the possibility to impeach the civ to create it's own UU (so no UU either, full vanilla) and I can't find the code for that either.
I'm especially interested to know this, because I'd like to make another option to be able to produce ALL the UUs with all Civs, upon having extra bonus (define in xml by UUBonus in UnitInfos.xml). So i.e if UUBonusType for Immortal is Pig, then if the UUOption is checked, all civ can build immortal with Horse & pig.
Focusing on the Vanilla (= no UU) feature, here is what I though would work but didn't (tried other unseccful things) :
Code:
bool CvCity::canTrain(UnitTypes eUnit, bool bContinue, bool bTestVisible, bool bIgnoreCost, bool bIgnoreUpgrades) const
{
if (eUnit == NO_UNIT)
{
return false;
}
//Primax GMM Start - Vanilla Unique Unit Check - Doesnt work -
if (GC.getGameINLINE().isOption(GAMEOPTION_VANILLA_MOD))
{
if (GC.getUnitInfo(eUnit).isUniqueUnit())
{
return false;
}
}
//Primax GMM Start - Vanilla Unique Unit Check
And Defining a "IsuniqueUnit" boolean in XML
Code:
bool CvCity::canTrain(UnitCombatTypes eUnitCombat) const
{
for (int i = 0; i < GC.getNumUnitClassInfos(); i++)
{
UnitTypes eUnit = (UnitTypes)GC.getCivilizationInfo(getCivilizationType()).getCivilizationUnits(i);
if (NO_UNIT != eUnit)
{
if (GC.getUnitInfo(eUnit).getUnitCombatType() == eUnitCombat)
{
if (canTrain(eUnit))
{
//if (GC.getGameINLINE().isOption(GAMEOPTION_VANILLA_MOD))
//{
// return false;
//}
//else
//{
return true;
//}
}
}
}
}
return false;
}
Thx for the help !
P&nny