1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Less barbarian aggression and spawning over time

Discussion in 'Civ6 - Individual Components' started by sleeveless, Oct 22, 2016.

  1. sleeveless

    sleeveless Chieftain

    Joined:
    Aug 28, 2012
    Messages:
    6
    Barbs start vanilla and become less likely to spawn and to aggress cities each era. Reason for creating this is that even on standard or smaller maps barbarians were too much of a factor past early game for my liking.

    Spoiler Modified Values :

    Spawn Rate
    Ancient (start) Same
    Classical
    80%
    Renaissance 60%
    Industrial 50%
    Modern 30%
    Atomic 10%
    Information 10%


    Boldness
    Ancient (start) Same
    Classical 80%
    Renaissance 70%
    Industrial 60%
    Modern 30%
    Atomic 10%
    Information 10%


    Values currently barely tested


    Unzip folder to ...\Documents\My Games\Sid Meier's Civilization VI\Mods

    Nearly the entire code was taken from Gedemon, who took it from alpaca. Tested with extreme values to ensure it worked (it did). Feedback welcome.
     

    Attached Files:

    JamesDyk likes this.
  2. xngen

    xngen Chieftain

    Joined:
    Jul 20, 2012
    Messages:
    31
    Are you sure that lowering TurnstoWarriorSpawn actually makes them spawn less often and not the opposite?
    It seems like the name of that property is very off if a lower value means the opposite of what it is saying..
     
  3. sleeveless

    sleeveless Chieftain

    Joined:
    Aug 28, 2012
    Messages:
    6
    Initial test was with a 900% multiplier and I was swarmed by barbs. Your reading certainly makes sense though.
     
  4. xngen

    xngen Chieftain

    Joined:
    Jul 20, 2012
    Messages:
    31
    Thank you, I only wanted to make sure I didn't let swarms of barbarians eat my girlfriends cities.
     
  5. doctorjay

    doctorjay Chieftain

    Joined:
    Sep 17, 2016
    Messages:
    5
    This mod seems not to work.


    Code:
    [113593.885] Status: UpdateDatabase - Loading Rules.sql
    [113593.886] Warning: UpdateDatabase - Error Loading SQL.
    
    There is no Barbarians table. According to game data there is a BarbarianTribes and BarbarianTribeNames table.
     
  6. 12monkeys

    12monkeys Prince

    Joined:
    Nov 24, 2003
    Messages:
    440
    Location:
    Germany, Europe
    agree, the mods not working. Not only the tables not exist, also there is no era information for barbarians somewhere to found, and the column "TurnstoWarriorSpawn" is an integer. So the update statement would never been worked like it is written.

    If have no clue, why sleeveless didn't noticed that, maybe he just copied from somewhere. In any case it was not tested by him (at least not as it was uploaded here).

    Anyhow, a similar (but not equal) result may be achieved with the script below.

    Spoiler rules.sql :

    -----------------------------------------------
    -- increase barb spawn rate from 15 to 16 for all tribes.
    -----------------------------------------------

    UPDATE BarbarianTribes SET TurnstoWarriorSpawn = 20;

    -----------------------------------------------
    -- decsrease Barb raiding BOLDNESS for all tribes
    -----------------------------------------------

    UPDATE BarbarianTribes SET RaidingBoldness = RaidingBoldness*0.5;
    I


    Just copy paste it into "rules.sql".
     
  7. doctorjay

    doctorjay Chieftain

    Joined:
    Sep 17, 2016
    Messages:
    5
    I changed mine to this:
    Spoiler rules.sql :

    UPDATE BarbarianTribes SET TurnstoWarriorSpawn = TurnstoWarriorSpawn * 2;
    UPDATE BarbarianTribes SET RaidingBoldness = RaidingBoldness * 0.5;
    UPDATE BarbarianTribeNames SET NumMilitary = 3;


    Seems to work, barbarians are a little more manageable on faster speeds.
     
  8. Littlebob86

    Littlebob86 Prince

    Joined:
    Oct 24, 2016
    Messages:
    329
    So have you guys actually figured out what works?? I'm looking for camps to probably spawn a little more in vanilla, with around 3 turns per barb, and they aren't afraid to come after you,. Maybe not always with the strongest unit, I tried a config and had 4 longswords spawn each round for 4 rounds :\ :(
     
  9. Salmo

    Salmo Chieftain

    Joined:
    Oct 24, 2016
    Messages:
    59
    Gender:
    Male
    I tried to abstract the barbarianTribes settings code so this mod would work with other mods that modify the Eras table. But it does not seem to work. At least there are no "DEBUG" lines being printed out. So is LUA scripting for new (not pre-existing) LUA files working at the moment?

    Spoiler :
    ]
    Code:
    print("DEBUG LUA SCRIPT ENTRY ...")
    local NumberOfEras = RowCount("Eras")
       if NumberOfEras > 0 then
           for i = 0, NumberOfEras do
               local SpawnRate BoldnessRate MilitaryRate
               local SpawnRateDefault BoldnessDefault MilitaryDefault
               local NumberOfEras = RowCount(Eras)
    
               -- get new era as string
               sql = "SELECT EraType FROM Eras ORDER BY ChronologyIndex LIMIT 1 OFFSET " .. tostring(i)
               local sEra = DB.QUERY(sql)
               print(sql)
    
               -- Barbarian spawn rates --
               -- Spawn rate decreases uniformly with era
               SpawnRateDefault = (15 + 25 + 15) / 3
               SpawnRate = SpawnRateDefault - (i * SpawnRateDefault / NumberOfEras)
               if SpawnRate < 0 then SpawnRate = 0 end
    
               sql = "UPDATE BarbarianTribes SET TurnstoWarriorSpawn = " .. tostring(SpawnRate) .. " WHERE EraType ='" .. sEra .. "'\""
               local resultId = DB.QUERY(sql)
               print(sql)
    
               -- Barbarian aggression/boldness --
               -- aggression increases uniformly with era
               BoldnessDefault = 10
               BoldnessRate = BoldnessDefault + (i * BoldnessDefault / NumberOfEras)
               if (BoldnessRate < 0) then BoldnessRate = 0
               sql = "UPDATE BarbarianTribes SET RaidingBoldness = " .. tostring(BoldnessRate) .. " WHERE EraType ='" .. sEra .. "'\""
               local resultId = DB.QUERY(sql)
               print(sql)
    
               -- Barbarian military --
               -- random military with era tends to increase with era
               MilitaryDefault = 3
               --MilitaryRate = MilitaryDefault + (i * MilitaryDefault / NumberOfEras)
               MilitaryRate = math.floor((math.random(0, 1) * i) + 1)
               if (MilitaryRate < 1) then MilitaryRate = 1
               if (MilitaryRate > 5) then MilitaryRate = 5
               sql = "UPDATE BarbarianTribeNames SET NumMilitary = " .. tostring(MilitaryRate) .. " WHERE EraType ='" .. sEra .. "'\""
               local resultId = DB.QUERY(sql)
               print(sql)
              
           end
           print("DEBUG LUA SCRIPT EXIT ...")
       end
    end
    
    function RowCount(TableName)
       local resultId = DB.QUERY("SELECT COUNT(1) AS count FROM " .. TableName .. \"")
       if resultId then
           local count = result.getDataInt(resultId, "count")
           result.free(resultId)
           return count
       else
           return -1
       end
    end
    
     
  10. 12monkeys

    12monkeys Prince

    Joined:
    Nov 24, 2003
    Messages:
    440
    Location:
    Germany, Europe
  11. Salmo

    Salmo Chieftain

    Joined:
    Oct 24, 2016
    Messages:
    59
    Gender:
    Male

Share This Page