nikossaiz wrote: ↑Sat Oct 24, 2020 7:54 pm hi kronenblatt,
thank you for updated your mod, i will downloaded and play tommorow
oh,i hoped for a solution on this, since provincial unit are an ecential benefit on empires. Maybe if you dont ( or make a sub - version ) implement the % chance of units to become something else? we will have predictabillity but then again to predict things like your oponent is part of the strategy.I tried (b) out a bit in the scripts, but couldn't get it to work, so I'm skipping that development.
It's if Pocus could point at how to implement it in the modded part of the BattleConn_Export function in BattleConnection.BSF, currently looking like this:Pocus wrote: ↑Fri Oct 23, 2020 2:50 pm There is no quick function that will tell you if a unit is a provincial one or not, because for now the code has no use of that (there is no discrimination done based on being provincial or not). A work around would be to check for the presence of the modifier $ID_MOD_UNIT_PROVINCIAL though.
so in this case, you can copy paste this code
modCount = Unit_GetModifiersCount(unitID);
for (modIdx = 0; modIdx < modCount; modIdx++)
{
modTplID = Unit_GetModifierByIndex(unitID, modIdx);
if modTplID happens to be $ID_MOD_UNIT_PROVINCIAL, you are good.
Code: Select all
// Units records
unitCount = Min(512, GetDynamicArrayLength(gBattleDesc.hParticipants)); // hard limit to not crash FOG II static arrays
for (unt = 0; unt < unitCount; unt++)
{
WriteFileWriteLine(" ");
GetDynamicArray(gBattleDesc.hParticipants, unt, p);
unitID = p.id; // this is a live unit, safe and correct to access directly
side = p.side;
if (bSwapSides)
{
side = (side + 1) % 2;
}
// FOR VERSION 1.3.4 of FoGE: Ships are now ignored in case of land battles but don't prevent exporting
if (Unit_BelongsToFamily4(unitID, FAM_UNIT_LTWARSHIP, FAM_UNIT_WARSHIP, FAM_UNIT_HVYWARSHIP, FAM_UNIT_TRANSPORT) == FALSE)
{
sprintf(line, "[Unit%d]", unt);
WriteFileWriteLine(line);
Unit_Alias(unitID);
sprintf(line, "COMMENT %d %s", Abs(Unit_GetNumeral(unitID)), gAlias);
WriteFileWriteLine(line);
sprintf(line, "ID %d", unitID);
WriteFileWriteLine(line);
sprintf(line, "SIDE %d", side);
WriteFileWriteLine(line);
// MODDING
unitside = side;
if (bSwapSides)
{
unitside = (unitside + 1) % 2;
}
ethnicside = Faction_Ethnic(gBattleDesc.factionID[unitside][0] );
idside = Faction_Liaison_SideID(gBattleDesc.factionID[unitside][0] );
BattleConn_MapUnit(unitID, squad);
squadtemp = squad;
Modded_UnitType(ethnicside, squadtemp, idside);
squad = squadtemp;
// VANILLA
sprintf(line, "TYPE %s", squad);
WriteFileWriteLine(line);
StartString();
Unit_PrintName(unitID, 0);
BattleConn_ExportString("NAME");
sprintf(line, "COHESIONMOD %d", Unit_EffecPct(unitID));
WriteFileWriteLine(line);
sprintf(line, "HITPOINTSMOD %d", Unit_HitsPct(unitID));
WriteFileWriteLine(line);
sprintf(line, "EXPERIENCEMOD %d", Unit_Liaison_GetXPMod(unitID));
WriteFileWriteLine(line);
sprintf(line, "QUALITYMOD %d", Unit_Liaison_QualityMod(unitID));
WriteFileWriteLine(line);
sprintf(line, "AGEOD_COST %d", Unit_Liaison_Cost(unitID));
WriteFileWriteLine(line);
}
}
I managed to get values out of modTplID = Unit_GetModifierByIndex(unitID, modIdx), but they were only like 696, 712, or 0. Is 0 non-provincial? But what does then e.g. 696 or 712 mean?