sman1975
Emperor
Hi!
I'm working on a mod that changes how Barbarians work (i.e. It's a "Wandering Monster" mod that adds 50 WMs to the game, who spawn as Barbarians). Part of the mod seeks to adjust Barb DEFINES as well.
I have a "configuration.sql" file that is loaded at the beginning of the mod.
The mod wants to have 3 different difficulty levels: EASY, SAVAGE, and APOCALYPTIC.
I'm thinking about adding a row in the DEFINES table, something like 'WANDERING_MONSTER_DIFFICULTY_LEVEL" - with the text value of the 3 levels above.
Ideally, I'm looking for the syntax that would look at the value of that NAME, then adjust the Barb rows accordingly.
Currently, I have the 9 different Barb rows replicated for each difficulty level, and the player can simply "comment out" the levels he doesn't like. But that requires 9 changes. It would be nice if it only required one.
Appreciate any help. My SQL is worse than my LUA, and we all know how bad my LUA is...
Current config file:
I'm working on a mod that changes how Barbarians work (i.e. It's a "Wandering Monster" mod that adds 50 WMs to the game, who spawn as Barbarians). Part of the mod seeks to adjust Barb DEFINES as well.
I have a "configuration.sql" file that is loaded at the beginning of the mod.
The mod wants to have 3 different difficulty levels: EASY, SAVAGE, and APOCALYPTIC.
I'm thinking about adding a row in the DEFINES table, something like 'WANDERING_MONSTER_DIFFICULTY_LEVEL" - with the text value of the 3 levels above.
Ideally, I'm looking for the syntax that would look at the value of that NAME, then adjust the Barb rows accordingly.
Currently, I have the 9 different Barb rows replicated for each difficulty level, and the player can simply "comment out" the levels he doesn't like. But that requires 9 changes. It would be nice if it only required one.
Appreciate any help. My SQL is worse than my LUA, and we all know how bad my LUA is...

Current config file:
Code:
-- ====================================================================================================================================
-- Barbarian/Wandering Monster Settings -- Adjusting these settings will make Barbs easier, more difficult, or MUCH more difficult...
--
-- Default setting is to "Savage"
--
-- Select the difficulty you want to play by "uncommenting" the lines for the appropriate setting.
-- You do this by ensuring there are no dashes in front of the commands.
-- If you leave these lines "commented" (with the double dash in front), they won't impact normal gameplay.
--
-- There are 3 difficulty levels: Easy, Savage, and Apcolyptic
-- To select a particular difficulty, uncomment the UPDATE commands under the section for that difficulty below:
--
-- ===================================================================================================================================
--
-- EASY Difficulty: Wandering Monsters are 25% weaker, normal Barbs spawn less frequently
--
--UPDATE Units SET Combat = round(Combat*0.75), RangedCombat = round(RangedCombat*0.75) WHERE Type LIKE 'UNIT_FAWM_%';
--UPDATE Defines SET Value = 1 WHERE Name = 'BARBARIAN_CAMP_ODDS_OF_NEW_CAMP_SPAWNING'; -- Default 2
--UPDATE Defines SET Value = 5 WHERE Name = 'BARBARIAN_CAMP_MINIMUM_DISTANCE_CAPITAL'; -- Default 4
--UPDATE Defines SET Value = 9 WHERE Name = 'BARBARIAN_CAMP_MINIMUM_DISTANCE_ANOTHER_CAMP'; -- Default 7
--UPDATE Defines SET Value = 1 WHERE Name = 'MAX_BARBARIANS_FROM_CAMP_NEARBY'; -- Default 2
--UPDATE Defines SET Value = 6 WHERE Name = 'MAX_BARBARIANS_FROM_CAMP_NEARBY_RANGE'; -- Default 4
--UPDATE Defines SET Value = 45 WHERE Name = 'BARBARIAN_NAVAL_UNIT_START_TURN_SPAWN'; -- Default 30
--UPDATE Defines SET Value = 50 WHERE Name = 'BARBARIAN_TECH_PERCENT'; -- Default 75
--UPDATE Defines SET Value = -15 WHERE Name = 'BARBARIAN_CITY_ATTACK_MODIFIER'; -- Default -25
-- ====================================================================================================================================
--
-- SAVAGE Difficulty: Wandering Monsters are 50% stronger, normal Barbs spawn more frequently
--
UPDATE Units SET Combat = round(Combat*1.5), RangedCombat = round(RangedCombat*1.5) WHERE Type LIKE 'UNIT_FAWM_%';
UPDATE Defines SET Value = 4 WHERE Name = 'BARBARIAN_CAMP_ODDS_OF_NEW_CAMP_SPAWNING'; -- Default 2
UPDATE Defines SET Value = 4 WHERE Name = 'BARBARIAN_CAMP_MINIMUM_DISTANCE_CAPITAL'; -- Default 4
UPDATE Defines SET Value = 6 WHERE Name = 'BARBARIAN_CAMP_MINIMUM_DISTANCE_ANOTHER_CAMP'; -- Default 7
UPDATE Defines SET Value = 3 WHERE Name = 'MAX_BARBARIANS_FROM_CAMP_NEARBY'; -- Default 2
UPDATE Defines SET Value = 4 WHERE Name = 'MAX_BARBARIANS_FROM_CAMP_NEARBY_RANGE'; -- Default 4
UPDATE Defines SET Value = 25 WHERE Name = 'BARBARIAN_NAVAL_UNIT_START_TURN_SPAWN'; -- Default 30
UPDATE Defines SET Value = 85 WHERE Name = 'BARBARIAN_TECH_PERCENT'; -- Default 75
UPDATE Defines SET Value = -5 WHERE Name = 'BARBARIAN_CITY_ATTACK_MODIFIER'; -- Default -25
-- ====================================================================================================================================
--
-- APOCALYPTIC Difficulty: Wandering Monsters are 300% stronger, normal Barbs spawn much more frequently
--
--UPDATE Units SET Combat = round(Combat*3), RangedCombat = round(RangedCombat*3) WHERE Type LIKE 'UNIT_FAWM_%';
--UPDATE Defines SET Value = 6 WHERE Name = 'BARBARIAN_CAMP_ODDS_OF_NEW_CAMP_SPAWNING'; -- Default 2
--UPDATE Defines SET Value = 3 WHERE Name = 'BARBARIAN_CAMP_MINIMUM_DISTANCE_CAPITAL'; -- Default 4
--UPDATE Defines SET Value = 4 WHERE Name = 'BARBARIAN_CAMP_MINIMUM_DISTANCE_ANOTHER_CAMP'; -- Default 7
--UPDATE Defines SET Value = 5 WHERE Name = 'MAX_BARBARIANS_FROM_CAMP_NEARBY'; -- Default 2
--UPDATE Defines SET Value = 3 WHERE Name = 'MAX_BARBARIANS_FROM_CAMP_NEARBY_RANGE'; -- Default 4
--UPDATE Defines SET Value = 20 WHERE Name = 'BARBARIAN_NAVAL_UNIT_START_TURN_SPAWN'; -- Default 30
--UPDATE Defines SET Value = 100 WHERE Name = 'BARBARIAN_TECH_PERCENT'; -- Default 75
--UPDATE Defines SET Value = 0 WHERE Name = 'BARBARIAN_CITY_ATTACK_MODIFIER'; -- Default -25