From ea8ac6ebf94561b92bbc51105162f80582bc8978 Mon Sep 17 00:00:00 2001 From: Andrettin Date: Mon, 25 Sep 2017 13:09:42 +0200 Subject: [PATCH] Fixed issue which caused the Gathering Materials quest's initial dialogue to not trigger --- readme.txt | 3 + .../dwarf/scenarios/gathering_materials.lua | 82 +++++++------------ scripts/map_generation.lua | 8 +- 3 files changed, 38 insertions(+), 55 deletions(-) diff --git a/readme.txt b/readme.txt index 6d8547432a..2382c8e926 100644 --- a/readme.txt +++ b/readme.txt @@ -76,6 +76,9 @@ https://github.com/Andrettin/Wyrmsun * Miscellaneous - Fixed a crash which could occur after loading a saved game. +* Quests +- Fixed issue which caused the Gathering Materials quest's initial dialogue to not trigger. + * Scenarios - Added the "Journey to Haimadala's Stones" (side-)quest for the Haimadala's Progeny scenario. diff --git a/scripts/civilizations/dwarf/scenarios/gathering_materials.lua b/scripts/civilizations/dwarf/scenarios/gathering_materials.lua index e49d2a5d3f..86066ae65e 100644 --- a/scripts/civilizations/dwarf/scenarios/gathering_materials.lua +++ b/scripts/civilizations/dwarf/scenarios/gathering_materials.lua @@ -30,49 +30,27 @@ -- based on the Gathering Materials scenario of the Sceptre of Fire campaign from Battle for Wesnoth if (LoadedGame == false) then - if (GrandStrategy == false or GrandStrategyEventMap) then - SetPlayerData(0, "Faction", "norlund-clan") - - SetDiplomacy(0, "enemy", 1) - SetDiplomacy(0, "enemy", 2) - SetDiplomacy(0, "enemy", 3) - SetDiplomacy(1, "enemy", 0) - SetDiplomacy(1, "enemy", 2) - SetDiplomacy(1, "enemy", 3) - SetDiplomacy(2, "enemy", 0) - SetDiplomacy(2, "enemy", 1) - SetDiplomacy(2, "enemy", 3) - SetDiplomacy(3, "enemy", 0) - SetDiplomacy(3, "enemy", 1) - SetDiplomacy(3, "enemy", 2) - end - - if (GrandStrategy == false) then - unit = CreateUnit("unit-dwarven-axefighter", 0, {19, 47}) - SetUnitVariable(unit, "Character", "rugnur") - unit = CreateUnit("unit-dwarven-steelclad", 0, {19, 47}) - SetUnitVariable(unit, "Character", "baglur") - unit = CreateUnit("unit-dwarven-thane", 0, {19, 47}) - SetUnitVariable(unit, "Character", "thursagan") - elseif (GrandStrategyEventMap) then - -- Rugnur - if (GetProvinceHero("Caverns of Chaincolt", "Rugnur") == 2) then - unit = CreateUnit(GetGrandStrategyHeroUnitType("Rugnur"), 0, {19, 47}) - SetUnitVariable(unit, "Character", "rugnur") - end - - -- Baglur - if (GetProvinceHero("Caverns of Chaincolt", "Baglur") == 2) then - unit = CreateUnit(GetGrandStrategyHeroUnitType("Baglur"), 0, {19, 47}) - SetUnitVariable(unit, "Character", "baglur") - end + SetPlayerData(0, "Faction", "norlund-clan") + + SetDiplomacy(0, "enemy", 1) + SetDiplomacy(0, "enemy", 2) + SetDiplomacy(0, "enemy", 3) + SetDiplomacy(1, "enemy", 0) + SetDiplomacy(1, "enemy", 2) + SetDiplomacy(1, "enemy", 3) + SetDiplomacy(2, "enemy", 0) + SetDiplomacy(2, "enemy", 1) + SetDiplomacy(2, "enemy", 3) + SetDiplomacy(3, "enemy", 0) + SetDiplomacy(3, "enemy", 1) + SetDiplomacy(3, "enemy", 2) - -- Thursagan - if (GetProvinceHero("Caverns of Chaincolt", "Thursagan") == 2) then - unit = CreateUnit(GetGrandStrategyHeroUnitType("Thursagan"), 0, {19, 47}) - SetUnitVariable(unit, "Character", "thursagan") - end - end + unit = CreateUnit("unit-dwarven-axefighter", 0, {19, 47}) + SetUnitVariable(unit, "Character", "rugnur") + unit = CreateUnit("unit-dwarven-steelclad", 0, {19, 47}) + SetUnitVariable(unit, "Character", "baglur") + unit = CreateUnit("unit-dwarven-thane", 0, {19, 47}) + SetUnitVariable(unit, "Character", "thursagan") unit = CreateUnit("unit-goblin-spearman", 1, {59, 53}) IncreaseUnitLevel(unit, 1) @@ -329,7 +307,15 @@ AddTrigger("gathering-materials-introduction", end if (PlayerHasObjective(GetThisPlayer(), "- Collect 10000 copper and 20000 coal") == false and GetNumUnitsAt(-1, "unit-gold-deposit", {0, 0}, {512, 512}) >= 1 and GetNumUnitsAt(-1, "unit-coal-mine", {0, 0}, {512, 512}) >= 2) then for i=0, (PlayerMax - 2) do - if (GetPlayerData(i, "RaceName") == "dwarf" and (GetPlayerData(i, "Name") == "Norlund Clan" or GetPlayerData(i, "Name") == "Shinsplitter Clan" or GetPlayerData(i, "Name") == "Knalga") and GetPlayerData(i, "Name") ~= "Shinsplitter Clan" and FindHero("rugnur", i) ~= nil and FindHero("baglur", i) ~= nil and FindHero("thursagan", i) ~= nil and GetPlayerData(i, "UnitTypesCount", "unit-dwarven-town-hall") >= 1) then + if ( + GetPlayerData(i, "RaceName") == "dwarf" + and (GetPlayerData(i, "Faction") == "norlund-clan" or GetPlayerData(i, "Faction") == "shinsplitter-clan" or GetPlayerData(i, "Faction") == "knalga") + and GetPlayerData(i, "Name") ~= "Shinsplitter Clan" + and FindHero("rugnur", i) ~= nil + and FindHero("baglur", i) ~= nil + and FindHero("thursagan", i) ~= nil + and GetPlayerData(i, "UnitTypesCount", "unit-dwarven-town-hall") >= 1 + ) then player = i return true end @@ -395,15 +381,9 @@ AddTrigger("gathering-materials-introduction", ) end} ) - end}, - nil, - nil, - GrandStrategy + end} ) - end}, - nil, - nil, - GrandStrategy + end} ) return false end diff --git a/scripts/map_generation.lua b/scripts/map_generation.lua index f061dfdcc7..1227ebd41e 100644 --- a/scripts/map_generation.lua +++ b/scripts/map_generation.lua @@ -1245,7 +1245,7 @@ function CreateGoldRocks(gold_mine_number, min_x, max_x, min_y, max_y, symmetric end end -function CreateGoldMines(gold_mine_number, gold_quantity, min_x, max_x, min_y, max_y, symmetric, no_convertibles) +function CreateGoldMines(gold_mine_number, gold_quantity, min_x, max_x, min_y, max_y, symmetric, only_gold) if (LoadedGame == false) then local Count = 0 -- create gold mines @@ -1255,11 +1255,11 @@ function CreateGoldMines(gold_mine_number, gold_quantity, min_x, max_x, min_y, m local gold_mine_spawn_point = FindAppropriateGoldMineSpawnPoint(min_x, max_x, min_y, max_y, symmetric) local RandomNumber = SyncRand(3) local deposit_type - if (RandomNumber == 0 or no_convertibles) then + if (RandomNumber == 0 and not only_gold) then deposit_type = "unit-copper-deposit" - elseif (RandomNumber == 1) then + elseif (RandomNumber == 1 and not only_gold) then deposit_type = "unit-silver-deposit" - elseif (RandomNumber == 2) then + elseif (RandomNumber == 2 or only_gold) then deposit_type = "unit-gold-deposit" end unit = CreateUnit(deposit_type, PlayerNumNeutral, {gold_mine_spawn_point[1], gold_mine_spawn_point[2]})