Skip to content

Commit

Permalink
Fixed issue which caused the Gathering Materials quest's initial dial…
Browse files Browse the repository at this point in the history
…ogue to not trigger
  • Loading branch information
Andrettin committed Sep 25, 2017
1 parent 6ec4392 commit ea8ac6e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 55 deletions.
3 changes: 3 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
82 changes: 31 additions & 51 deletions scripts/civilizations/dwarf/scenarios/gathering_materials.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -395,15 +381,9 @@ AddTrigger("gathering-materials-introduction",
)
end}
)
end},
nil,
nil,
GrandStrategy
end}
)
end},
nil,
nil,
GrandStrategy
end}
)
return false
end
Expand Down
8 changes: 4 additions & 4 deletions scripts/map_generation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]})
Expand Down

0 comments on commit ea8ac6e

Please sign in to comment.