path = "/"..GetMapDataPath()

SetPlayerStartResources(1, 0, 0, 0, 0, 0, 0, 0);
SetPlayerStartResources(2, 0, 0, 0, 0, 0, 0, 0);
SetPlayerStartResources(3, 0, 0, 0, 0, 0, 0, 0);
SetPlayerStartResources(4, 0, 0, 0, 0, 0, 0, 0);
SetPlayerStartResources(5, 50, 50, 25, 25, 25, 25, 50000);

SetRegionBlocked("blok0", true, 3);
SetRegionBlocked("blok1", true, 3);
SetRegionBlocked("blok2", true, 3);
SetRegionBlocked("blok3", true, 3);
SetRegionBlocked("blok4", true, 2);
SetRegionBlocked("blok5", true, 2);
SetRegionBlocked("blok6", true, 4);
SetRegionBlocked("blok7", true, 5);
SetRegionBlocked("blok8", true, 5);
SetRegionBlocked("blok8", true, 2);
SetRegionBlocked("blok8", true, 3);
SetRegionBlocked("blok8", true, 4);
SetRegionBlocked("blok9", true, 2);
SetRegionBlocked("blok9", true, 3);
SetRegionBlocked("blok9", true, 4);
SetRegionBlocked("blok9", true, 5);
SetRegionBlocked("blok10", true, 1);

function Bitvaa()
StartCombat("Duncan", nil, 1, 46, 50, nil, nil, nil);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "unnamed 0", nil);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "unnamed 0", "Bitvaa");

function Bitvaa1()
StartCombat("Duncan", nil, 1, 45, 50, nil, nil, nil);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "unnamed 1", nil);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "unnamed 1", "Bitvaa1");

function Bitvaa2()
StartCombat("Duncan", nil, 1, 47, 50, nil, nil, nil);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "unnamed 2", nil);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "unnamed 2", "Bitvaa2");

function Bitvaa3()
StartCombat("Duncan", nil, 1, 48, 50, nil, nil, nil);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "unnamed 3", nil);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "unnamed 3", "Bitvaa3");

function Bitvaa4()
StartCombat("Duncan", nil, 1, 45, 50, nil, nil, nil);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "unnamed 4", nil);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "unnamed 4", "Bitvaa4");

function Bitvaa5()
StartCombat("Duncan", nil, 1, 47, 50, nil, nil, nil);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "unnamed 5", nil);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "unnamed 5", "Bitvaa5");

function Bitvaa6()
StartCombat("Duncan", nil, 1, 45, 50, nil, nil, nil);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "unnamed 6", nil);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "unnamed 6", "Bitvaa6");

function Bitva1()
StartCombat("Duncan", nil, 1, 105, 40, nil, nil, nil, nil);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "bitva2", nil);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "bitva2", "Bitva1");

function Bitva2()
StartCombat("Duncan", nil, 1, 5, 10, nil, nil, nil);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "bitva3", nil);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "bitva3", "Bitva2");

function Bitva3()
StartCombat("Duncan", nil, 1, 3, 10, nil, nil, nil);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "bitva4", nil);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "bitva4", "Bitva3");

function Bitva4()
StartCombat("Duncan", nil, 1, 5, 20, nil, nil, nil);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "bitva5", nil);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "bitva5", "Bitva4");

function Bitva5()
StartCombat("Duncan", nil, 3, 30, 100, 32, 75, 34, 40, nil, nil, nil);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "bitva6", nil);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "bitva6", "Bitva5");

function prohod()
SetRegionBlocked("blok.prohod1", true, 1);
end;

Trigger(REGION_ENTER_WITHOUT_STOP_TRIGGER, "prohod1", "prohod");

function prohod1()
SetRegionBlocked("blok.prohod2", true, 1);
end;

Trigger(REGION_ENTER_WITHOUT_STOP_TRIGGER, "prohod2", "prohod1");

function prohod2()
SetRegionBlocked("blok.prohod3", true, 1);
end;

Trigger(REGION_ENTER_WITHOUT_STOP_TRIGGER, "prohod3", "prohod2");

function prohod3()
SetRegionBlocked("blok.prohod4", true, 1);
end;

Trigger(REGION_ENTER_WITHOUT_STOP_TRIGGER, "prohod4", "prohod3");

function zadanie1_compl1()
SetObjectiveState("x", OBJECTIVE_ACTIVE);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "razgavor1", nil);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "razgavor1", "zadanie1_compl1");

function zadanie1_compl2(hero)
if hero=="Duncan" then
SetObjectiveState("b", OBJECTIVE_ACTIVE);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "razgavor2", nil);
end
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "razgavor2", "zadanie1_compl2");

function zadanie1_compl3()
SetObjectiveState("nbv", OBJECTIVE_ACTIVE);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "razgavor3", nil);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "razgavor3", "zadanie1_compl3");

function Dialog1()
StartAdvMapDialog(0);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "dialog", nil);
MoveCamera(11, 35, 0, 50, 0, 0, 1, 1);
sleep(5)
ShowFlyingSign(path.."17.txt", 13, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."18.txt", 9, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."19.txt", 11, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."20.txt", 17, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."21.txt", 20, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."22.txt", 29, 1, 5.0);
sleep(5)
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "dialog", "Dialog1");

function mes()
ShowFlyingSign(path.."10.txt", 35, 1, 10.0);
end;

Trigger(REGION_ENTER_WITHOUT_STOP_TRIGGER, "1", "mes");

SetObjectEnabled("0", nil);
sleep(1)
SetMonsterSelectionType("0", 0);
SetObjectEnabled("1", nil);
sleep(1)
SetMonsterSelectionType("1", 0);
SetObjectEnabled("2", nil);
sleep(1)
SetMonsterSelectionType("2", 0);
SetObjectEnabled("3", nil);
sleep(1)
SetMonsterSelectionType("3", 0);
SetObjectEnabled("4", nil);
sleep(1)
SetMonsterSelectionType("4", 0);
SetObjectEnabled("5", nil);
sleep(1)
SetMonsterSelectionType("5", 0);
SetObjectEnabled("6", nil);
sleep(1)
SetMonsterSelectionType("6", 0);
SetObjectEnabled("7", nil);
sleep(1)
SetMonsterSelectionType("7", 0);
SetObjectEnabled("8", nil);
sleep(1)
SetMonsterSelectionType("8", 0);
SetObjectEnabled("9", nil);
sleep(1)
SetMonsterSelectionType("9", 0);
SetObjectEnabled("10", nil);
sleep(1)
SetMonsterSelectionType("10", 0);
SetObjectEnabled("11", nil);
sleep(1)
SetMonsterSelectionType("11", 0);
SetObjectEnabled("12", nil);
sleep(1)
SetMonsterSelectionType("12", 0);
SetObjectEnabled("13", nil);
sleep(1)
SetMonsterSelectionType("13", 0);
SetObjectEnabled("14", nil);
sleep(1)
SetMonsterSelectionType("14", 0);
SetObjectEnabled("15", nil);
sleep(1)
SetMonsterSelectionType("15", 0);
SetObjectEnabled("16", nil);
sleep(1)
SetMonsterSelectionType("16", 0);
SetObjectEnabled("17", nil);
sleep(1)
SetMonsterSelectionType("17", 0);
SetObjectEnabled("18", nil);
sleep(1)
SetMonsterSelectionType("18", 0);
SetObjectEnabled("19", nil);
sleep(1)
SetMonsterSelectionType("19", 0);
SetObjectEnabled("20", nil);
sleep(1)
SetMonsterSelectionType("20", 0);
SetObjectEnabled("21", nil);
sleep(1)
SetMonsterSelectionType("21", 0);
SetObjectEnabled("22", nil);
sleep(1)
SetMonsterSelectionType("22", 0);
SetObjectEnabled("23", nil);
sleep(1)
SetMonsterSelectionType("23", 0);
SetObjectEnabled("24", nil);
sleep(1)
SetMonsterSelectionType("24", 0);
SetObjectEnabled("25", nil);
sleep(1)
SetMonsterSelectionType("25", 0);
SetObjectEnabled("26", nil);
sleep(1)
SetMonsterSelectionType("26", 0);
SetObjectEnabled("27", nil);
sleep(1)
SetMonsterSelectionType("27", 0);
SetObjectEnabled("28", nil);
sleep(1)
SetMonsterSelectionType("28", 0);
SetObjectEnabled("29", nil);
sleep(1)
SetMonsterSelectionType("29", 0);
SetObjectEnabled("30", nil);
sleep(1)
SetMonsterSelectionType("30", 0);
SetObjectEnabled("31", nil);
sleep(1)
SetMonsterSelectionType("31", 0);
SetObjectEnabled("32", nil);
sleep(1)
SetMonsterSelectionType("32", 0);
SetObjectEnabled("33", nil);
sleep(1)
SetMonsterSelectionType("33", 0);
SetObjectEnabled("34", nil);
sleep(1)
SetMonsterSelectionType("34", 0);
SetObjectEnabled("35", nil);
sleep(1)
SetMonsterSelectionType("35", 0);
SetObjectEnabled("36", nil);
sleep(1)
SetMonsterSelectionType("36", 0);
SetObjectEnabled("37", nil);
sleep(1)
SetMonsterSelectionType("37", 0);
SetObjectEnabled("38", nil);
sleep(1)
SetMonsterSelectionType("38", 0);
SetObjectEnabled("39", nil);
sleep(1)
SetMonsterSelectionType("39", 0);
SetObjectEnabled("40", nil);
sleep(1)
SetMonsterSelectionType("40", 0);
SetObjectEnabled("41", nil);
sleep(1)
SetMonsterSelectionType("41", 0);
SetObjectEnabled("42", nil);
sleep(1)
SetMonsterSelectionType("42", 0);
SetObjectEnabled("43", nil);
sleep(1)
SetMonsterSelectionType("43", 0);



ShowFlyingSign(path.."1.txt", 1, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."2.txt", 2, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."3.txt", 3, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."4.txt", 4, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."5.txt", 5, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."1.txt", 1, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."2.txt", 2, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."3.txt", 3, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."4.txt", 4, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."5.txt", 5, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."1.txt", 1, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."2.txt", 2, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."3.txt", 3, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."4.txt", 4, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."5.txt", 5, 1, 5.0);
sleep(5)


function final()
OreQuantity = GetPlayerResource(PLAYER_1, ORE);
WoodQuantity = GetPlayerResource(PLAYER_1, WOOD);
SetPlayerResource(PLAYER_1, WOOD, (WoodQuantity - 100))
SetPlayerResource(PLAYER_1, ORE, (OreQuantity - 100))
TransformTown("pop", 0);
SetRegionBlocked("blok10", nil, 1);
SetObjectiveState("nbv", OBJECTIVE_COMPLETED, PLAYER_1)
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "kvest2", nil);
end;

function kvest()
QuestionBox(path.."kvest2.txt", "final", nil);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "kvest2", "kvest");

function zadanie1()
SetObjectiveState("ffffff", OBJECTIVE_ACTIVE);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "rrr", nil);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "rrr", "zadanie1");

function zadanie12()
SetObjectiveState("d", OBJECTIVE_ACTIVE);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "rrrrr", nil);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "rrrrr", "zadanie12");

function quest2()
VARIABLE_GRIFFIN=GetHeroCreatures("Duncan", 8)
if VARIABLE_GRIFFIN>=30 then
RemoveObject("kamen");
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "kvest1", nil);
end;
if VARIABLE_GRIFFIN<30 then
MessageBox(path.."sss.txt");
sleep(5)
end;
end;

function kvest2()
QuestionBox(path.."kvest1.txt", "quest2", nil);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "kvest1", "kvest2");

function mess1(hero)
if hero=="Duncan" then
MessageBox(path.."mes1.txt");
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes1", nil)
ShowFlyingSign(path.."6.txt", 40, 1, 5.0);
end
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes1", "mess1");

function mess2(hero)
if hero=="Duncan" then
MessageBox(path.."mes2.txt");
StartCombat("Duncan", nil, 1, 5, 8, nil, nil, nil);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes2", nil);
end
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes2", "mess2");

function mess3(hero)
if hero=="Duncan" then
ShowFlyingSign(path.."14.txt", 000, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."15.txt", 999, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."16.txt", 888, 1, 5.0);
sleep(5)
MessageBox(path.."mes3.txt");
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes3", nil);
end
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes3", "mess3");

function mess4(hero)
if hero=="Duncan" then
MessageBox(path.."mes4.txt");
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes4", nil)
end
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes4", "mess4");

function mess5(hero)
if hero=="Duncan" then
MessageBox(path.."mes5.txt");
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes5", nil);
ShowFlyingSign(path.."11.txt", 41, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."12.txt", 42, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."13.txt", 43, 1, 10.0);
end
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes5", "mess5");

function mess6(hero)
if hero=="Duncan" then
MessageBox(path.."mes6.txt");
StartCombat("Duncan", nil, 2, 29, 300, 32, 200, nil, nil, nil);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes6", nil);
end
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes6", "mess6");

function mess7(hero)
if hero=="Duncan" then
MessageBox(path.."mes7.txt");
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes7", nil);
end
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes7", "mess7");

function mess8(hero)
if hero=="Duncan" then
MessageBox(path.."mes8.txt");
StartCombat("Duncan", nil, 1, 55, 10, nil, nil, nil);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes8", nil);
end
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes8", "mess8");

function mess9(hero)
if hero=="Duncan" then
MessageBox(path.."mes9.txt");
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes9", nil);
end
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes9", "mess9");

function mess10(hero)
if hero=="Duncan" then
MessageBox(path.."mes10.txt");
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes10", nil);
end
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes10", "mess10");

function mess11(hero)
if hero=="Duncan" then
MessageBox(path.."mes11.txt");
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes11", nil);
end
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes11", "mess11");

function mess12(hero)
if hero=="Duncan" then
MessageBox(path.."mes12.txt");
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes12", nil);
end
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "mes12", "mess12");

function Vnimanie1(hero)
if hero=="Duncan" then
MessageBox(path.."vnimanie1.txt");
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "vnimanie1", nil);
end
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "vnimanie1", "Vnimanie1");

function Vnimanie3(hero)
if hero=="Duncan" then
MessageBox(path.."vnimanie3.txt");
ShowFlyingSign(path.."7.txt", 31, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."8.txt", 32, 1, 5.0);
sleep(5)
ShowFlyingSign(path.."9.txt", 33, 1, 10.0);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "vnimanie3", nil);
end
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "vnimanie3", "Vnimanie3");

function Vnimanie2(hero)
if hero=="Duncan" then
MessageBox(path.."vnimanie2.txt");
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "vnimanie2", nil);
end
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "vnimanie2", "Vnimanie2");