• We are currently performing site maintenance, parts of civfanatics are currently offline, but will come back online in the coming days. For more updates please see here.

C3C Mechanics: birth of military leader

Antal1987

Warlord
Joined
Sep 4, 2013
Messages
160
Location
Karelia, Russia
Military leaders are born in combat. It happens occasionally and only when elite unit wins a battle. Victorious unit in that case becomes extra elite. The combat can be both attack or defence.

Here's how it works.

There are several conditions when it doesn't happen:
- if the unit is not elite
- if it is naval or air
- if it kills barbarian unit
- if it is already extra elite
- if it is inside an army
- if current battle created unit count > 0; Default battle created unit type is "Leader" (see Civ3QEdit, Scenario Rules, General Settings, Battle-Created Unit)

If all listed conditions are false, the game calculates military leader appearance odds.

Here is math formula: Ratio = 4 * (Small_Wonder_Count <= 0) + 12, where Small_Wonder_Count is count of Small Wonders with flag "Increases_Chance_Of_Leader_Appearance"
If the combat is defence, Ratio doubles: Ratio = Ratio * 2;

Expression (Small_Wonder_Count <= 0) returns 0 if Small_Wonder_Count > 0; 0 - otherwise.

Military leader appears if random(0, Ratio) == 0. That means the odds = 1 / Ratio.

Therefore, maximum chanse of leader appearance = 1 / 12.

That formula can be modified by using tools like Cheat Engine or ArtMoney.

Value 4 cannot be changes.
Value 12 has address: 0x005BF297. It's 4 byte integer.
 
Here is math formula: Ratio = 4 * (Small_Wonder_Count <= 0) + 12, where Small_Wonder_Count is count of Small Wonders with flag "Increases_Chance_Of_Leader_Appearance"

This means that the effect of small wonders is cumulative, right? So having more than one wonder with the flag checked actually works?

I'm just trying to confirm something that I assumed already. :)
 
This means that the effect of small wonders is cumulative, right? So having more than one wonder with the flag checked actually works?

I'm just trying to confirm something that I assumed already. :)

No. It's the same if you have 1 small wonder with that flag, or you have 10 of them.
The expression (Small_Wonder_Count <= 0) is logical. It's result can be 0 (when Small_Wonder_Count > 0) or 1 (when Small_Wonder_Count <= 0). Therefore, it's enough to have only 1 small wonder to activate the effect.
 
Military leaders are born in combat. It happens occasionally and only when elite unit wins a battle. Victorious unit in that case becomes extra elite. The combat can be both attack or defence.

Here's how it works.

There are several conditions when it doesn't happen:
- if the unit is not elite
- if it is naval or air
- if it kills barbarian unit
- if it is already extra elite
- if it is inside an army
- if current battle created unit count > 0; Default battle created unit type is "Leader" (see Civ3QEdit, Scenario Rules, General Settings, Battle-Created Unit)

If all listed conditions are false, the game calculates military leader appearance odds.

Here is math formula: Ratio = 4 * (Small_Wonder_Count <= 0) + 12, where Small_Wonder_Count is count of Small Wonders with flag "Increases_Chance_Of_Leader_Appearance"
If the combat is defence, Ratio doubles: Ratio = Ratio * 2;

Expression (Small_Wonder_Count <= 0) returns 0 if Small_Wonder_Count > 0; 0 - otherwise.

Military leader appears if random(0, Ratio) == 0. That means the odds = 1 / Ratio.

Therefore, minimal chanse of leader appearance = 1 / 12.

That formula can be modified by using tools like Cheat Engine or ArtMoney.

Value 4 cannot be changes.
Value 12 has address: 0x005BF297. It's 4 byte integer.

So if you have at least 1 small wonder that has a flag set for increase chance of leader appearance, then the odds that a leader will appear would be:
(4 * 0) + 12 which equals 12. And then I guess that means a 1/12 chance?

And if you don't have a small wonder with the flag:
(4 * 1) + 12 which equals 16... which means there would be a 1/16 chance
for a leader appearing?

The minimum chance seems to be 1/16 not 1/12.

I guess I'm confused.
 
There has to be more working to produce a Military Great Leader than just that code, as Militaristic cultures have a higher probability of producing a Military Great Leader as well.
 
There has to be more working to produce a Military Great Leader than just that code, as Militaristic cultures have a higher probability of producing a Military Great Leader as well.

Well, here is the code, responsible for processing units winning battles.

Code:
// Combat_Flag:
// 0 - Defence
// 1 - Attack
void __thiscall class_Unit::Process_Combat_Victory(class_Unit *this, class_Unit *Target_Unit, int Combat_Flag)
{
  int v3; // edi@0
  class_Unit *_Target_Unit; // ebx@1
  class_Unit *_this; // esi@1
  int v6; // eax@2
  class_Unit *_Container_Unit; // eax@3
  signed int _Army_Unit_Type_ID; // edi@6
  bool _Can_Start_Golden_Age; // al@6
  int _CivID; // eax@11
  signed int _Combat_Experience; // eax@13
  int v12; // eax@15
  int _Comb_Exp_Promote_Ratio; // edi@17
  int _Unit_Status; // eax@30
  int v15; // eax@34
  const CHAR *v16; // edi@38
  signed int v17; // ecx@38
  bool v18; // zf@40
  int v19; // eax@41
  int v20; // ecx@41
  int v21; // edi@41
  int v22; // edx@41
  const CHAR *v23; // edi@42
  signed int v24; // ecx@42
  int v25; // eax@45
  int v26; // ecx@45
  int v27; // edi@45
  int v28; // edx@45
  const CHAR *v29; // edi@46
  signed int v30; // ecx@46
  int v31; // edx@46
  int v32; // eax@49
  int v33; // edi@49
  int v34; // ecx@49
  char v35; // dl@49
  int v36; // eax@50
  class_Tile *v37; // eax@53
  int v38; // edi@53
  char v39; // al@53
  int v40; // eax@57
  DWORD v41; // eax@60
  int v42; // ebp@60
  int v43; // ecx@60
  int v44; // edx@60
  signed int v45; // edi@60
  int v46; // edx@64
  int v47; // edi@65
  int v48; // ecx@70
  int v49; // ecx@73
  int v50; // ecx@76
  class_Unit *_Container_Unit2; // eax@81
  int _Leader_Appearance_Chance; // eax@84
  class_Tile *v53; // eax@88
  int _Unit_Y; // edi@88
  char v55; // al@88
  class_Unit *_Military_Leader; // edi@89
  int v57; // eax@91
  int v58; // eax@96
  char *v59; // eax@101
  struct_UnitType *_Unit_Type; // eax@109
  class_Tile *v61; // eax@111
  int v62; // ecx@115
  int v63; // eax@115
  void *v64; // ebp@119
  class_Unit *v65; // ebp@120
  class_Unit *v66; // edi@125
  int v67; // edi@133
  int v68; // esi@143
  int v69; // ecx@143
  int v70; // [sp-18h] [bp-2Ch]@54
  int v71; // [sp-18h] [bp-2Ch]@93
  int v72; // [sp-14h] [bp-28h]@54
  int v73; // [sp-14h] [bp-28h]@93
  int v74; // [sp-10h] [bp-24h]@54
  int v75; // [sp-10h] [bp-24h]@93
  char v76; // [sp-Ch] [bp-20h]@54
  char v77; // [sp-Ch] [bp-20h]@93
  signed int v78; // [sp-Ch] [bp-20h]@137
  int v79; // [sp-8h] [bp-1Ch]@6
  int v80; // [sp+8h] [bp-Ch]@64
  int v81; // [sp+8h] [bp-Ch]@115
  DWORD v82; // [sp+Ch] [bp-8h]@60
  int _RaceID; // [sp+10h] [bp-4h]@3
  int thisc; // [sp+1Ch] [bp+8h]@53
  char thisa; // [sp+1Ch] [bp+8h]@60
  int _Unit_X; // [sp+1Ch] [bp+8h]@88
  class_Unit *thisb; // [sp+1Ch] [bp+8h]@111

  _Target_Unit = Target_Unit;
  _this = this;
  if ( !Target_Unit || (v6 = this->Body.CivID, !Civilizations[v6].ID) )
    return;
  _RaceID = Target_Unit->Body.RaceID;
  class_Leader::f56(&Civilizations[v6], Target_Unit->Body.CivID, 2);
  _Container_Unit = class_Base_List::Get_Item(&Units, _this->Body.Container_Unit);
  if ( _Container_Unit && class_Unit::Check_Ability(_Container_Unit, UTA_Army) )
    Civilizations[_this->Body.CivID].Status |= 1u;
  v79 = v3;
  _Army_Unit_Type_ID = class_Unit::f4_Army_Unit_Type(_this);
  _Can_Start_Golden_Age = struct_Unit_Type::Check_Ability(
                            &BIC_Data.UnitTypes[_this->Body.UnitTypeID],
                            UTA_Starts_Golden_Age);
  if ( _Army_Unit_Type_ID == -1 )
  {
Label_1:
    if ( !_Can_Start_Golden_Age )
      goto L_Taking_Chance_For_Leader_Born;
    goto L_Start_Golden_Age;
  }
  if ( !_Can_Start_Golden_Age )
  {
    _Can_Start_Golden_Age = struct_Unit_Type::Check_Ability(
                              &BIC_Data.UnitTypes[_Army_Unit_Type_ID],
                              UTA_Starts_Golden_Age);
    goto Label_1;
  }
L_Start_Golden_Age:
  if ( Target_Unit->Body.CivID )
  {
    _CivID = _this->Body.CivID;
    if ( Civilizations[_CivID].Golden_Age_End == -1 )
      class_Leader::Start_Golden_Age(&Civilizations[_CivID]);
  }
L_Taking_Chance_For_Leader_Born:
  _Combat_Experience = _this->Body.Combat_Experience;
  if ( _Combat_Experience >= 3 )
  {
    if ( BIC_Data.UnitTypes[_this->Body.UnitTypeID].Unit_Class
      || !Target_Unit->Body.CivID
      || _this->Body.Status & 0x20              // Extra Elite
      || (_Container_Unit2 = class_Base_List::Get_Item(&Units, _this->Body.Container_Unit)) != 0
      && class_Unit::Check_Ability(_Container_Unit2, UTA_Army)
      || Civilizations[_this->Body.CivID].Units_Counts[BIC_Data.General.BattleCreatedUnitID] )
      goto LABEL_109;
    _Leader_Appearance_Chance = 4               // if(SW[].Count > 0) _Chance_Ratio += 4;
                                                // 
                                                // _Chance = 1 / (_Chance_Ratio);
                              * (class_Leader::Count_Small_Wonders_With_Flag(
                                   &Civilizations[_this->Body.CivID],
                                   ITSW_Increases_Chance_Of_Leader_Appearance,
                                   0) <= 0)
                              + 12;
    if ( !Combat_Flag )
      LOWORD(_Leader_Appearance_Chance) = 2 * _Leader_Appearance_Chance;
    if ( class_Random::Get_Random(&Random_1, _Leader_Appearance_Chance) )
      goto LABEL_109;
    if ( Combat_Flag
      && (v53 = class_Map::GetTile(
                  &BIC_Data.Map,
                  ((Target_Unit->Body.X >> 1) + Target_Unit->Body.Y * (BIC_Data.Map.Width >> 1))),
          _Unit_Y = Target_Unit->Body.Y,
          _Unit_X = Target_Unit->Body.X,
          v55 = v53->vtable->m35_Check_Is_Water(v53),
          f_Get_Tile_Unit_Process_Data(_Unit_X, _Unit_Y, 6, -1, v55 != 0, -1) <= 1) )
    {
      _Military_Leader = class_Leader::Create_Unit(
                           &Civilizations[_this->Body.CivID],
                           BIC_Data.General.BattleCreatedUnitID,
                           Target_Unit->Body.X,
                           Target_Unit->Body.Y,
                           -1,
                           -1,
                           1,
                           1,
                           -1);
      if ( _Military_Leader )
      {
        if ( Main_Screen_Form.Player_CivID == _this->Body.CivID )
        {
          v57 = &_Military_Leader->Body.Custom_Name;
          if ( !_Military_Leader->Body.Custom_Name.S[0] )
            v57 = BIC_Data.UnitTypes[_Military_Leader->Body.UnitTypeID].Name;
          f_Process_Object_Name(0, v57, -1, -1);
          v77 = 0;
          v75 = "NEWMILLEADER";
          v73 = Target_Unit->Body.Y;
          v71 = Target_Unit->Body.X;
LABEL_99:
          class_Main_Screen_Form::Show_Message_Tool_Tip(&Main_Screen_Form, v71, v73, v75, v77);
          if ( !f_Is_Net_Game() )
            class_Main_Screen_Form::Rename_Unit2(&Main_Screen_Form, _this, 1);
          goto LABEL_101;
        }
        goto LABEL_101;
      }
    }
    else
    {
      _Military_Leader = class_Leader::Create_Unit(
                           &Civilizations[_this->Body.CivID],
                           BIC_Data.General.BattleCreatedUnitID,
                           _this->Body.X,
                           _this->Body.Y,
                           -1,
                           -1,
                           1,
                           1,
                           -1);
      if ( _Military_Leader )
      {
        if ( Main_Screen_Form.Player_CivID == _this->Body.CivID )
        {
          v58 = &_Military_Leader->Body.Custom_Name;
          if ( !_Military_Leader->Body.Custom_Name.S[0] )
            v58 = BIC_Data.UnitTypes[_Military_Leader->Body.UnitTypeID].Name;
          f_Process_Object_Name(0, v58, -1, -1);
          v77 = 0;
          v75 = "NEWMILLEADER";
          v73 = _this->Body.Y;
          v71 = _this->Body.X;
          goto LABEL_99;
        }
LABEL_101:
        v59 = &_Military_Leader->Body.Custom_Name;
        if ( !_Military_Leader->Body.Custom_Name.S[0] )
          v59 = BIC_Data.UnitTypes[_Military_Leader->Body.UnitTypeID].Name;
        class_Replays::Add_Replay(
          &Replays,
          13,
          _Military_Leader->Body.CivID,
          _Military_Leader->Body.X,
          _Military_Leader->Body.Y,
          v59,
          0);
        goto LABEL_104;
      }
    }
LABEL_104:
    if ( f_Is_Net_Game() )
    {
      if ( sub_47B5D0(v79) )
        sub_475AE0(&Net_Game_Data, _this->Body.ID, 32);
      goto LABEL_109;
    }
    _Unit_Status = _this->Body.Status;
    LOBYTE(_Unit_Status) = _Unit_Status | 0x20;
    goto LABEL_108;
  }
  if ( _Combat_Experience )
  {
    v12 = _Combat_Experience - 1;
    if ( v12 )
    {
      if ( v12 == 1 )
        _Comb_Exp_Promote_Ratio = 8;
      else
        _Comb_Exp_Promote_Ratio = Combat_Flag;
    }
    else
    {
      _Comb_Exp_Promote_Ratio = 4;
    }
  }
  else
  {
    _Comb_Exp_Promote_Ratio = 2;
  }
  if ( !Target_Unit->Body.CivID )
    _Comb_Exp_Promote_Ratio *= 2;
  if ( BIC_Data.Races[Civilizations[_this->Body.CivID].RaceID].vtable->CheckBonus(
         &BIC_Data.Races[Civilizations[_this->Body.CivID].RaceID],
         0) )
    _Comb_Exp_Promote_Ratio /= 2;
  if ( _this->Body.Status & 2 || !class_Random::Get_Random(&Random_1, _Comb_Exp_Promote_Ratio) )
  {
    if ( f_Is_Net_Game() )
    {
      if ( sub_47B5D0(v79) )
        sub_4759C0(&Net_Game_Data, _this->Body.ID, _this->Body.Combat_Experience + 1);
    }
    else
    {
      v15 = _this->Body.CivID;
      ++_this->Body.Combat_Experience;
      if ( Main_Screen_Form.Player_CivID == v15 )
      {
        CurrentString = 0;
        switch ( _this->Body.Combat_Experience )
        {
          case 1:
            v29 = &CurrentString;
            v30 = -1;
            v31 = *"PROMOTIONREG";
            do
            {
              if ( !v30 )
                break;
              v18 = *v29++ == 0;
              --v30;
            }
            while ( !v18 );
            v32 = *"OTIONREG";
            v33 = (v29 - 1);
            *v33 = *"UNITPROMOTIONREG";
            v34 = *"NREG";
            *(v33 + 4) = v31;
            v35 = aUnitpromotionreg[16];
            *(v33 + 8) = v32;
            *(v33 + 12) = v34;
            *(v33 + 16) = v35;
            break;
          case 2:
            v23 = &CurrentString;
            v24 = -1;
            do
            {
              if ( !v24 )
                break;
              v18 = *v23++ == 0;
              --v24;
            }
            while ( !v18 );
            v25 = *"PROMOTIONVET";
            v26 = *"OTIONVET";
            v27 = (v23 - 1);
            *v27 = *"UNITPROMOTIONVET";
            v28 = *"NVET";
            *(v27 + 4) = v25;
            LOBYTE(v25) = aUnitpromotionvet[16];
            *(v27 + 8) = v26;
            *(v27 + 12) = v28;
            *(v27 + 16) = v25;
            break;
          case 3:
            v16 = &CurrentString;
            v17 = -1;
            do
            {
              if ( !v17 )
                break;
              v18 = *v16++ == 0;
              --v17;
            }
            while ( !v18 );
            v19 = *"PROMOTIONELITE";
            v20 = *"OTIONELITE";
            v21 = (v16 - 1);
            *v21 = *"UNITPROMOTIONELITE";
            v22 = *"NELITE";
            *(v21 + 4) = v19;
            LOWORD(v19) = *"TE";
            *(v21 + 8) = v20;
            LOBYTE(v20) = aUnitpromotionelite[18];
            *(v21 + 12) = v22;
            *(v21 + 16) = v19;
            *(v21 + 18) = v20;
            break;
        }
        v36 = &_this->Body.Custom_Name;
        if ( !_this->Body.Custom_Name.S[0] )
          v36 = BIC_Data.UnitTypes[_this->Body.UnitTypeID].Name;
        f_Process_Object_Name(0, v36, -1, -1);
        if ( Combat_Flag
          && (v37 = class_Map::GetTile(
                      &BIC_Data.Map,
                      ((Target_Unit->Body.X >> 1) + Target_Unit->Body.Y * (BIC_Data.Map.Width >> 1))),
              v38 = Target_Unit->Body.Y,
              thisc = Target_Unit->Body.X,
              v39 = v37->vtable->m35_Check_Is_Water(v37),
              f_Get_Tile_Unit_Process_Data(thisc, v38, 6, -1, v39 != 0, -1) <= 1) )
        {
          v76 = 0;
          v74 = &CurrentString;
          v72 = Target_Unit->Body.Y;
          v70 = Target_Unit->Body.X;
        }
        else
        {
          v76 = 0;
          v74 = &CurrentString;
          v72 = _this->Body.Y;
          v70 = _this->Body.X;
        }
        class_Main_Screen_Form::Show_Message_Tool_Tip(&Main_Screen_Form, v70, v72, v74, v76);
        if ( BYTE1(_this->Body.Animation.field_100[4]) )
        {
          v40 = sub_539350(&Game, BIC_Data.UnitTypes[_this->Body.UnitTypeID].Unit_Class);
          if ( BYTE1(v40) & 4 )
          {
            if ( BIC_Data.UnitTypes[_this->Body.UnitTypeID].Unit_Class != 2 )
            {
              if ( f_Is_Net_Game() )
              {
                v41 = timeGetTime();
                v42 = 0;
                v82 = v41;
                thisa = 0;
                v43 = 0;
                v44 = dword_785188;
                v45 = 8192;
                do
                {
                  if ( *v44 )
                    v42 = v43 + 1;
                  ++v43;
                  v44 += 4;
                  --v45;
                }
                while ( v45 );
                v46 = 0;
                v80 = v42;
                if ( v42 <= 0 )
                {
LABEL_76:
                  v50 = _this->Body.ID;
                  dword_757188[v46] = 9;
                  dword_74F188[v46] = v50;
                  dword_75F188[v46] = -1;
                  byte_767188[v46] = 0;
                  byte_769188[v46] = 0;
                  dword_76B188[v46] = -1;
                  dword_773188[v46] = -1;
                  dword_77B188[v46] = -1;
                  byte_783188[v46] = 0;
                  dword_785188[v46] = v41;
                  dword_7BD18C[v46] = -1;
                }
                else
                {
                  v47 = dword_757188;
                  while ( !thisa )
                  {
                    if ( !byte_74D188[v46] && v41 < *(v47 + 188416) )
                    {
                      if ( v42 > v46 )
                      {
                        v48 = 4 * v42 + 7664008;
                        do
                        {
                          --v42;
                          *v48 = *(v48 - 4);
                          *(v48 + 32768) = *(v48 + 32764);
                          *(v48 + 65536) = *(v48 + 65532);
                          byte_767189[v42] = byte_767188[v42];
                          byte_769189[v42] = byte_769188[v42];
                          *(v48 + 147456) = *(v48 + 147452);
                          *(v48 + 180224) = *(v48 + 180220);
                          byte_783189[v42] = byte_783188[v42];
                          *(v48 + 221184) = *(v48 + 221180);
                          *(v48 + 450564) = *(v48 + 450560);
                          v48 -= 4;
                        }
                        while ( v42 > v46 );
                        v42 = v80;
                        v41 = v82;
                      }
                      v49 = _this->Body.ID;
                      *v47 = 9;
                      *(v47 - 32768) = v49;
                      *(v47 + 32768) = -1;
                      byte_767188[v46] = 0;
                      byte_769188[v46] = 0;
                      *(v47 + 81920) = -1;
                      *(v47 + 114688) = -1;
                      *(v47 + 147456) = -1;
                      byte_783188[v46] = 0;
                      *(v47 + 188416) = v41;
                      *(v47 + 417796) = -1;
                      thisa = 1;
                    }
                    ++v46;
                    v47 += 4;
                    if ( v46 >= v42 )
                    {
                      if ( thisa )
                        goto LABEL_109;
                      goto LABEL_76;
                    }
                  }
                }
              }
              else
              {
                class_Main_Screen_Data_1AD4::f5(&Main_Screen_Form.Data_1AD4, _this, 9, 0);
              }
            }
          }
        }
      }
    }
    goto LABEL_109;
  }
  if ( f_Is_Net_Game() )
  {
    if ( sub_47B5D0(v79) )
      sub_475AE0(&Net_Game_Data, _this->Body.ID, 2);
    goto LABEL_109;
  }
  _Unit_Status = _this->Body.Status;
  LOBYTE(_Unit_Status) = _Unit_Status | 2;
LABEL_108:
  _this->Body.Status = _Unit_Status;
LABEL_109:
  _Unit_Type = &BIC_Data.UnitTypes[_this->Body.UnitTypeID];
  if ( _Unit_Type->Special_Actions & 0x10040000 && _Unit_Type->field_F4 != -1 )
  {
    thisb = 0;
    v61 = class_Map::GetTile(&BIC_Data.Map, ((_this->Body.X >> 1) + _this->Body.Y * (BIC_Data.Map.Width >> 1)));
    if ( !v61->vtable->m35_Check_Is_Water(v61)
      || !(word_A5263C & 0x24000)
      || !LOBYTE(BIC_Data.field_BD8[1688])
      || BIC_Data.UnitTypes[Target_Unit->Body.UnitTypeID].Unit_Class != 1
      || (v62 = Units.LastIndex, v63 = 0, v81 = 0, Units.LastIndex < 0) )
      goto LABEL_146;
    do
    {
      if ( Units.Items )
      {
        if ( v63 >= 0 )
        {
          if ( v63 <= v62 )
          {
            v64 = Units.Items[v63].Object;
            if ( v64 )
            {
              v65 = (v64 - 28);
              if ( v65 )
              {
                if ( LOBYTE(v65->Body.field_1B0[8]) != -1 && v65->Body.Container_Unit == _Target_Unit->Body.ID )
                {
                  if ( !thisb )
                    thisb = class_Leader::Create_Unit(
                              &Civilizations[_this->Body.CivID],
                              _Target_Unit->Body.UnitTypeID,
                              _this->Body.X,
                              _this->Body.Y,
                              -1,
                              -1,
                              1,
                              0,
                              _Target_Unit->Body.RaceID);
                  v66 = class_Leader::Create_Unit(
                          &Civilizations[_this->Body.CivID],
                          v65->Body.UnitTypeID,
                          _this->Body.X,
                          _this->Body.Y,
                          -1,
                          -1,
                          1,
                          0,
                          -1);
                  LOBYTE(v66->Body.field_1B0[8]) = LOBYTE(v65->Body.field_1B0[8]);
                  v66->Body.Container_Unit = thisb->Body.ID;
                  class_Unit::Set_Unit_State(v66, 1);
                  if ( class_Unit::Check_Ability(thisb, 18) )
                    class_Unit::Include_Unit_In_Army(thisb, v66);
                  if ( Main_Screen_Form.Player_CivID == _this->Body.CivID )
                  {
                    f_Process_Object_Name(0, BIC_Data.UnitTypes[_this->Body.UnitTypeID].Name, -1, -1);
                    f_Process_Object_Name(1, BIC_Data.UnitTypes[v65->Body.UnitTypeID].Name, -1, -1);
                    class_Main_Screen_Form::Show_Message_Tool_Tip(
                      &Main_Screen_Form,
                      _this->Body.X,
                      _this->Body.Y,
                      "PRINCE_ENSLAVE",
                      1);
                    f_Play_Sound(53);
                  }
                  v63 = v81;
                  _Target_Unit = Target_Unit;
                }
              }
            }
          }
        }
      }
      v62 = Units.LastIndex;
      ++v63;
      v81 = v63;
    }
    while ( v63 <= Units.LastIndex );
    if ( !thisb )
    {
LABEL_146:
      if ( class_Random::Get_Random(&Random_1, 0x64u) < 0x21u )
      {
        v67 = BIC_Data.UnitTypes[_this->Body.UnitTypeID].field_F4;
        if ( v67 != -1 )
        {
          if ( class_Leader::Create_Unit(
                 &Civilizations[_this->Body.CivID],
                 v67,
                 _this->Body.X,
                 _this->Body.Y,
                 -1,
                 -1,
                 1,
                 0,
                 _RaceID) )
          {
            if ( Main_Screen_Form.Player_CivID == _this->Body.CivID )
            {
              f_Process_Object_Name(0, BIC_Data.UnitTypes[_this->Body.UnitTypeID].Name, -1, -1);
              f_Process_Object_Name(1, BIC_Data.UnitTypes[v67].Name, -1, -1);
              class_Main_Screen_Form::Show_Message_Tool_Tip(
                &Main_Screen_Form,
                _this->Body.X,
                _this->Body.Y,
                "NORM_ENSLAVE",
                1);
              if ( BIC_Data.UnitTypes[_Target_Unit->Body.UnitTypeID].Unit_Class == 1 )
                v78 = 53;
              else
                v78 = 52;
              f_Play_Sound(v78);
            }
            nullsub_4("** Unit enslaved by %d!\n", _this->Body.CivID);
          }
        }
      }
    }
  }
  if ( _this->Body.Combat_Experience == 3 )
  {
    if ( BIC_Data.UnitTypes[_this->Body.UnitTypeID].Unit_Class == 1 )
    {
      v68 = _this->Body.CivID;
      v69 = Civilizations[v68].Status;
      BYTE1(v69) |= 1u;
      Civilizations[v68].Status = v69;
    }
  }
}

script.txt file have 3 entries for tooltips being used when a leader appears.
- NEWLEADER
- NEWMILLEADER
- NEWSCILEADER

NEWLEADER doesn't even presents in C3C v1.22 exe-file.
NEWMILLEADER has only 2 references, and both of them are inside that function. So, it's the only place, where military leader can be created.

It seems, that there is no checking for militaristic flags of civilizations.

And there is only 1 place in the function where the game is taking chances to create a military leader.

Promotion of unit's combat experience doesn't depends on Civ having Militaristic flag as well.
 
Really? There is no input for Militaristic leaders on a units combat experience? I reluctantly believe you that the military great leaders arent produced with greater odds, but I feel like I consistently get units to veteran and elite status with fewer battles when im playing as a Militaristic leader.

(btw, i find all of your threads fascinating! thank you!)
 
That is interesting that the Militaristic civilizations have no greater probability of getting a Military Great Leader than non-militaristic ones. The game specifically states that Militaristic cultures have a slightly higher chance for a Military Great Leader.
 
That is interesting that the Militaristic civilizations have no greater probability of getting a Military Great Leader than non-militaristic ones. The game specifically states that Militaristic cultures have a slightly higher chance for a Military Great Leader.

I suppose, the developers claimed it but haven't implemented.
 
Thanks for the info! I knew about 1/16 and 1/12, but I didn't realize that defensive leader chances were lower.

Militaristic civs have better promotion chances thus in the larger sense have better chances of getting a leader because there should be more elites.
 
I too must thank you for your treads and efforts! However, I do remember exceptions (probably ptw DYP games) where a naval battle did result in a great leader and an "extra" elite did gain a second *. These events were rare and therefor memorable.:crazyeye:
 
I do remember exceptions (probably ptw DYP games) where a naval battle did result in a great leader and an "extra" elite did gain a second *.

I'm not sure Antal1987 is familiar with the older game versions. "ptw" is "Civilization III Play The World", the first expansion to Civ3, and the first to allow multiplayer features. It's a different executable with some very different features and corruption calculations, so patching at this level would be entirely different. "DYP" is "Double Your Pleasure", one of the more popular mods that was even included on the CD in some releases. It was not a binary patch but changed the game in many ways.

So PTW observations with DYP mod may or may not have anything to do with binary patching of C3C.
 
Back
Top Bottom