// ==EMEVD==
// @docs    nr-common.emedf.json
// @compress    DCX_KRAK
// @game    Sekiro
// @string    "W:\\CL\\data\\Param\\event\\common_func.emevd\u0000W:\\CL\\data\\Param\\event\\common_macro.emevd\u0000\u0000\u0000\u0000\u0000\u0000"
// @linked    [0,82]
// @version    3.6.1
// ==/EMEVD==

$Event(0, Default, function() {
    $InitializeEvent(0, 100000900);
    $InitializeEvent(0, 100000910);
    $InitializeEvent(0, 100000911);
    $InitializeEvent(0, 1000002670);
    $InitializeEvent(0, 1000002680);
    $InitializeEvent(0, 1000002240);
    $InitializeEvent(0, 1000002700);
    $InitializeEvent(0, 100002560);
    $InitializeEvent(0, 100002561);
    $InitializeEvent(0, 1000002705);
    $InitializeEvent(0, 1000002706);
    $InitializeEvent(0, 1000002708);
    $InitializeEvent(0, 1000002707);
    $InitializeEvent(0, 100003000);
    $InitializeEvent(0, 100003002);
    $InitializeEvent(0, 100002690);
    $InitializeEvent(0, 100002691);
    $InitializeEvent(0, 100003001);
    $InitializeEvent(0, 100003003);
    $InitializeEvent(0, 100003004);
    $InitializeEvent(0, 1000002200);
    $InitializeEvent(0, 1000002201);
    $InitializeEvent(0, 1000002220, 10002220);
    $InitializeEvent(0, 1000002221, 10002221);
    $InitializeEvent(0, 1000002222);
    $InitializeEvent(0, 1000002223, 10002221);
    $InitializeEvent(0, 1000002224, 10002221);
    $InitializeEvent(0, 1000002225);
    $InitializeEvent(0, 1000002230, 10000410, 10002950);
    $InitializeEvent(1, 1000002230, 10000412, 10002951);
    $InitializeEvent(2, 1000002230, 10000414, 10002952);
    $InitializeEvent(3, 1000002230, 10000416, 10002953);
    $InitializeEvent(0, 1000002260);
    $InitializeEvent(0, 1000002300);
    $InitializeEvent(0, 1000002301);
    $InitializeEvent(0, 100000901);
    $InitializeEvent(0, 100002990);
    $InitializeEvent(0, 100002991);
    $InitializeEvent(0, 100002992);
    $InitializeEvent(0, 100003432);
    $InitializeEvent(0, 100003433);
    $InitializeEvent(2, 100003400, 1009360, Hero.Ironeye);
    $InitializeEvent(0, 100003430);
    $InitializeEvent(4, 100003400, 1009540, Hero.Raider);
    $InitializeEvent(0, 100003431);
    $InitializeEvent(6, 100003400, 1009760, Hero.Recluse);
    $InitializeEvent(7, 100003400, 1009860, Hero.Executor);
    $InitializeEvent(0, 100002993);
    $InitializeEvent(0, 100002994);
    $InitializeEvent(0, 1000002270);
    $InitializeEvent(0, 100003100, 1159110, ScenarioSection.Raider, 10001550, 10001555);
    $InitializeEvent(1, 100003100, 1159111, ScenarioSection.Raider, 10001551, 10001556);
    $InitializeEvent(2, 100003100, 1159112, ScenarioSection.Raider, 10001552, 10001557);
    $InitializeEvent(3, 100003100, 1119110, ScenarioSection.Wylder, 10001150, 10001155);
    $InitializeEvent(4, 100003100, 1119111, ScenarioSection.Wylder, 10001151, 10001156);
    $InitializeEvent(5, 100003100, 1119112, ScenarioSection.Wylder, 10001152, 10001157);
    $InitializeEvent(6, 100003100, 1149210, ScenarioSection.Duchess, 10001450, 10001455);
    $InitializeEvent(7, 100003100, 1149211, ScenarioSection.Duchess, 10001451, 10001456);
    $InitializeEvent(8, 100003100, 1149212, ScenarioSection.Duchess, 10001452, 10001457);
    $InitializeEvent(9, 100003100, 1149212, ScenarioSection.Duchess, 10001453, 10001458);
    $InitializeEvent(10, 100003100, 1149213, ScenarioSection.Duchess, 10001454, 10001459);
    $InitializeEvent(11, 100003100, 1129220, ScenarioSection.Guardian, 10001250, 10001255);
    $InitializeEvent(12, 100003100, 1129221, ScenarioSection.Guardian, 10001251, 10001256);
    $InitializeEvent(13, 100003100, 1129222, ScenarioSection.Guardian, 10001252, 10001257);
    $InitializeEvent(0, 100003200, 1129223, ScenarioSection.Guardian, 10001253, 10001258);
    $InitializeEvent(15, 100003100, 1169210, ScenarioSection.Revenant, 10001650, 10001655);
    $InitializeEvent(16, 100003100, 1169211, ScenarioSection.Revenant, 10001651, 10001656);
    $InitializeEvent(17, 100003100, 1169212, ScenarioSection.Revenant, 10001652, 10001657);
    $InitializeEvent(18, 100003100, 1189210, ScenarioSection.Executor, 10001850, 10001855);
    $InitializeEvent(19, 100003100, 1189211, ScenarioSection.Executor, 10001851, 10001856);
    $InitializeEvent(20, 100003100, 1139210, ScenarioSection.Ironeye, 10001350, 10001355);
    $InitializeEvent(21, 100003100, 1139211, ScenarioSection.Ironeye, 10001351, 10001356);
    $InitializeEvent(22, 100003100, 1179210, ScenarioSection.Recluse, 10001750, 10001755);
    $InitializeEvent(23, 100003100, 1179211, ScenarioSection.Recluse, 10001751, 10001756);
    $InitializeEvent(24, 100003100, 1179212, ScenarioSection.Recluse, 10001752, 10001757);
    $InitializeEvent(0, 100002420, 11000, 100);
    $InitializeEvent(1, 100002420, 11002, 101);
    $InitializeEvent(2, 100002420, 14000, 102);
    $InitializeEvent(3, 100002420, 14001, 138);
    $InitializeEvent(4, 100002420, 14002, 143);
    $InitializeEvent(5, 100002420, 18000, 104);
    $InitializeEvent(6, 100002420, 18002, 106);
    $InitializeEvent(7, 100002420, 17001, 108);
    $InitializeEvent(8, 100002420, 17002, 148);
    $InitializeEvent(9, 100002420, 13002, 111);
    $InitializeEvent(10, 100002420, 12001, 113);
    $InitializeEvent(11, 100002420, 12002, 115);
    $InitializeEvent(12, 100002420, 12003, 144);
    $InitializeEvent(13, 100002420, 12000, 114);
    $InitializeEvent(14, 100002420, 15000, 134);
    $InitializeEvent(15, 100002420, 15002, 136);
    $InitializeEvent(0, 100002450, 1119028, 10001831, 118);
    $InitializeEvent(1, 100002450, 1149002, 10001832, 119);
    $InitializeEvent(8, 100002450, 1149005, 10001838, 139);
    $InitializeEvent(9, 100002450, 1149110, 10001841, 143);
    $InitializeEvent(2, 100002450, 1129101, 10001833, 120);
    $InitializeEvent(3, 100002450, 1129112, 10001834, 121);
    $InitializeEvent(4, 100002450, 1129032, 10001830, 115);
    $InitializeEvent(5, 100002450, 1129061, 10001835, 140);
    $InitializeEvent(6, 100002450, 1129073, 10001836, 114);
    $InitializeEvent(7, 100002450, 1129036, 10001837, 144);
    $InitializeEvent(10, 100002450, 1159041, 10001842, 142);
    $InitializeEvent(11, 100002450, 1119082, 10001844, 145);
    $InitializeEvent(12, 100002450, 1119081, 10001845, 146);
    $InitializeEvent(13, 100002450, 1179131, 10001822, 108);
    $InitializeEvent(14, 100002450, 1179028, 10001846, 148);
    $InitializeEvent(0, 100002590);
    $InitializeEvent(0, 100002601, 1149047, 10001840, 138, 2.5);
    $InitializeEvent(1, 100002601, 1149029, 10001839, 137, 0);
    $InitializeEvent(0, 100002610, 9602, 60020);
    $InitializeEvent(1, 100002610, 9605, 60070);
    $InitializeEvent(2, 100002610, 9608, 60120);
    $InitializeEvent(3, 100002610, 9611, 60170);
    $InitializeEvent(4, 100002610, 9614, 60220);
    $InitializeEvent(5, 100002610, 9617, 60270);
    $InitializeEvent(6, 100002610, 9620, 60320);
    $InitializeEvent(7, 100002610, 9623, 60370);
    $InitializeEvent(0, 100004000, Hero.Raider, 103000, 1159090, 1159100, 1009540);
    $InitializeEvent(1, 100004000, Hero.Raider, 103010, 1159091, 1159101, 1009540);
    $InitializeEvent(2, 100004000, Hero.Raider, 103030, 1159092, 1159102, 1009540);
    $InitializeEvent(3, 100004000, Hero.Wylder, 101030, 1119060, 1119100, 1009140);
    $InitializeEvent(4, 100004000, Hero.Wylder, 101020, 1119061, 1119101, 1009140);
    $InitializeEvent(5, 100004000, Hero.Wylder, 101010, 1119062, 1119102, 1009140);
    $InitializeEvent(6, 100004000, Hero.Guardian, 107000, 1129200, 1129210, 1009260);
    $InitializeEvent(7, 100004000, Hero.Guardian, 107030, 1129201, 1129211, 1009260);
    $InitializeEvent(8, 100004000, Hero.Guardian, 107040, 1129202, 1129212, 1009260);
    $InitializeEvent(0, 100004100, Hero.Guardian, 107020, 1129203, 1129213, 1009260, 1129036);
    $InitializeEvent(1, 100004100, Hero.Guardian, 107010, 1129203, 1129213, 1009260, 1129037);
    $InitializeEvent(9, 100004000, Hero.Revenant, 108000, 1169200, 1169220, 1009660);
    $InitializeEvent(10, 100004000, Hero.Revenant, 108020, 1169201, 1169221, 1009660);
    $InitializeEvent(11, 100004000, Hero.Revenant, 108010, 1169202, 1169222, 1009660);
    $InitializeEvent(12, 100004000, Hero.Executor, 104010, 1189200, 1189220, 1009860);
    $InitializeEvent(13, 100004000, Hero.Executor, 104030, 1189201, 1189221, 1009860);
    $InitializeEvent(14, 100004000, Hero.Duchess, 102040, 1149200, 1149220, 1009460);
    $InitializeEvent(15, 100004000, Hero.Duchess, 102000, 1149201, 1149221, 1009460);
    $InitializeEvent(16, 100004000, Hero.Duchess, 102010, 1149202, 1149222, 1009460);
    $InitializeEvent(17, 100004000, Hero.Duchess, 102030, 1149203, 1149223, 1009460);
    $InitializeEvent(18, 100004000, Hero.Recluse, 105000, 1179120, 1179220, 1009760);
    $InitializeEvent(19, 100004000, Hero.Recluse, 105010, 1179121, 1179221, 1009760);
    $InitializeEvent(20, 100004000, Hero.Recluse, 105020, 1179122, 1179222, 1009760);
    $InitializeEvent(21, 100004000, Hero.Ironeye, 106000, 1139100, 1139220, 1009360);
    $InitializeEvent(22, 100004000, Hero.Ironeye, 106030, 1139101, 1139221, 1009360);
    $InitializeEvent(0, 100003300);
    $InitializeEvent(0, 100003310);
    $InitializeEvent(0, 100007010);
    $InitializeEvent(0, 100007200);
    $InitializeEvent(0, 100007201);
    $InitializeEvent(0, 1000007030);
    $InitializeEvent(0, 1000007031);
    $InitializeEvent(0, 100007302);
    $InitializeEvent(0, 100007400);
    $InitializeEvent(0, 100007700);
    $InitializeEvent(0, 100007800);
    $InitializeEvent(0, 100007810);
    $InitializeEvent(0, 100007811);
    $InitializeEvent(0, 100007820);
    $InitializeEvent(0, 100002530, 401, 2, 10001820);
    $InitializeEvent(1, 100002530, 403, 2, 10001827);
    $InitializeEvent(2, 100002530, 701, 2, 10001821);
    $InitializeEvent(3, 100002530, 302, 2, 10001823);
    $InitializeEvent(4, 100002530, 202, 2, 10001824);
    $InitializeEvent(5, 100002530, 602, 2, 10001826);
    $InitializeEvent(6, 100002530, 203, 2, 10001825);
    $InitializeEvent(0, 100002550);
    $InitializeEvent(0, 100002551);
    $InitializeEvent(0, 100002552);
    $InitializeCommonEvent(0, 9045010, 10001409, 10001430, 10001431, 10001432);
    $InitializeCommonEvent(0, 9045011, 10001409, 10001430, 10001431, 10001432);
    $InitializeEvent(0, 100002553);
    $InitializeEvent(0, 100002554);
    $InitializeEvent(0, 100002555);
    $InitializeEvent(0, 100002556);
    $InitializeEvent(0, 100002557);
    $InitializeEvent(0, 100002660);
    $InitializeEvent(0, 100002570);
    $InitializeEvent(0, 100002571);
    $InitializeEvent(0, 100002580);
    $InitializeEvent(0, 1000001890);
    $InitializeEvent(0, 1000001000);
    $InitializeEvent(0, 1000001500);
    $InitializeEvent(0, 1000001505);
    $InitializeEvent(0, 100009200);
    $InitializeEvent(0, 100009201);
    $InitializeEvent(0, 100009202);
    $InitializeEvent(0, 1000009203);
    $InitializeEvent(0, 1000009204);
    $InitializeEvent(0, 100009204);
    $InitializeEvent(0, 100009191);
    $InitializeEvent(0, 100009192);
    $InitializeEvent(0, 100009190);
    $InitializeEvent(0, 100009193);
    $InitializeEvent(0, 100009194);
    $InitializeEvent(0, 100009197);
    $InitializeEvent(0, 100009198);
    $InitializeEvent(0, 100009199);
    $InitializeEvent(0, 100009216, 10002028);
    $InitializeEvent(1, 100009216, 10002029);
    $InitializeEvent(2, 100009216, 10002030);
    $InitializeEvent(0, 100009196);
    $InitializeEvent(0, 100009210);
    $InitializeEvent(0, 100009211);
    $InitializeEvent(0, 100009212, 10002026, 1119054, 101040);
    $InitializeEvent(1, 100009212, 10002027, 1119055, 101050);
    $InitializeEvent(0, 100009214);
    $InitializeEvent(0, 100009217);
    $InitializeEvent(0, 100009250);
    $InitializeEvent(0, 100009251);
    $InitializeEvent(0, 100009253);
    $InitializeEvent(0, 100009255);
    $InitializeEvent(0, 100009256);
    $InitializeEvent(0, 10009311);
    $InitializeEvent(0, 10009313);
    $InitializeEvent(0, 100009258);
    $InitializeEvent(0, 100009259);
    $InitializeEvent(0, 100009260);
    $InitializeEvent(0, 100009261);
    $InitializeEvent(0, 100009262);
    $InitializeEvent(0, 100009280);
    $InitializeEvent(0, 100009281);
    $InitializeEvent(0, 100009282);
    $InitializeEvent(0, 100009283);
    $InitializeEvent(0, 100009300);
    $InitializeEvent(0, 100009301);
    $InitializeEvent(0, 100009302);
    $InitializeEvent(0, 100009303);
    $InitializeEvent(0, 100009304);
    $InitializeEvent(0, 10009306);
    $InitializeEvent(0, 10009308, 10003450, 100, 6101);
    $InitializeEvent(0, 10009305);
    $InitializeEvent(0, 10009309);
    $InitializeEvent(0, 10009307);
    $InitializeEvent(0, 10009440);
    $InitializeEvent(0, 10009441);
    $InitializeEvent(0, 10009442);
    $InitializeEvent(0, 10009443);
    $InitializeEvent(0, 10009444);
    $InitializeEvent(0, 10009445);
    $InitializeEvent(0, 10009446);
    $InitializeEvent(0, 10009447);
    $InitializeEvent(0, 10009448);
    $InitializeEvent(0, 10009449);
    $InitializeEvent(0, 10009450);
    $InitializeEvent(0, 10009451);
    //$InitializeEvent(0, 100005002); //raider remembrance
    //$InitializeEvent(0, 100005003); //raider remembrance
    //$InitializeEvent(0, 100005004); //raider remembrance
    //$InitializeEvent(0, 100005005); //raider remembrance
    $InitializeEvent(0, 100005006);
    $InitializeEvent(0, 100005007);
    $InitializeEvent(0, 100005008);
    $InitializeEvent(0, 100005009);
    $InitializeEvent(0, 100005001);
    $InitializeEvent(0, 100006001);
    //$InitializeEvent(0, 100006002); //revenant remembrance
    //$InitializeEvent(0, 100006004); //revenant remembrance
    $InitializeEvent(0, 100006003);
    $InitializeEvent(0, 100006005, 10003308, 10003610, 10003610);
    $InitializeEvent(0, 100006006);
    $InitializeEvent(0, 100009380);
    $InitializeEvent(0, 100009381);
    $InitializeEvent(0, 100009382);
    $InitializeEvent(0, 100009383);
    $InitializeEvent(0, 100009384);
    $InitializeEvent(0, 100009385);
    $InitializeCommonEvent(0, 90005701, 10001702, 10003360, 10003360, 10003353, 3);
    $InitializeEvent(0, 100009386);
    $InitializeEvent(0, 100009387);
    $InitializeEvent(0, 100009388);
    $InitializeEvent(0, 100009389);
    $InitializeEvent(0, 10009470);
    $InitializeEvent(0, 10009471);
    $InitializeEvent(0, 10009472);
    $InitializeEvent(0, 10009473);
    $InitializeEvent(0, 10009474);
    $InitializeEvent(0, 100009390);
    $InitializeEvent(0, 100009391);
    //$InitializeEvent(0, 100009392); //raider remembrance
    $InitializeEvent(0, 100009393);
    $InitializeEvent(0, 100009394);
    $InitializeEvent(0, 100009396);
    $InitializeEvent(0, 100009397);
    $InitializeEvent(0, 100009398);
    $InitializeEvent(0, 10009391);
    $InitializeEvent(0, 10009392);
    $InitializeEvent(0, 10009393);
    $InitializeEvent(0, 10009394);
    $InitializeEvent(0, 10009395);
    $InitializeEvent(0, 10009396);
    $InitializeEvent(0, 10009397);
    $InitializeEvent(0, 10009398);
    $InitializeEvent(0, 10009401);
    $InitializeEvent(0, 10009402);
    $InitializeEvent(0, 10009403);
    $InitializeEvent(0, 10009404);
    $InitializeEvent(0, 10009405);
    $InitializeEvent(0, 100004200, ScenarioSection.Wylder, 101);
    $InitializeEvent(1, 100004200, ScenarioSection.Wylder, 102);
    $InitializeEvent(2, 100004200, ScenarioSection.Duchess, 401);
    $InitializeEvent(3, 100004200, ScenarioSection.Duchess, 403);
    $InitializeEvent(4, 100004200, ScenarioSection.Executor, 803);
    $InitializeEvent(5, 100004200, ScenarioSection.Executor, 802);
    $InitializeEvent(6, 100004200, ScenarioSection.Recluse, 701);
    $InitializeEvent(7, 100004200, ScenarioSection.Ironeye, 302);
    $InitializeEvent(8, 100004200, ScenarioSection.Ironeye, 303);
    $InitializeEvent(9, 100004200, ScenarioSection.Guardian, 202);
    $InitializeEvent(10, 100004200, ScenarioSection.Guardian, 203);
    $InitializeEvent(11, 100004200, ScenarioSection.Revenant, 601);
    $InitializeEvent(0, 1000001510, 1109000, 1);
    $InitializeEvent(1, 1000001510, 1109031, 2);
    $InitializeEvent(2, 1000001510, 1109032, 3);
    $InitializeEvent(3, 1000001510, 6031, 4);
    $InitializeEvent(0, 1000001520);
});

$Event(50, Default, function() {
    DisableAreaWelcomeMessage();
    $InitializeEvent(0, 1000002250, 10002220);
});

$Event(100000900, Restart, function() {
    WaitFor(EventFlag(6020));
    if ((EventFlag(3003) && !EventFlag(1109031))
        || (EventFlag(3005) && !EventFlag(1109032))
        || EventFlag(10002405)) {
        WaitFor(EventFlag(10002014));
    }
    WaitFixedTimeFrames(1);
    SetEventFlagID(6020, OFF);
    ShowTutorialPopup(2040, true, true);
    DisplayPermanentBuffPopup(130);
    WaitFixedTimeFrames(1);
    if (EventFlag(10002167)) {
        if (EventFlag(10001901)) {
            if (EventFlag(6071)) {
                ShowTutorialPopup(3420, true, true);
                RecordUserDispLog(12101, 10000, LogObjectType.None, -1);
            }
        }
        if (EventFlag(10001902)) {
            if (EventFlag(6072)) {
                ShowTutorialPopup(3400, true, true);
                RecordUserDispLog(12102, 10000, LogObjectType.None, -1);
            }
        }
        if (EventFlag(10001903)) {
            if (EventFlag(6073)) {
                ShowTutorialPopup(3410, true, true);
                RecordUserDispLog(12103, 10000, LogObjectType.None, -1);
            }
        }
    }
L0:
    EndEvent();
});

$Event(100000901, Restart, function() {
    EndIf(!CurrentScenarioSection(ScenarioSection.None));
    UnknownSound201014(0);
    EndEvent();
});

$Event(100000910, Restart, function() {
    flag = EventFlag(160) && EventFlag(2040);
    if (flag) {
        WaitFor(flag);
        if ((EventFlag(3003) && !EventFlag(1109031))
            || (EventFlag(3005) && !EventFlag(1109032))
            || EventFlag(10002405)) {
            WaitFor(EventFlag(10002014));
        }
        WaitFixedTimeFrames(5);
        SetEventFlagID(130, ON);
        ShowTutorialPopup(1920, true, true);
        UnknownText200722(3500);
        EndEvent();
    }
L0:
    SetEventFlagID(130, OFF);
    EndEvent();
});

$Event(100000911, Restart, function() {
    WaitFor(EventFlag(131));
    if ((EventFlag(3003) && !EventFlag(1109031))
        || (EventFlag(3005) && !EventFlag(1109032))
        || EventFlag(10002405)) {
        WaitFor(EventFlag(10002014));
    }
    WaitFixedTimeFrames(5);
    ShowTutorialPopup(1950, true, true);
});

$Event(1000001000, Restart, function() {
    if (EventFlag(2001)) {
        ShowTutorialPopup(1901, true, true);
        WaitFor(EventFlag(110));
        ShowTutorialPopup(1902, true, true);
        EndEvent();
    }
L1:
    DisableAsset(10005900);
    WaitFixedTimeSeconds(1);
    EndEvent();
});

$Event(1000001500, Restart, function() {
    BatchSetEventFlags(10002201, 10002219, OFF);
    EndEvent();
});

$Event(1000001505, Restart, function() {
    SetEventFlagID(10002254, OFF);
    WaitFor(
        CharacterHasSpEffect(10001000, 9832)
            || CharacterHasSpEffect(10001001, 9832)
            || CharacterHasSpEffect(10001002, 9832)
            || CharacterHasSpEffect(10001003, 9832)
            || CharacterHasSpEffect(10001801, 9832)
            || CharacterHasSpEffect(10001802, 9832)
            || CharacterHasSpEffect(10001803, 9832)
            || CharacterHasSpEffect(10001804, 9832)
            || CharacterHasSpEffect(10001301, 9832)
            || CharacterHasSpEffect(10001302, 9832)
            || CharacterHasSpEffect(10000717, 9832)
            || CharacterHasSpEffect(10000711, 9832));
    SetEventFlagID(10002254, ON);
});

$Event(1000001510, Restart, function(eventFlagId, achievementId) {
    WaitFor(!EventFlag(eventFlagId));
    WaitFor(EventFlag(eventFlagId));
    AwardAchievement(achievementId);
    EndEvent();
});

$Event(1000001520, Restart, function() {
    WaitFor(EventFlag(6040));
    ShowTutorialPopup(1970, true, true);
    AwardAchievement(5);
    SetEventFlagID(6040, OFF);
    WaitFor(ElapsedFrames(30));
    PlaySE(10000, SoundType.MenuSE, 1100);
    EndEvent();
});

$Event(1000001880, Restart, function(spEffectId, eventFlagId) {
    WaitFor(EventFlag(6037));
    if (!CharacterHasSpEffect(10000, spEffectId)) {
        SetEventFlagID(eventFlagId, OFF);
        WaitFor(CharacterHasSpEffect(10000, spEffectId));
    }
L0:
    SetEventFlagID(eventFlagId, ON);
    WaitFor(!CharacterHasSpEffect(10000, spEffectId));
    SetEventFlagID(eventFlagId, OFF);
    RestartEvent();
});

$Event(1000001890, Restart, function() {
    EndIf(PlayerHasItem(ItemType.Antique, 10002));
    if (!EventFlag(6014)) {
        WaitFor(!PlayerHasItem(ItemType.Antique, 10002) && EventFlag(6012) && EventFlag(6014));
        AwardItemsIncludingClients(100102);
        EndEvent();
    }
L0:
    WaitFor(!PlayerHasItem(ItemType.Antique, 10002) && EventFlag(6012));
    AwardItemLot(100102);
    EndEvent();
});

$Event(1000002200, Restart, function() {
    ForceAnimationPlayback(10000200, 30010, true, false, false);
});

$Event(1000002201, Default, function() {
    SetSpEffect(10000, 103400);
});

//unused
$Event(1000002210, Restart, function() {
    GotoIf(L0, CharacterHasSpEffect(10000, 103100));
    Goto(L1);
L0:
    WaitFor(ActionButtonInArea(9370, 10001520));
    SetSpEffect(10000, 103101);
    WaitFixedTimeSeconds(1);
    RestartEvent();
L1:
    WaitFor(ActionButtonInArea(9371, 10001520));
    SetSpEffect(10000, 103100);
    WaitFixedTimeSeconds(1);
    RestartEvent();
});

$Event(1000002220, Restart, function(areaEntityId) {
    WaitFor(
        InArea(10000, areaEntityId)
            && !CharacterHasSpEffect(10000, 9621)
            && !EventFlag(10003209)
            && !EventFlag(10003113));
            //SetSpEffect(10000, 9621); //disable combat speffect
    SetSpEffect(10000, 604000);
    SetSpEffect(10000, 604001);
    SetSpEffect(10000, 604002);
    SetSpEffect(10000, 604003);
    SetSpEffect(10000, 604004);
    SetSpEffect(10000, 604005);
    SetSpEffect(10000, 604006);
    SetSpEffect(10000, 604007);
    SetSpEffect(10000, 604008);
    SetSpEffect(10000, 604009);
    SetSpEffect(10000, 604010);
    SetSpEffect(10000, 604011);
    SetSpEffect(10000, 604012);
    SetSpEffect(10000, 604013);
    SetSpEffect(10000, 604014);
    SetSpEffect(10000, 604015);
    SetSpEffect(10000, 604016);
    WaitFixedTimeFrames(1);
    RestartEvent();
});

//sparring grounds tutorial/enable combat
$Event(1000002221, Restart, function(areaEntityId) {
    WaitFor(InArea(10000, areaEntityId) && CharacterHasSpEffect(10000, 9621));
    ClearSpEffect(10000, 9621);
    ShowTutorialPopup(1905, true, true);
    WaitFixedTimeFrames(1);
    RestartEvent();
});

//animate sparring target
$Event(1000002222, Restart, function() {
    WaitFor(ActionButtonInArea(6760, 10000220));
    SetSpEffect(10000220, 14063);
    WaitFor(
        !InArea(10000, 10002223)
            || InArea(10000220, 10002224)
            || (CurrentScenarioSection(ScenarioSection.Recluse)
                && TalkNPCEnabled(10001702)
                && EntityInRadiusOfEntity(10000220, 10001702, 5, 1)));
    SetSpEffect(10000220, 14066);
    ClearSpEffect(10000220, 14063);
    ClearSpEffect(10000220, 14056);
    ClearCharactersAITarget(10000220);
    if (!(CurrentScenarioSection(ScenarioSection.Recluse)
        && TalkNPCEnabled(10001702)
        && EntityInRadiusOfEntity(10000220, 10001702, 5, 1))) {
        WaitFor(ElapsedSeconds(0.45));
        ClearCharactersAITarget(10000220);
        ResetCharacterPosition(10000220);
        WaitFor(ElapsedFrames(4));
        ForceAnimationPlayback(10000220, 30004, false, false, false);
        WaitFixedTimeFrames(1);
        RestartEvent();
    }
L1:
    ClearCharactersAITarget(10000220);
    ResetCharacterPosition(10000220);
    WaitFor(ElapsedFrames(4));
    ForceAnimationPlayback(10000220, 30004, false, false, false);
    WaitFixedTimeFrames(1);
    RestartEvent();
});

//bows tutorial
$Event(1000002223, Restart, function(areaEntityId) {
    WaitFor(
        InArea(10000, areaEntityId) && !CharacterHasSpEffect(10000, 9621) && IsHero(Hero.Ironeye));
    WaitFixedTimeFrames(1);
    ShowTutorialPopup(2581, true, true);
    EndEvent();
});

//spells tutorial
$Event(1000002224, Restart, function(areaEntityId) {
    WaitFor(
        InArea(10000, areaEntityId)
            && !CharacterHasSpEffect(10000, 9621)
            && (IsHero(Hero.Recluse) || IsHero(Hero.Revenant)));
    WaitFixedTimeFrames(1);
    ShowTutorialPopup(2571, true, true);
    EndEvent();
});

$Event(1000002225, Restart, function() {
    WaitFor(IsRequestGameMode(2));
    DisableCharacterAI(10000220);
    WaitFor(IsRequestGameMode(0));
    EnableCharacterAI(10000220);
    RestartEvent();
});

$Event(1000002230, Restart, function(chrEntityId, entityId) {
    IssueShortWarpRequest(chrEntityId, TargetEntityType.Area, entityId, -1);
    ForceAnimationPlayback(chrEntityId, 30000, false, false, false);
    WaitFor(CharacterHPValue(chrEntityId) <= 1);
    ForceAnimationPlayback(chrEntityId, 20000, false, false, false);
    WaitFor(CharacterHasSpEffect(chrEntityId, 11473));
    ForceAnimationPlayback(chrEntityId, 30000, false, false, false);
    WaitFor(ElapsedFrames(3));
    RestartEvent();
});

$Event(1000002240, Restart, function() {
    ClearSpEffect(10000, 9652);
    WaitFor(InArea(10000, 10002227));
    SetSpEffect(10000, 9652);
    WaitFor(!InArea(10000, 10002227));
    ClearSpEffect(10000, 9652);
    RestartEvent();
});

$Event(1000002250, Restart, function(areaEntityId) {
    EndIf(!InArea(10000, areaEntityId));
    ForceAnimationPlayback(10000, 61020, false, false, false);
    EndEvent();
});

$Event(1000002260, Restart, function() {
    WaitFor(InArea(10000, 10002225));
    ClearSpEffect(10000, 103400);
    WaitFor(!InArea(10000, 10002225));
    SetSpEffect(10000, 103400);
    RestartEvent();
});

$Event(1000002270, Restart, function() {
    EndIf(CurrentScenarioSection(ScenarioSection.None));
    WaitFor(InArea(10000, 10002225));
    SetNetworkUpdateRate(10001821, true, CharacterUpdateFrequency.AlwaysUpdate);
    SetSpEffect(10001821, 9752);
    WaitFor(ElapsedFrames(1));
    ClearSpEffect(10000, 9752);
    WaitFor(ElapsedSeconds(1));
    WaitFor(CharacterHPValue(10000) > 0 && !InArea(10000, 10002225));
    SetNetworkUpdateRate(10001821, false, CharacterUpdateFrequency.AlwaysUpdate);
    SetSpEffect(10000, 9752);
    WaitFor(ElapsedFrames(1));
    ClearSpEffect(10001821, 9752);
    RestartEvent();
});

$Event(1000002300, Restart, function() {
    DisableAsset(10006310);
    DisableCharacter(10000660);
    if (!EventFlag(6050)) {
        flag = EventFlag(111);
        flag2 = !EventFlag(111) && EventFlag(6050);
        WaitFor(flag || flag2);
        if (!flag2.Passed) {
            if (CurrentScenarioSection(ScenarioSection.None) && TalkNPCEnabled(10000780)) {
                SetEventFlagID(10002405, ON);
                DisableCharacterFadeOnEnable(10000780);
                FadeToBlack(0, 0, true, -1);
                WaitFixedTimeFrames(3);
                WaitFixedTimeSeconds(0.7);
                SetEventFlagID(10002406, ON);
                WaitFixedTimeSeconds(0.3);
                FadeToBlack(0, 0, false, -1);
                WaitFor(!EventFlag(10002406));
                WaitFixedTimeSeconds(0.5);
            }
        }
L1:
        ShowTutorialPopup(1930, true, true);
        SetEventFlagID(10002014, ON);
        WaitFixedTimeFrames(2);
        ShowTutorialPopup(3430, true, true);
    }
L0:
    SetEventFlagID(6050, ON);
    EnableAsset(10006310);
    DisableAsset(10006300);
    EnableCharacter(10000660);
    EndEvent();
});

$Event(1000002301, Restart, function() {
    WaitFor(EventFlag(2001));
    DisableAsset(10001300);
    SetEventFlagID(10001810, ON);
});

$Event(100002420, Restart, function(itemId, permanentBuffParamId) {
    WaitFor(PlayerHasItem(ItemType.Antique, itemId));
    UnknownPermanentBuff2003126(permanentBuffParamId);
});

$Event(100002450, Restart, function(eventFlagId, eventFlagId2, permanentBuffParamId) {
    WaitFor(EventFlag(eventFlagId) && !EventFlag(eventFlagId2));
    DisplayNetworkconnectedPermanentBuffPopup(permanentBuffParamId);
    SetEventFlagID(eventFlagId2, ON);
});

$Event(100002480, Restart, function(missionId, spEffectId) {
    WaitFor(ElapsedFrames(10));
    WaitFor(!EventFlag(10002001));
    WaitFor(ElapsedFrames(15));
    WaitFor(HasMissionState(missionId, 2));
    SetSpEffect(10000, spEffectId);
    WaitFor(HasMissionState(missionId, 3));
    ClearSpEffect(10000, spEffectId);
});

$Event(100002500, Restart, function(missionId, hero, spEffectId) {
    ClearSpEffect(10000, spEffectId);
    WaitFor(HasMissionState(missionId, 2) && IsHero(hero));
    SetSpEffect(10000, spEffectId);
    WaitFor(HasMissionState(missionId, 3));
    ClearSpEffect(10000, spEffectId);
    EndEvent();
});

$Event(100002530, Restart, function(missionId, missionState, eventFlagId) {
    WaitFor(HasMissionState(missionId, missionState) && !EventFlag(eventFlagId));
    SetEventFlagID(eventFlagId, ON);
});

$Event(100002550, Restart, function() {
    ClearSpEffect(10000, 9731);
    ClearSpEffect(10000, 9732);
    ClearSpEffect(10000, 9733);
    WaitFor(!EventFlag(2001));
    WaitFor(!EventFlag(113));
    WaitFor(CountEventFlags(TargetEventFlagType.EventFlag, 110, 112) >= 1);
    SetSpEffect(10000, 9731);
    WaitFor(CountEventFlags(TargetEventFlagType.EventFlag, 110, 112) >= 2);
    SetSpEffect(10000, 9732);
    WaitFor(CountEventFlags(TargetEventFlagType.EventFlag, 110, 112) >= 3);
    SetSpEffect(10000, 9733);
    WaitFor(EventFlag(113));
    ClearSpEffect(10000, 9731);
    ClearSpEffect(10000, 9732);
    ClearSpEffect(10000, 9733);
});

$Event(100002551, Restart, function() {
    DisableAsset(10006891);
    EnableAsset(10006890);
    WaitFor(EventFlag(10001950));
    WaitFor(CurrentScenarioSection(ScenarioSection.None));
    EnableAsset(10006891);
    DisableAsset(10006890);
    ChangeWeather(Weather.Type01, -1, true);
    WaitFor(!EventFlag(10001950));
    RestartEvent();
});

$Event(100002552, Restart, function() {
    WaitFor(
        EventFlag(10001950) && CurrentScenarioSection(ScenarioSection.None) && !EventFlag(10002050));
    WaitFor(InArea(10000, 10002960) && EventFlag(10001950));
    if (EventFlag(10002051)) {
        ActivateGparamOverride(5, 2.5);
        PlaySE(10000, SoundType.EnvironmentalSound, 999990500);
        area |= !InArea(10000, 10002960)
            || CurrentScenarioSection(ScenarioSection.Wylder)
            || CurrentScenarioSection(ScenarioSection.Guardian)
            || CurrentScenarioSection(ScenarioSection.Ironeye)
            || CurrentScenarioSection(ScenarioSection.Duchess)
            || CurrentScenarioSection(ScenarioSection.Raider)
            || CurrentScenarioSection(ScenarioSection.Revenant)
            || CurrentScenarioSection(ScenarioSection.Recluse)
            || CurrentScenarioSection(ScenarioSection.Executor);
        RestartIf(EventFlag(10002050));
        WaitFor(area);
        DeactivateGparamOverride(2.5);
        PlaySE(10000, SoundType.EnvironmentalSound, 999990501);
        WaitFor(ElapsedSeconds(2.5));
        RestartEvent();
    }
L0:
    ActivateGparamOverride(5, 0);
    SetEventFlagID(10002051, ON);
    WaitFor(ElapsedSeconds(0.1));
    PlaySE(10000, SoundType.EnvironmentalSound, 999990500);
    area |= !InArea(10000, 10002960)
        || CurrentScenarioSection(ScenarioSection.Wylder)
        || CurrentScenarioSection(ScenarioSection.Guardian)
        || CurrentScenarioSection(ScenarioSection.Ironeye)
        || CurrentScenarioSection(ScenarioSection.Duchess)
        || CurrentScenarioSection(ScenarioSection.Raider)
        || CurrentScenarioSection(ScenarioSection.Revenant)
        || CurrentScenarioSection(ScenarioSection.Recluse)
        || CurrentScenarioSection(ScenarioSection.Executor);
    RestartIf(EventFlag(10002050));
    WaitFor(area);
    DeactivateGparamOverride(2.5);
    PlaySE(10000, SoundType.EnvironmentalSound, 999990501);
    WaitFor(ElapsedSeconds(2.5));
    RestartEvent();
});

$Event(100002553, Restart, function() {
    WaitFor(CurrentScenarioSection(ScenarioSection.Wylder));
    DisplayPermanentBuffPopup(147);
});

$Event(100002554, Restart, function() {
    WaitFor(EventFlag(110));
    DisplayPermanentBuffPopup(131);
});

$Event(100002555, Restart, function() {
    WaitFor(EventFlag(10001950) && EventFlag(10002050));
    DeactivateGparamOverride(0);
    WaitFor(!EventFlag(10002050));
    RestartEvent();
});

$Event(100002556, Restart, function() {
    WaitFor(ElapsedSeconds(1));
    WaitFor(!InArea(10000, 10002960));
    SetEventFlagID(10002051, ON);
});

$Event(100002557, Restart, function() {
    WaitFor(!EventFlag(10001950) && !EventFlag(10001951) && !EventFlag(10002173) && EventFlag(113));
    SetEventFlagID(10001950, ON);
});

$Event(100002560, Restart, function() {
    if ((EventFlag(3003) && !EventFlag(1109031)) || (EventFlag(3005) && !EventFlag(1109032))) {
        WaitFor(EventFlag(10002017));
    } else {
        WaitFor(ElapsedFrames(15));
        WaitFor(EventFlag(102));
    }
L0:
    ShowTutorialPopup(1940, true, true);
});

$Event(100002561, Restart, function() {
    WaitFor(ElapsedFrames(15));
    WaitFor(EventFlag(106));
    ShowTutorialPopup(2070, true, true);
});

$Event(100002570, Restart, function() {
    WaitFor(EventFlag(963) && !PlayerHasItem(ItemType.Goods, 40230) && IsHero(Hero.Ironeye));
    ChangeHeroCharacter(10000, 50230);
    ChangeHeroGarbMenuSelection(Hero.Ironeye, 50230);
    WaitFor(ElapsedFrames(25));
    AwardItemLot(106020);
    SetEventFlagID(6041, ON);
});

$Event(100002571, Restart, function() {
    WaitFor(EventFlag(961) && !PlayerHasItem(ItemType.Antique, 11001) && IsHero(Hero.Wylder));
    WaitFor(ElapsedFrames(25));
    AwardItemLot(101000);
});

$Event(100002580, Restart, function() {
    ClearSpEffect(10000, 9781);
    ClearSpEffect(10000, 9782);
    ClearSpEffect(10000, 9783);
    ClearSpEffect(10000, 9784);
    ClearSpEffect(10000, 9785);
    WaitFor(
        EventFlag(1169090)
            && IsHero(Hero.Revenant)
            && CurrentScenarioSection(ScenarioSection.Revenant));
    flag &= PlayerHasArmorEquipped(ArmorType.Head, 5005000, -1);
    GotoIf(L1, flag);
    flag2 &= PlayerHasArmorEquipped(ArmorType.Head, 5015000, -1);
    GotoIf(L2, flag2);
    flag3 &= PlayerHasArmorEquipped(ArmorType.Head, 5025000, -1);
    GotoIf(L3, flag3);
    flag4 &= PlayerHasArmorEquipped(ArmorType.Head, 5055000, -1);
    GotoIf(L4, flag4);
    flag5 &= PlayerHasArmorEquipped(ArmorType.Head, 5065000, -1);
    if (!flag5) {
L1:
        SetSpEffect(10000, 9781);
        flag &= !EventFlag(1169090);
        WaitFor(!flag);
        RestartEvent();
L2:
        SetSpEffect(10000, 9782);
        flag2 &= !EventFlag(1169090);
        WaitFor(!flag2);
        RestartEvent();
L3:
        SetSpEffect(10000, 9783);
        flag3 &= !EventFlag(1169090);
        WaitFor(!flag3);
        RestartEvent();
L4:
        SetSpEffect(10000, 9784);
        flag4 &= !EventFlag(1169090);
        WaitFor(!flag4);
        RestartEvent();
    }
L5:
    SetSpEffect(10000, 9785);
    flag5 &= !EventFlag(1169090);
    WaitFor(!flag5);
    RestartEvent();
});

$Event(100002581, Restart, function() {
    ClearSpEffect(10001605, 9775);
    WaitFor(EventFlag(1169091) && TalkNPCEnabled(10001605));
    SetSpEffect(10001605, 9775);
    WaitFor(!EventFlag(1169091));
    ClearSpEffect(10001605, 9775);
});

$Event(100002590, Restart, function() {
    flag = EventFlag(10001837);
    UnknownPermanentBuff2003126(115);
});

$Event(100002601, Default, function(eventFlagId, eventFlagId2, permanentBuffParamId, targetTimeSeconds) {
    WaitFor(EventFlag(eventFlagId) && !EventFlag(eventFlagId2));
    WaitFor(ElapsedSeconds(targetTimeSeconds));
    DisplayNetworkconnectedPermanentBuffPopup(permanentBuffParamId);
    SetEventFlagID(eventFlagId2, ON);
});

$Event(100002610, Restart, function(itemId, eventFlagId) {
    WaitFor(PlayerHasItem(ItemType.Goods, itemId) && !EventFlag(eventFlagId));
    SetEventFlagID(eventFlagId, ON);
});

$Event(100002660, Restart, function() {
    WaitFor(EventFlag(10002060));
    SetEventFlagID(9021, ON);
    WaitFor(!EventFlag(9021));
    RestartEvent();
});

$Event(1000002670, Restart, function() {
    WaitFor(EventFlag(113));
    SetEventFlagID(115, ON);
});

$Event(1000002680, Restart, function() {
    WaitFor(InArea(10000, 10003100) && !EventFlag(10001850));
    SetEventFlagID(10001850, ON);
    SetEventFlagID(10001852, ON);
    if (!EventFlag(10001851)) {
        SetEventFlagID(10001851, ON);
    }
});

$Event(100002690, Restart, function() {
    SetCharacterBackreadState(10000680, true);
    DisableAsset(10001340);
    DisableCharacter(10000680);
    WaitFor(SpecialSouls() >= 1 || EventFlag(10001861));
    SetCharacterBackreadState(10000680, false);
    SetEventFlagID(10001861, ON);
    SetEventFlagID(6060, ON);
    EnableAsset(10001340);
    EnableCharacter(10000680);
});

$Event(100002691, Restart, function() {
    WaitFor(SpecialSouls() >= 1 || EventFlag(10001861));
    if ((EventFlag(3003) && !EventFlag(1109031)) || (EventFlag(3005) && !EventFlag(1109032))) {
        WaitFor(EventFlag(10002019));
    } else {
        WaitFor(ElapsedFrames(30));
        WaitFor(EventFlag(102));
    }
L0:
    ShowTutorialPopup(2060, true, true);
});

$Event(1000002700, Restart, function() {
    WaitFor(PlayerHasItem(ItemType.Antique, 10000));
    WaitFor(!EventFlag(10001810));
    SetEventFlagID(10001810, ON);
});

$Event(1000002705, Default, function() {
    WaitFor(EventFlag(6031));
    WaitFor(EventFlag(110));
    SetEventFlagID(6045, ON);
    WaitFor(EventFlag(6050));
    SetEventFlagID(6051, ON);
    WaitFor(EventFlag(160));
    SetEventFlagID(6055, ON);
});

$Event(1000002706, Default, function() {
    WaitFor(EventFlag(6037));
    WaitFor(EventFlag(110));
    SetEventFlagID(6046, ON);
    WaitFor(EventFlag(6050));
    SetEventFlagID(6052, ON);
    WaitFor(EventFlag(160));
    SetEventFlagID(6056, ON);
});

$Event(1000002707, Default, function() {
    EndIf(EventFlag(6048));
    WaitFor(AllBatchEventFlags(150, 156));
    SetEventFlagID(6048, ON);
});

$Event(1000002708, Default, function() {
    WaitFor(EventFlag(6050) && EventFlag(160));
    SetEventFlagID(6057, ON);
});

$Event(100002990, Restart, function() {
    WaitFor(EventFlag(10009000));
    SetEventFlagID(10009000, OFF);
    SetEventFlagID(10009001, OFF);
    SetEventFlagID(10009002, OFF);
    SetEventFlagID(10001910, OFF);
    SetEventFlagID(10001814, OFF);
    SetEventFlagID(10001815, OFF);
    SetEventFlagID(10001816, OFF);
    ShowTutorialPopup(2010, true, true);
    WaitFixedTimeFrames(1);
    RestartEvent();
});

$Event(100002991, Restart, function() {
    WaitFor(EventFlag(10001911));
    SetEventFlagID(10001911, OFF);
    RecordUserDispLog(12201, 10000, LogObjectType.None, -1);
    ShowTutorialPopup(2020, true, true);
    WaitFixedTimeFrames(1);
    RestartEvent();
});

$Event(100002992, Default, function() {
    SetEventFlagID(10009000, OFF);
    SetEventFlagID(10009001, OFF);
    SetEventFlagID(10009002, OFF);
});

$Event(100003400, Default, function(eventFlagId, hero) {
    if ((EventFlag(3003) && !EventFlag(1109031)) || (EventFlag(3005) && !EventFlag(1109032))) {
        WaitFor(EventFlag(10002018));
        WaitFixedTimeFrames(3);
    }
    if (!CurrentScenarioSection(ScenarioSection.None)) {
        WaitFor(EventFlag(eventFlagId));
        WaitFor(CurrentScenarioSection(ScenarioSection.None));
        WaitFor(EventFlag(10009001) || EventFlag(10009002));
    }
    WaitFor(EventFlag(eventFlagId) || !CurrentScenarioSection(ScenarioSection.None));
    RestartIf(!CurrentScenarioSection(ScenarioSection.None));
    chr = IsHero(hero);
    if (!chr) {
        WaitFor(chr);
        WaitFixedTimeSeconds(1);
    }
    if (!AnyBatchEventFlags(10002011, 10002012)) {
        WaitFixedTimeFrames(60);
    }
    EndIf(!EventFlag(eventFlagId));
    RestartIf(!CurrentScenarioSection(ScenarioSection.None));
    RecordUserDispLog(12200, 10000, LogObjectType.None, -1);
    ShowTutorialPopup(2000, true, true);
    SetEventFlagID(eventFlagId, OFF);
    RestartEvent();
});

$Event(100003430, Default, function() {
    if ((EventFlag(3003) && !EventFlag(1109031)) || (EventFlag(3005) && !EventFlag(1109032))) {
        WaitFor(EventFlag(10002018));
        WaitFixedTimeFrames(3);
    }
    if (!CurrentScenarioSection(ScenarioSection.None)) {
        WaitFor(EventFlag(1009460));
        WaitFor(CurrentScenarioSection(ScenarioSection.None));
        WaitFor(EventFlag(10009001) || EventFlag(10009002));
    }
    WaitFor(EventFlag(1009460) || !CurrentScenarioSection(ScenarioSection.None));
    RestartIf(!CurrentScenarioSection(ScenarioSection.None));
    flag = EventFlag(1009460) && EventFlag(1009440) && !EventFlag(1009441);
    flag2 = EventFlag(1009460) && EventFlag(1009442) && !EventFlag(1009443);
    chr = IsHero(Hero.Duchess);
    flagChr = flag || flag2 || chr;
    if (!chr) {
        WaitFor(flagChr);
        WaitFixedTimeSeconds(1);
    }
    if (!AnyBatchEventFlags(10002011, 10002012)) {
        WaitFixedTimeFrames(60);
    }
    EndIf(!EventFlag(1009460));
    RestartIf(!CurrentScenarioSection(ScenarioSection.None));
    RecordUserDispLog(12200, 10000, LogObjectType.None, -1);
    ShowTutorialPopup(2000, true, true);
    SetEventFlagID(1009460, OFF);
    RestartEvent();
});

$Event(100003431, Default, function() {
    if ((EventFlag(3003) && !EventFlag(1109031)) || (EventFlag(3005) && !EventFlag(1109032))) {
        WaitFor(EventFlag(10002018));
        WaitFixedTimeFrames(3);
    }
    if (!CurrentScenarioSection(ScenarioSection.None)) {
        WaitFor(EventFlag(1009660));
        WaitFor(CurrentScenarioSection(ScenarioSection.None));
        WaitFor(EventFlag(10009001) || EventFlag(10009002));
    }
    WaitFor(EventFlag(1009660) || !CurrentScenarioSection(ScenarioSection.None));
    RestartIf(!CurrentScenarioSection(ScenarioSection.None));
    flag = EventFlag(1009660) && EventFlag(1009640) && !EventFlag(1009641);
    chr = IsHero(Hero.Revenant);
    flagChr = flag || chr;
    if (!chr) {
        WaitFor(flagChr);
        WaitFixedTimeSeconds(1);
    }
    if (!AnyBatchEventFlags(10002011, 10002012)) {
        WaitFixedTimeFrames(60);
    }
    EndIf(!EventFlag(1009660));
    RestartIf(!CurrentScenarioSection(ScenarioSection.None));
    RecordUserDispLog(12200, 10000, LogObjectType.None, -1);
    ShowTutorialPopup(2000, true, true);
    SetEventFlagID(1009660, OFF);
    RestartEvent();
});

$Event(100003432, Default, function() {
    if ((EventFlag(3003) && !EventFlag(1109031)) || (EventFlag(3005) && !EventFlag(1109032))) {
        WaitFor(EventFlag(10002018));
        WaitFixedTimeFrames(3);
    }
    if (!CurrentScenarioSection(ScenarioSection.None)) {
        WaitFor(EventFlag(1009140));
        WaitFor(CurrentScenarioSection(ScenarioSection.None));
        WaitFor(EventFlag(10009001) || EventFlag(10009002));
    }
    WaitFor(EventFlag(1009140) || !CurrentScenarioSection(ScenarioSection.None));
    RestartIf(!CurrentScenarioSection(ScenarioSection.None));
    flag = EventFlag(1009140) && EventFlag(1009131) && !EventFlag(1009132);
    chr = IsHero(Hero.Wylder);
    flagChr = flag || chr;
    if (!chr) {
        WaitFor(flagChr);
        WaitFixedTimeSeconds(1);
    }
    if (!AnyBatchEventFlags(10002011, 10002012)) {
        WaitFixedTimeFrames(60);
    }
    EndIf(!EventFlag(1009140));
    RestartIf(!CurrentScenarioSection(ScenarioSection.None));
    RecordUserDispLog(12200, 10000, LogObjectType.None, -1);
    ShowTutorialPopup(2000, true, true);
    SetEventFlagID(1009140, OFF);
    RestartEvent();
});

$Event(100003433, Default, function() {
    if ((EventFlag(3003) && !EventFlag(1109031)) || (EventFlag(3005) && !EventFlag(1109032))) {
        WaitFor(EventFlag(10002018));
        WaitFixedTimeFrames(3);
    }
    if (!CurrentScenarioSection(ScenarioSection.None)) {
        WaitFor(EventFlag(1009260));
        WaitFor(CurrentScenarioSection(ScenarioSection.None));
        WaitFor(EventFlag(10009001) || EventFlag(10009002));
    }
    WaitFor(EventFlag(1009260) || !CurrentScenarioSection(ScenarioSection.None));
    RestartIf(!CurrentScenarioSection(ScenarioSection.None));
    flag = EventFlag(1009260) && EventFlag(1009247) && !EventFlag(1009248);
    chr = IsHero(Hero.Guardian);
    flagChr = flag || chr;
    if (!chr) {
        WaitFor(flagChr);
        WaitFixedTimeSeconds(1);
    }
    if (!AnyBatchEventFlags(10002011, 10002012)) {
        WaitFixedTimeFrames(60);
    }
    EndIf(!EventFlag(1009260));
    RestartIf(!CurrentScenarioSection(ScenarioSection.None));
    RecordUserDispLog(12200, 10000, LogObjectType.None, -1);
    ShowTutorialPopup(2000, true, true);
    SetEventFlagID(1009260, OFF);
    RestartEvent();
});

$Event(100002993, Restart, function() {
    WaitFor(EventFlag(10002040));
    SetEventFlagID(10002040, OFF);
    RecordUserDispLog(12202, 10000, LogObjectType.None, -1);
    ShowTutorialPopup(2030, true, true);
    WaitFixedTimeSeconds(0.5);
    if (EventFlag(10002041)) {
        RecordUserDispLog(12203, 10000, LogObjectType.None, -1);
    }
    SetEventFlagID(10002041, OFF);
    EndEvent();
});

$Event(100002994, Restart, function() {
    ClearSpEffect(10000, 9752);
    WaitFor(
        CurrentScenarioSection(ScenarioSection.Wylder)
            || CurrentScenarioSection(ScenarioSection.Guardian)
            || CurrentScenarioSection(ScenarioSection.Ironeye)
            || CurrentScenarioSection(ScenarioSection.Duchess)
            || CurrentScenarioSection(ScenarioSection.Raider)
            || CurrentScenarioSection(ScenarioSection.Revenant)
            || CurrentScenarioSection(ScenarioSection.Recluse)
            || CurrentScenarioSection(ScenarioSection.Executor));
    SetSpEffect(10000, 9752);
    WaitFor(
        CurrentScenarioSection(ScenarioSection.None)
            || IsRequestGameMode(2)
            || IsRequestGameMode(1)
            || IsRequestGameMode(3));
    RestartEvent();
});

$Event(100004000, Default, function(hero, itemLotId, eventFlagId, eventFlagId2, eventFlagId3) {
    EndIf(EventFlag(eventFlagId2));
    WaitFixedTimeFrames(1);
    if (!EventFlag(eventFlagId)) {
        WaitFor(EventFlag(eventFlagId));
        WaitFixedTimeFrames(3);
        WaitFor(CharacterBackreadStatus(10000));
        Goto(L3);
    }
    WaitFor(CharacterBackreadStatus(10000));
    cond = CurrentScenarioSection(ScenarioSection.None);
    chr = IsHero(hero);
    GotoIf(S0, !cond);
    GotoIf(L1, chr);
    if (chr) {
S0:
        GotoIf(L3, chr);
        if (chr) {
        }
L4:
        flag |= EventFlag(10009001) || EventFlag(10009002);
        WaitFor(flag);
        RestartEvent();
L3:
        flag |= EventFlag(10009001) || EventFlag(10009002);
        WaitFor(flag);
        GotoIf(L1, EventFlag(10009001));
        RestartEvent();
    }
L2:
    WaitFixedTimeSeconds(1);
    RestartIf(!CurrentScenarioSection(ScenarioSection.None));
    flag2 &= EventFlag(3003) && !EventFlag(1109031);
    flag3 |= flag2;
    flag4 &= EventFlag(3005) && !EventFlag(1109032);
    flag3 |= flag4;
    if (flag3) {
        WaitFor(EventFlag(10002018));
    }
    WaitFor(IsRequestGameMode(0));
    if (EventFlag(eventFlagId3)) {
        SetEventFlagID(eventFlagId3, OFF);
    }
    AwardItemLot(itemLotId);
    SetEventFlagID(eventFlagId2, ON);
    SetEventFlagID(10009001, OFF);
    SetEventFlagID(10009002, OFF);
    EndEvent();
L1:
    flag2 &= EventFlag(3003) && !EventFlag(1109031);
    flag3 |= flag2;
    flag4 &= EventFlag(3005) && !EventFlag(1109032);
    flag3 |= flag4;
    if (flag3) {
        WaitFor(EventFlag(10002018));
    }
    WaitFor(IsRequestGameMode(0));
    if (EventFlag(eventFlagId3)) {
        SetEventFlagID(eventFlagId3, OFF);
        DisplayGenericDialogAndSetEventFlags(70100, PromptType.OKCANCEL, NumberofOptions.OneButton, 0, 100, 10002015, 10002015, 10002015);
        WaitFor(EventFlag(10002015));
        SetEventFlagID(10002015, OFF);
    }
    AwardItemLot(itemLotId);
    SetEventFlagID(eventFlagId2, ON);
    SetEventFlagID(10009001, OFF);
    SetEventFlagID(10009002, OFF);
    EndEvent();
});

$Event(100004100, Default, function(hero, itemLotId, eventFlagId, eventFlagId2, eventFlagId3, eventFlagId4) {
    EndIf(EventFlag(eventFlagId2));
    WaitFixedTimeFrames(1);
    if (!EventFlag(eventFlagId)) {
        WaitFor(EventFlag(eventFlagId));
        WaitFixedTimeFrames(3);
        WaitFor(CharacterBackreadStatus(10000));
        Goto(L3);
    }
    WaitFor(CharacterBackreadStatus(10000));
    cond = CurrentScenarioSection(ScenarioSection.None);
    chr = IsHero(hero);
    GotoIf(S0, !cond);
    GotoIf(L1, chr);
    if (chr) {
S0:
        GotoIf(L3, chr);
        if (chr) {
        }
L4:
        flag |= EventFlag(10009001) || EventFlag(10009002);
        WaitFor(flag);
        RestartEvent();
L3:
        flag |= EventFlag(10009001) || EventFlag(10009002);
        WaitFor(flag);
        GotoIf(L1, EventFlag(10009001));
        RestartEvent();
    }
L2:
    WaitFixedTimeSeconds(1);
    RestartIf(!CurrentScenarioSection(ScenarioSection.None));
    flag2 &= EventFlag(3003) && !EventFlag(1109031);
    flag3 |= flag2;
    flag4 &= EventFlag(3005) && !EventFlag(1109032);
    flag3 |= flag4;
    if (flag3) {
        WaitFor(EventFlag(10002018));
    }
    WaitFor(IsRequestGameMode(0));
    EndIf(!EventFlag(eventFlagId4));
    if (EventFlag(eventFlagId3)) {
        SetEventFlagID(eventFlagId3, OFF);
    }
    AwardItemLot(itemLotId);
    SetEventFlagID(eventFlagId2, ON);
    SetEventFlagID(10009001, OFF);
    SetEventFlagID(10009002, OFF);
    EndEvent();
L1:
    flag2 &= EventFlag(3003) && !EventFlag(1109031);
    flag3 |= flag2;
    flag4 &= EventFlag(3005) && !EventFlag(1109032);
    flag3 |= flag4;
    if (flag3) {
        WaitFor(EventFlag(10002018));
    }
    WaitFor(IsRequestGameMode(0));
    EndIf(!EventFlag(eventFlagId4));
    if (EventFlag(eventFlagId3)) {
        SetEventFlagID(eventFlagId3, OFF);
        DisplayGenericDialogAndSetEventFlags(70100, PromptType.OKCANCEL, NumberofOptions.OneButton, 0, 100, 10002015, 10002015, 10002015);
        WaitFor(EventFlag(10002015));
        SetEventFlagID(10002015, OFF);
    }
    AwardItemLot(itemLotId);
    SetEventFlagID(eventFlagId2, ON);
    SetEventFlagID(10009001, OFF);
    SetEventFlagID(10009002, OFF);
    EndEvent();
});

$Event(100004200, Restart, function(section, missionId) {
    if (!EventFlag(10002332)) {
        SetEventFlagID(10002332, ON);
    }
    WaitFor(CurrentScenarioSection(section) && HasMissionState(missionId, 1));
    WaitFixedTimeFrames(1);
    SetEventFlagID(10002332, OFF);
    SetEventFlagID(10002232, ON);
    EndEvent();
});

$Event(100003000, Default, function() {
    if (AnyBatchEventFlags(6090, 6095)) {
        if (EventFlag(6088)) {
            SetEventFlagID(6088, OFF);
        }
        if (EventFlag(6087)) {
            SetEventFlagID(6087, OFF);
            SetEventFlagID(6088, ON);
        }
        if (EventFlag(6086)) {
            SetEventFlagID(6086, OFF);
            SetEventFlagID(6087, ON);
        }
        if (EventFlag(6085)) {
            SetEventFlagID(6085, OFF);
            SetEventFlagID(6086, ON);
        }
    }
L0:
    GotoIf(L2, !AnyBatchEventFlags(140, 143));
    GotoIf(S0, !EventFlag(6070));
    GotoIf(L2, EventFlag(10001900));
    SetEventFlagID(10001900, ON);
    Goto(L1);
S0:
    GotoIf(S1, !EventFlag(6071));
    GotoIf(L2, EventFlag(10001901));
    SetEventFlagID(10001901, ON);
    if (!EventFlag(6020)) {
        ShowTutorialPopup(3420, true, true);
        RecordUserDispLog(12101, 10000, LogObjectType.None, -1);
    }
    Goto(L1);
S1:
    GotoIf(S2, !EventFlag(6072));
    GotoIf(L2, EventFlag(10001902));
    SetEventFlagID(10001902, ON);
    if (!EventFlag(6020)) {
        ShowTutorialPopup(3400, true, true);
        RecordUserDispLog(12102, 10000, LogObjectType.None, -1);
    }
    Goto(L1);
S2:
    GotoIf(S3, !EventFlag(6073));
    GotoIf(L2, EventFlag(10001903));
    SetEventFlagID(10001903, ON);
    if (!EventFlag(6020)) {
        ShowTutorialPopup(3410, true, true);
        RecordUserDispLog(12103, 10000, LogObjectType.None, -1);
    }
    Goto(L1);
S3:
    Goto(L2);
L1:
    BatchSetEventFlags(6085, 6088, OFF);
    SetEventFlagID(6090, OFF);
    SetEventFlagID(6091, OFF);
    SetEventFlagID(6092, OFF);
    SetEventFlagID(6093, OFF);
    SetEventFlagID(6095, OFF);
    SetEventFlagID(6098, OFF);
    SetEventFlagID(6099, OFF);
    if (EventFlag(6020)) {
        SetEventFlagID(10002167, ON);
    }
    Goto(L17);
L2:
    GotoIf(L20, AnyBatchEventFlags(6085, 6088));
    GotoIf(L20, !AnyBatchEventFlags(6090, 6093));
    GotoIf(L19, AnyBatchEventFlags(6070, 6073));
    GotoIf(L3, EventFlag(6098));
    Goto(L20);
L3:
    GotoIf(S4, !EventFlag(6090));
    GotoIf(L20, !EventFlag(140));
    SetEventFlagID(6070, ON);
    Goto(L19);
S4:
    GotoIf(S5, !EventFlag(6091));
    GotoIf(L20, !EventFlag(141));
    SetEventFlagID(6071, ON);
    Goto(L19);
S5:
    GotoIf(S6, !EventFlag(6092));
    GotoIf(L20, !EventFlag(142));
    SetEventFlagID(6072, ON);
    Goto(L19);
S6:
    GotoIf(S7, !EventFlag(6093));
    GotoIf(L20, !EventFlag(143));
    SetEventFlagID(6073, ON);
    Goto(L19);
S7:
    Goto(L20);
L19:
    GotoIf(L20, !AnyBatchEventFlags(6090, 6093));
    if ((EventFlag(6070) && EventFlag(6090))
        || (EventFlag(6071) && EventFlag(6091))
        || (EventFlag(6072) && EventFlag(6092))
        || (EventFlag(6073) && EventFlag(6093))) {
        IncrementNetworkconnectedEventValue(6080, 4, 3);
        GotoIf(S8, !EventFlag(6090));
    }
    if (EventFlag(10002405)) {
        SetEventFlagID(10002165, ON);
    } else {
        ShowTutorialPopup(3430, true, true);
    }
S8:
    Goto(L20);
L20:
    SetEventFlagID(6090, OFF);
    SetEventFlagID(6091, OFF);
    SetEventFlagID(6092, OFF);
    SetEventFlagID(6093, OFF);
    SetEventFlagID(6095, OFF);
    SetEventFlagID(6098, OFF);
    SetEventFlagID(6099, OFF);
    EndIf(!AnyBatchEventFlags(6070, 6073));
    if (EventValue(6080, 4) < 3) {
        GotoIf(L17, EventFlag(3003) && !EventFlag(1109031));
        GotoIf(L17, EventFlag(3005) && !EventFlag(1109032));
        GotoIf(L17, EventFlag(1159086));
        GotoIf(L17, EventFlag(1169070));
        GotoIf(L17, EventFlag(1189058));
        if (EventFlag(6070)) {
            RecordUserDispLog(12100, 10000, LogObjectType.None, -1);
        }
        if (EventFlag(6071)) {
            RecordUserDispLog(12101, 10000, LogObjectType.None, -1);
        }
        if (EventFlag(6072)) {
            RecordUserDispLog(12102, 10000, LogObjectType.None, -1);
        }
        GotoIf(S9, !EventFlag(6073));
        RecordUserDispLog(12103, 10000, LogObjectType.None, -1);
S9:
L17:
        WaitFor(EventFlag(10002160));
        EndEvent();
    }
L18:
    flag = EventFlag(3005) && !EventFlag(1109032);
    if (EventFlag(6070)) {
        SetEventFlagID(6070, OFF);
        if (flag) {
            SetEventFlagID(10002161, ON);
        } else {
            RecordUserDispLog(12110, 10000, LogObjectType.None, -1);
        }
    }
    if (EventFlag(6071)) {
        SetEventFlagID(6071, OFF);
        if (flag) {
            SetEventFlagID(10002162, ON);
        } else {
            RecordUserDispLog(12111, 10000, LogObjectType.None, -1);
        }
    }
    if (EventFlag(6072)) {
        SetEventFlagID(6072, OFF);
        if (flag) {
            SetEventFlagID(10002163, ON);
        } else {
            RecordUserDispLog(12112, 10000, LogObjectType.None, -1);
        }
    }
    if (EventFlag(6073)) {
        SetEventFlagID(6073, OFF);
        if (flag) {
            SetEventFlagID(10002164, ON);
        } else {
            RecordUserDispLog(12113, 10000, LogObjectType.None, -1);
        }
    }
    ClearEventValue(6080, 4);
    SetEventFlagID(6085, ON);
    EndEvent();
});

$Event(100003001, Restart, function() {
    WaitFor(EventFlag(10002170) || EventFlag(10002160) || EventFlag(10002172));
    if (!EventFlag(10002160)) {
        if (!EventFlag(10002172)) {
            if (EventFlag(6070)) {
                RecordUserDispLog(12100, 10000, LogObjectType.None, -1);
            }
            if (EventFlag(6071)) {
                RecordUserDispLog(12101, 10000, LogObjectType.None, -1);
            }
            if (EventFlag(6072)) {
                RecordUserDispLog(12102, 10000, LogObjectType.None, -1);
            }
            if (EventFlag(6073)) {
                RecordUserDispLog(12103, 10000, LogObjectType.None, -1);
            }
            SetEventFlagID(10002170, OFF);
            SetEventFlagID(10002171, ON);
            WaitFor(EventFlag(10002170) || EventFlag(10002172) || EventFlag(10002160));
            RestartIf(EventFlag(10002170));
        }
    }
L10:
    FadeToBlack(1, 1, true, 0);
    WaitFixedTimeSeconds(1);
    IssueShortWarpRequest(10000, TargetEntityType.Area, 10002212, -1);
    SetCameraAngle(11.1, -151.32);
    WaitFixedTimeSeconds(1);
    FadeToBlack(0, 1, false, -1);
    SetEventFlagID(10002172, OFF);
    SetEventFlagID(10002160, OFF);
    if (EventFlag(6070)) {
        SetEventFlagID(6070, OFF);
        RecordUserDispLog(12110, 10000, LogObjectType.None, -1);
    }
    if (EventFlag(6071)) {
        SetEventFlagID(6071, OFF);
        RecordUserDispLog(12111, 10000, LogObjectType.None, -1);
    }
    if (EventFlag(6072)) {
        SetEventFlagID(6072, OFF);
        RecordUserDispLog(12112, 10000, LogObjectType.None, -1);
    }
    if (EventFlag(6073)) {
        SetEventFlagID(6073, OFF);
        RecordUserDispLog(12113, 10000, LogObjectType.None, -1);
    }
    ClearEventValue(6080, 4);
    SetEventFlagID(6085, ON);
    RestartEvent();
});

$Event(100003002, Restart, function() {
    WaitFor(EventFlag(10002166));
    SetEventFlagID(10002166, OFF);
    WaitFixedTimeSeconds(0.5);
    RecordUserDispLog(12203, 10000, LogObjectType.None, -1);
    RestartEvent();
});

$Event(100003003, Restart, function() {
    WaitFor(EventFlag(10002173));
    FadeToBlack(1, 1, true, 0);
    GotoIf(L1, EventFlag(10001950));
    GotoIf(L2, !EventFlag(10001950));
L1:
    SetEventFlagID(10001950, OFF);
    Goto(L0);
L2:
    SetEventFlagID(10001950, ON);
    Goto(L0);
L0:
    WaitFixedTimeSeconds(2);
    FadeToBlack(0, 1, false, -1);
    RecordUserDispLog(12120, 10000, LogObjectType.None, -1);
    SetEventFlagID(10002173, OFF);
    RestartEvent();
});

$Event(100003004, Restart, function() {
    WaitFor(EventFlag(10001900));
    if ((EventFlag(3003) && !EventFlag(1109031))
        || (EventFlag(3005) && !EventFlag(1109032))
        || EventFlag(10002405)) {
        WaitFor(EventFlag(10002168));
    }
    if (!EventFlag(10002168)) {
        WaitFixedTimeFrames(16);
    }
    ShowTutorialPopup(1980, true, true);
    if (EventFlag(10002168)) {
        RecordUserDispLog(12100, 10000, LogObjectType.None, -1);
    }
    EndEvent();
});

$Event(100003100, Restart, function(eventFlagId, section, assetEntityId, chrEntityId) {
    DisableAsset(assetEntityId);
    DisableCharacter(chrEntityId);
    SetEventFlagID(10002335, ON);
    WaitFor(EventFlag(eventFlagId) && CurrentScenarioSection(section));
    WaitFixedTimeFrames(1);
    EnableAsset(assetEntityId);
    EnableCharacter(chrEntityId);
    SetEventFlagID(10002335, OFF);
    EndEvent();
});

$Event(100003200, Restart, function(eventFlagId, section, assetEntityId, chrEntityId) {
    DisableAsset(assetEntityId);
    DisableCharacter(chrEntityId);
    SetEventFlagID(10002334, ON);
    WaitFor(EventFlag(eventFlagId) && CurrentScenarioSection(section));
    WaitFixedTimeFrames(1);
    EnableAsset(assetEntityId);
    EnableCharacter(chrEntityId);
    SetEventFlagID(10002334, OFF);
    EndEvent();
});

$Event(100003300, Restart, function() {
    SetEventFlagID(10002333, ON);
    DisableCharacter(10000771);
    EnableCharacterInvincibility(10000771);
    SetEventFlagID(6013, OFF);
    WaitFor(
        !EventFlag(6037)
            && PlayerHasItem(ItemType.Antique, 10001)
            && CurrentScenarioSection(ScenarioSection.None));
    SetSpEffect(10000771, 9780);
    EnableCharacter(10000771);
    DisableCharacterCollision(10000771);
    SetEventFlagID(10002333, OFF);
    SetEventFlagID(10002233, ON);
    EndEvent();
});

$Event(100003310, Restart, function() {
    SetEventFlagID(10002500, OFF);
    SetEventFlagID(10002500, OFF);
    WaitFor(EventFlag(10002500));
    PlaySE(10000, SoundType.EnvironmentalSound, 101190140);
    FadeToBlack(1, 3, true, 0);
    WaitFixedTimeSeconds(3);
    SetEventFlagID(10002501, ON);
    EndEvent();
});

$Event(100007010, Restart, function() {
    ClearSpEffect(10001110, 9754);
    WaitFor(EventFlag(3103));
    DisableCharacterGravity(10001110);
    SetCharacterMaphit(10001110, false);
    WaitFixedTimeFrames(1);
    ResetCharacterPosition(10001110);
    WaitFor(!EventFlag(1119028));
    SetSpEffect(10001110, 9754);
    SetNetworkUpdateRate(10001110, true, CharacterUpdateFrequency.AtLeastEvery2Frames);
    WaitFor(EventFlag(1119028));
    WaitFor(!EventFlag(10001831));
    ClearSpEffect(10001110, 9754);
    SetNetworkUpdateRate(10001110, false, CharacterUpdateFrequency.NoUpdate);
});

$Event(1000007030, Restart, function() {
    ForceAnimationPlayback(10002500, 200, false, true, false);
    ForceAnimationPlayback(10002500, 210, true, false, false);
    WaitFor(IsHero(Hero.Raider));
    WaitFor(CurrentScenarioSection(ScenarioSection.Raider));
    WaitFor(EventFlag(10002021));
    ForceAnimationPlayback(10002500, 100, false, true, false);
    ForceAnimationPlayback(10002500, 110, true, false, false);
    WaitFor(!EventFlag(10002021) || CurrentScenarioSection(ScenarioSection.None));
    ForceAnimationPlayback(10002500, 200, false, true, false);
    ForceAnimationPlayback(10002500, 210, true, false, false);
    RestartEvent();
});

$Event(1000007031, Restart, function() {
    if (!EventFlag(1159071)) {
        DisableCharacterCollision(10000510);
        DisableCharacterGravity(10000510);
        CreateBulletOwner(10000510);
        DisableCharacterCollision(10000511);
        DisableCharacterGravity(10000511);
        CreateBulletOwner(10000511);
        DisableCharacterCollision(10000512);
        DisableCharacterGravity(10000512);
        CreateBulletOwner(10000512);
        DisableCharacterCollision(10000513);
        DisableCharacterGravity(10000513);
        CreateBulletOwner(10000513);
        WaitFor(EventFlag(10002020));
        DisableCharacterAI(10001500);
        WaitFor(ElapsedSeconds(3));
        ShootBullet(10000510, 10000510, -1, 802001000, 270, 0, 280);
        WaitFor(ElapsedSeconds(0.1));
        ShootBullet(10000511, 10000511, -1, 802001000, 270, 0, 280);
        WaitFor(ElapsedSeconds(0.05));
        ShootBullet(10000512, 10000512, -1, 802001000, 270, 0, 80);
        WaitFor(ElapsedSeconds(0.05));
        ShootBullet(10000513, 10000513, -1, 802001000, 270, 0, 80);
        WaitFor(ElapsedSeconds(0.75));
        ShootBullet(10000511, 10000511, -1, 802001010, 270, 0, 270);
        WaitFor(ElapsedSeconds(0.05));
        ShootBullet(10000512, 10000512, -1, 802001010, 270, 0, 90);
        WaitFor(ElapsedSeconds(0.25));
        ShootBullet(10000511, 10000510, -1, 802001010, 270, 0, 270);
        WaitFor(ElapsedSeconds(0.05));
        ShootBullet(10000512, 10000513, -1, 802001010, 270, 0, 90);
        RotateCharacter(10001500, 10003517, 90200, false);
        RotateCharacter(10001503, 10003513, 20034, false);
        ShootBullet(10000510, 10000510, -1, 802001000, 270, 0, 280);
        WaitFor(ElapsedSeconds(0.1));
        ShootBullet(10000511, 10000511, -1, 802001000, 270, 0, 280);
        WaitFor(ElapsedSeconds(0.05));
        ShootBullet(10000512, 10000512, -1, 802001000, 270, 0, 80);
        WaitFor(ElapsedSeconds(0.05));
        ShootBullet(10000513, 10000513, -1, 802001000, 270, 0, 80);
        WaitFor(ElapsedSeconds(0.75));
        ShootBullet(10000511, 10000511, -1, 802001010, 270, 0, 270);
        WaitFor(ElapsedSeconds(0.05));
        ShootBullet(10000512, 10000512, -1, 802001010, 270, 0, 90);
        WaitFor(ElapsedSeconds(0.05));
        ShootBullet(10000511, 10000510, -1, 802001010, 270, 0, 270);
        WaitFor(ElapsedSeconds(0.05));
        ShootBullet(10000512, 10000513, -1, 802001010, 270, 0, 90);
        WaitFor(ElapsedSeconds(0.5));
        WaitFor(ElapsedSeconds(0.5));
        ShootBullet(10000512, 10000512, -1, 802001020, 270, 0, 90);
        ShootBullet(10000510, 10000510, -1, 802001030, 270, 0, 270);
        WaitFixedTimeSeconds(0.5);
        SetEventFlagID(10003258, OFF);
        RequestCharacterAIReplan(10001500);
        EnableCharacterAI(10001500);
        WaitFixedTimeFrames(1);
        ForceAnimationPlayback(10001500, 90100, true, false, false);
        EndEvent();
    }
L10:
    WaitFor(TalkNPCEnabled(10001500));
    IssueShortWarpRequest(10001500, TargetEntityType.Area, 10003514, -1);
    ForceAnimationPlayback(10001500, 90100, true, false, false);
    if (AnyBatchEventFlags(3502, 3503)) {
        SetEventFlagID(10003257, ON);
        SetEventFlagID(10003258, OFF);
    }
});

$Event(100007200, Restart, function() {
    DisableAsset(10002260);
    DisableAsset(10002261);
    WaitFor(IsHero(Hero.Guardian) && EventFlag(10001881));
    EnableAsset(10002260);
    WaitFor(EventFlag(1129036) || EventFlag(1129037));
    DisableAsset(10002260);
});

$Event(100007201, Restart, function() {
    WaitFixedTimeFrames(3);
    if (!EventFlag(10001881)) {
        WaitFor(EventFlag(3203));
        SetEventFlagID(10001881, ON);
        Goto(L0);
    }
L0:
    WaitFor(EventFlag(1129036) || EventFlag(1129037));
    SetEventFlagID(10001881, OFF);
});

$Event(100007302, Restart, function() {
    WaitFixedTimeFrames(1);
    DisableAsset(10002510);
    DisableAsset(10002511);
    WaitFixedTimeFrames(2);
    GotoIf(L10, 
        CurrentScenarioSection(ScenarioSection.Wylder)
            || CurrentScenarioSection(ScenarioSection.Guardian)
            || CurrentScenarioSection(ScenarioSection.Ironeye)
            || CurrentScenarioSection(ScenarioSection.Duchess)
            || CurrentScenarioSection(ScenarioSection.Revenant)
            || CurrentScenarioSection(ScenarioSection.Recluse)
            || CurrentScenarioSection(ScenarioSection.Executor));
    GotoIf(L11, CurrentScenarioSection(ScenarioSection.None));
    GotoIf(L12, IsHero(Hero.Raider) && CurrentScenarioSection(ScenarioSection.Raider));
L10:
    EndEvent();
L11:
    WaitFor(EventFlag(1159102));
    EnableAsset(10002511);
    EndEvent();
L12:
    if (AnyBatchEventFlags(3521, 3522)) {
        EnableAsset(10002510);
    }
});

$Event(100007400, Restart, function() {
    DisableAsset(10002310);
    WaitFor(IsHero(Hero.Ironeye) && EventFlag(1009314));
    EnableAsset(10002310);
});

$Event(100007700, Restart, function() {
    ClearSpEffect(10000, 9707);
    EndIf(CurrentScenarioSection(ScenarioSection.None));
    WaitFor(!EventFlag(1179131));
    WaitFor(IsHero(Hero.Recluse));
    WaitFor(EventFlag(1179130));
    SetSpEffect(10000, 9707);
    WaitFor(EventFlag(1179131));
    ClearSpEffect(10000, 9707);
});

$Event(100007800, Restart, function() {
    DisableAsset(10002800);
    DisableAsset(10002801);
    WaitFor(PlayerHasItem(ItemType.Antique, 18000));
    EnableAsset(10002800);
    EnableAsset(10002801);
});

$Event(100007810, Restart, function() {
    DisableAsset(10002811);
    WaitFor(ElapsedFrames(5));
    WaitFor(CurrentScenarioSection(ScenarioSection.Executor) && EventFlag(10001890));
    EnableAsset(10002811);
    DisableAsset(10002810);
    WaitFor(
        (IsHero(Hero.Executor) && !EventFlag(10001890))
            || CurrentScenarioSection(ScenarioSection.None));
    DisableAsset(10002811);
    EnableAsset(10002810);
});

$Event(100007811, Restart, function() {
    WaitFixedTimeFrames(3);
    if (!EventFlag(10001890)) {
        WaitFor(EventFlag(3819));
        SetEventFlagID(10001890, ON);
        Goto(L0);
    }
L0:
    WaitFor(EventFlag(1189057));
    SetEventFlagID(10001890, OFF);
});

$Event(100007812, Restart, function() {
    WaitFor(EventFlag(113));
    WaitFor(ElapsedFrames(25));
    WaitFor(
        !EventFlag(10002002)
            && IsHero(Hero.Executor)
            && EventFlag(10001890)
            && CurrentScenarioSection(ScenarioSection.Executor));
    EnableAsset(10002811);
    DisableAsset(10002812);
    EnableAsset(10002813);
    WaitFor(IsHero(Hero.Executor) && !EventFlag(10001890));
    DisableAsset(10002811);
    EnableAsset(10002812);
    DisableAsset(10002813);
});

$Event(100007820, Restart, function() {
    ClearSpEffect(10000, 9722);
    ClearSpEffect(10000, 9723);
    ClearSpEffect(10000, 9724);
    ClearSpEffect(10000, 9725);
    WaitFor(!EventFlag(1189024));
    WaitFor(IsHero(Hero.Executor));
    WaitFor(MissionProgress(801) >= 1);
    SetEventFlagID(1189031, ON);
    SetEventFlagID(10001828, ON);
    WaitFor(MissionProgress(801) >= 2);
    SetSpEffect(10000, 9722);
    WaitFor(MissionProgress(801) >= 3);
    SetSpEffect(10000, 9723);
    WaitFor(MissionProgress(801) >= 4);
    SetSpEffect(10000, 9724);
    WaitFor(MissionProgress(801) >= 5);
    SetSpEffect(10000, 9725);
    WaitFor(EventFlag(1189024));
    ClearSpEffect(10000, 9722);
    ClearSpEffect(10000, 9723);
    ClearSpEffect(10000, 9724);
    ClearSpEffect(10000, 9725);
});

$Event(100009200, Restart, function() {
    DisableNetworkSync();
    EnableAsset(10002000);
    EnableAssetInvunerability(10002002);
    DisableAsset(10002002);
    if (!EventFlag(2001)) {
        EndIf(EventFlag(1109030));
        WaitFor(!EventFlag(1109030) && EventFlag(3000));
        WaitFor(CharacterBackreadStatus(10000));
        SetSpEffect(10000, 9820);
        SuppressSE(SoundType.BGM, 0, true);
        SetEventFlagID(10002060, ON);
        DisableCharacterFadeOnEnable(10000);
        DisableCharacterFadeOnEnable(10001000);
        DisableAsset(10002000);
        EnableAsset(10002002);
        IssueShortWarpRequest(10000, TargetEntityType.Area, 10003000, -1);
        SetCameraAngle(-14.56, -60.16);
        ForceAnimationPlayback(10000, 66200, true, true, false);
        SetEventFlagID(10003045, ON);
        SetEventFlagID(10003008, ON);
        WaitFixedTimeFrames(1);
        //PlayCutsceneToPlayer(10000020, CutscenePlayMode.Skippable, 10000);
        //PlayCutsceneToAll(10000010, CutscenePlayMode.SkippableWithFadeOutSkip);
        //WaitFixedTimeFrames(1);
        //WaitFor(CutsceneEnded());
        ForceAnimationPlayback(10000, 90101, true, true, false);
        ForceAnimationPlayback(10001000, 90100, true, true, false);
        FadeToBlack(0, 0, true, -1);
        SetEventFlagID(10003000, ON);
        WaitFor(EventFlag(10003001));
        FadeToBlack(0, 0, false, -1);
        SetEventFlagID(10003045, ON);
        SetEventFlagID(10003008, ON);
        ForceAnimationPlayback(10000, 90200, false, true, false);
        ClearSpEffect(10000, 9820);
        SuppressSE(SoundType.BGM, 0, false);
        SetEventFlagID(10002060, OFF);
        SetEventFlagID(9021, OFF);
        SetEventFlagID(1109030, ON);
        SetEventFlagID(10002010, ON);
        WaitFor(ElapsedSeconds(2) || CharacterHasSpEffect(10000, 9765));
        ShowTutorialPopup(1900, true, true);
        SetEventFlagID(6014, ON);
        WaitFixedTimeFrames(1);
    }
L1:
    SetEventFlagID(10003045, OFF);
    SetEventFlagID(10003008, OFF);
    WaitFixedTimeFrames(1);
    EndEvent();
});

$Event(100009201, Restart, function() {
    DisableNetworkSync();
    if (!EventFlag(2001)) {
        EndIf(EventFlag(1109031));
        WaitFor(EventFlag(110));
        SetEventFlagID(10002001, ON);
        if (!IsHero(Hero.Duchess)) {
            SetEventFlagID(10003007, ON);
            FadeToBlack(0, 0, true, -1);
            DisableCharacterFadeOnEnable(10000);
            DisableCharacterFadeOnEnable(10001002);
            PlayCutsceneToPlayerAndWarp(10000050, CutscenePlayMode.SkippableWithFadeOutSkip, 10003001, 10000000, 10000, 0, false, true);
            WaitFixedTimeFrames(1);
            SetCameraAngle(-6.07, 5.77);
            SuppressSE(SoundType.BGM, 0, false);
            WaitFixedTimeSeconds(0.5);
            SetEventFlagID(10003002, ON);
            FadeToBlack(0, 0, false, -1);
        } else {
L0:
            PlayCutsceneToPlayer(10000050, CutscenePlayMode.SkippableWithFadeOutSkip, 10000);
            WaitFixedTimeFrames(1);
            SetEventFlagID(10002001, OFF);
            SuppressSE(SoundType.BGM, 0, false);
            Goto(L20);
        }
L20:
        SetEventFlagID(1109031, ON);
        SetEventFlagID(10002011, ON);
        if (!IsHero(Hero.Duchess)) {
            WaitFor(EventFlag(10003003));
        }
        WaitFixedTimeSeconds(0.5);
        SetEventFlagID(10002014, ON);
        WaitFixedTimeFrames(3);
        SetEventFlagID(10002017, ON);
        WaitFixedTimeFrames(3);
        SetEventFlagID(10002168, ON);
        WaitFixedTimeFrames(3);
        SetEventFlagID(10002019, ON);
        WaitFixedTimeFrames(1);
        SetEventFlagID(10002018, ON);
    }
L1:
    WaitFixedTimeFrames(1);
    RestartEvent();
});

$Event(100009202, Restart, function() {
    DisableNetworkSync();
    EndIf(EventFlag(1109032));
    WaitFor(EventFlag(113));
    SetEventFlagID(10002001, ON);
    if (!IsHero(Hero.Duchess)) {
        SetEventFlagID(10003007, ON);
        SetEventFlagID(10002002, ON);
        FadeToBlack(0, 0, true, -1);
        DisableCharacterFadeOnEnable(10000);
        DisableCharacterFadeOnEnable(10001003);
        ActivateGparamOverride(5, 0);
        EnableAsset(10006891);
        DisableAsset(10006890);
        ChangeWeather(Weather.Type01, -1, true);
        SetEventFlagID(10001950, ON);
        PlayCutsceneToPlayerAndWarp(10000060, CutscenePlayMode.SkippableWithFadeOutSkip, 10003002, 10000000, 10000, 0, false, true);
        WaitFixedTimeFrames(1);
        SetCameraAngle(-3.18, 6.14);
        SuppressSE(SoundType.BGM, 0, false);
        WaitFixedTimeSeconds(0.5);
        SetEventFlagID(10003004, ON);
        FadeToBlack(0, 0, false, -1);
    } else {
L0:
        SetEventFlagID(10001950, ON);
        ActivateGparamOverride(5, 0);
        EnableAsset(10006891);
        DisableAsset(10006890);
        ChangeWeather(Weather.Type01, -1, true);
        PlayCutsceneToPlayer(10000060, CutscenePlayMode.SkippableWithFadeOutSkip, 10000);
        WaitFixedTimeFrames(1);
        SetEventFlagID(10002001, OFF);
        SuppressSE(SoundType.BGM, 0, false);
        Goto(L20);
    }
L20:
    SetEventFlagID(1109032, ON);
    SetEventFlagID(10002012, ON);
    if (!IsHero(Hero.Duchess)) {
        WaitFor(EventFlag(10003005));
    }
    if (EventFlag(6070)) {
        RecordUserDispLog(12100, 10000, LogObjectType.None, -1);
    }
    if (EventFlag(6071)) {
        RecordUserDispLog(12101, 10000, LogObjectType.None, -1);
    }
    if (EventFlag(6072)) {
        RecordUserDispLog(12102, 10000, LogObjectType.None, -1);
    }
    if (EventFlag(6073)) {
        RecordUserDispLog(12103, 10000, LogObjectType.None, -1);
    }
    if (EventFlag(10002161)) {
        SetEventFlagID(10002161, OFF);
        RecordUserDispLog(12110, 10000, LogObjectType.None, -1);
    }
    if (EventFlag(10002162)) {
        SetEventFlagID(10002162, OFF);
        RecordUserDispLog(12111, 10000, LogObjectType.None, -1);
    }
    if (EventFlag(10002163)) {
        SetEventFlagID(10002163, OFF);
        RecordUserDispLog(12112, 10000, LogObjectType.None, -1);
    }
    if (EventFlag(10002164)) {
        SetEventFlagID(10002164, OFF);
        RecordUserDispLog(12113, 10000, LogObjectType.None, -1);
    }
    SetEventFlagID(10002014, ON);
    WaitFixedTimeFrames(3);
    SetEventFlagID(10002019, ON);
    WaitFixedTimeFrames(1);
    SetEventFlagID(10002018, ON);
    WaitFixedTimeFrames(1);
    RestartEvent();
});

$Event(1000009203, Restart, function() {
    SetEventFlagID(72110, OFF);
    EndIf(EventFlag(6031));
    WaitFor(EventFlag(10003040) && IsRequestGameMode(0));
    FadeToBlack(0, 0, true, -1);
    WaitFixedTimeFrames(1);
    FadeToBlack(1, 1, true, -1);
    WaitFixedTimeSeconds(1);
    ChangeHeroCharacter(10000711, 50300);
    ChangeHeroCharacter(10001002, 50300);
    ChangeHeroCharacter(10001003, 50300);
    ChangeHeroCharacter(10001001, 50300);
    ClearSpEffect(10000711, 9832);
    ClearSpEffect(10001002, 9832);
    ClearSpEffect(10001003, 9832);
    ClearSpEffect(10001001, 9832);
    SetSpEffect(10000711, 9823);
    SetSpEffect(10001002, 9823);
    SetSpEffect(10001003, 9823);
    SetSpEffect(10001001, 9823);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000711, 90100, false, false, false);
    ForceAnimationPlayback(10001002, 90100, false, false, false);
    ForceAnimationPlayback(10001003, 90100, false, false, false);
    ForceAnimationPlayback(10001001, 90100, false, false, false);
    IssueShortWarpRequest(10000711, TargetEntityType.Area, 10003003, -1);
    IssueShortWarpRequest(10001002, TargetEntityType.Area, 10003003, -1);
    IssueShortWarpRequest(10001003, TargetEntityType.Area, 10003003, -1);
    IssueShortWarpRequest(10001001, TargetEntityType.Area, 10003003, -1);
    IssueShortWarpRequest(10000, TargetEntityType.Area, 10003004, -1);
    SetCharacterName(10000711, 100010);
    SetCharacterName(10001002, 100010);
    SetCharacterName(10001003, 100010);
    SetCharacterName(10001001, 100010);
    PlayCutsceneToPlayerAndWarp(10000030, CutscenePlayMode.SkippableWithFadeOutSkip, 10003004, 10000000, 10000, 0, false, true);
    FadeToBlack(0, 0, false, -1);
    if (!EventFlag(72110)) {
        WaitFixedTimeFrames(1);
        if (!EventFlag(72110)) {
            SetCameraAngle(23.37, -98.03);
            FadeToBlack(1, 0, true, 0);
            WaitFixedTimeFrames(15);
            FadeToBlack(0, 1, false, 1);
            WaitFixedTimeSeconds(1);
            SetEventFlagID(10003040, OFF);
            SuppressSE(SoundType.BGM, 0, false);
            SetEventFlagID(10002013, ON);
            SetEventFlagID(10002254, OFF);
            SetEventFlagID(1109005, ON);
            SetEventFlagID(6031, ON);
            SaveRequest();
            PlaySE(10000, SoundType.MenuSE, 1100);
            ShowTutorialPopup(1960, true, true);
            EndEvent();
        }
    }
L0:
    SuppressSE(SoundType.BGM, 0, false);
});

$Event(1000009204, Restart, function() {
    WaitFor(EventFlag(10002000));
    FadeToBlack(0, 0, true, -1);
    WaitFixedTimeFrames(1);
    FadeToBlack(1, 1, true, -1);
    PlaySE(10000, SoundType.CutsceneSE, 100000299);
    WaitFixedTimeSeconds(1);
    PlayCutsceneToPlayer(10000020, CutscenePlayMode.SkippableWithFadeOutSkip, 10000);
    FadeToBlack(0, 1, false, -1);
    EndIf(EventFlag(72110));
    WaitFixedTimeFrames(1);
    SuppressSE(SoundType.BGM, 0, false);
    EndIf(EventFlag(72110));
    WaitFixedTimeSeconds(0.5);
    SetEventFlagID(10002000, OFF);
    WaitFor(ElapsedFrames(5));
    RestartEvent();
});

$Event(100009204, Restart, function() {
    EndIf(EventFlag(111));
    WaitFor(EventFlag(110));
    EndIf(!AnyBatchEventFlags(6090, 6095));
    if (!EventFlag(1109041)) {
        SetEventFlagID(1109041, ON);
        EndEvent();
    }
    if (!EventFlag(1109042)) {
        SetEventFlagID(1109042, ON);
        EndEvent();
    }
    if (!EventFlag(1109043)) {
        SetEventFlagID(1109043, ON);
        EndEvent();
    }
    if (!EventFlag(1109044)) {
        SetEventFlagID(1109044, ON);
        EndEvent();
    }
    if (!EventFlag(1109045)) {
        SetEventFlagID(1109045, ON);
        EndEvent();
    }
    if (!EventFlag(1109046)) {
        SetEventFlagID(1109046, ON);
        EndEvent();
    }
    if (!EventFlag(1109047)) {
        SetEventFlagID(1109047, ON);
        EndEvent();
    }
    EndEvent();
});

$Event(100009191, Restart, function() {
    DisableNetworkSync();
    WaitFixedTimeFrames(1);
    EndIf(EventFlag(1119040));
    WaitFor(EventFlag(10003051));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    SetSpEffect(10000, 9820);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000, 90206, false, true, false);
    ClearSpEffect(10000, 9820);
    WaitFixedTimeFrames(1);
    WaitFor(CharacterHasSpEffect(10000, 9920) || CharacterHasSpEffect(10000, 9921));
    WaitFixedTimeSeconds(1.5);
    SetEventFlagID(10003052, ON);
    FadeToBlack(0, 0, false, -1);
    UnknownTalk2003120(0);
    EndEvent();
});

$Event(100009192, Restart, function() {
    DisableNetworkSync();
    WaitFixedTimeFrames(1);
    EndIf(EventFlag(1119042));
    WaitFor(EventFlag(10003058));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    SetSpEffect(10000, 9820);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000, 90201, false, true, false);
    ClearSpEffect(10000, 9820);
    WaitFixedTimeFrames(1);
    WaitFor(CharacterHasSpEffect(10000, 9920) || CharacterHasSpEffect(10000, 9921));
    WaitFixedTimeSeconds(1.5);
    SetEventFlagID(10003059, ON);
    FadeToBlack(0, 0, false, -1);
    UnknownTalk2003120(0);
    EndEvent();
});

$Event(100009190, Restart, function() {
    EndIf(EventFlag(1119004));
    WaitFor(EventFlag(10003057));
    FadeToBlack(0, 0, true, -1);
    WaitFixedTimeFrames(1);
    WaitFor(EventFlag(10003055));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    WaitFixedTimeFrames(1);
    FadeToBlack(1, 1, true, -1);
    WaitFixedTimeSeconds(1);
    ForceAnimationPlayback(10001106, 90203, false, false, false);
    SetSpEffect(10000, 9820);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000, 90101, true, false, false);
    WaitFixedTimeSeconds(2);
    IssueShortWarpRequest(10001106, TargetEntityType.Area, 10003101, -1);
    IssueShortWarpRequest(10000, TargetEntityType.Area, 10003102, -1);
    FadeToBlack(0, 1, true, -1);
    SetCameraAngle(14.91, -97.58);
    WaitFixedTimeSeconds(4);
    ForceAnimationPlayback(10000, 90200, false, false, false);
    ClearSpEffect(10000, 9820);
    SetEventFlagID(10003056, ON);
    WaitFor(EventFlag(1119003));
    UnknownTalk2003120(0);
    FadeToBlack(0, 0, false, -1);
    EndEvent();
});

$Event(100009193, Restart, function() {
    WaitFixedTimeFrames(3);
    EndIf(!EventFlag(1119001));
    if (IsHero(Hero.Wylder)) {
        ForceAnimationPlayback(10001105, 90101, true, false, false);
    }
});

$Event(100009194, Restart, function() {
    WaitFixedTimeFrames(3);
    EndIf(!IsHero(Hero.Wylder));
    EnableCharacterImmortality(10001120);
    DisableCharacterCollision(10001120);
    DisableCharacterGravity(10001120);
    ResetCharacterPosition(10001120);
    EnableCharacterImmortality(10001121);
    DisableCharacterCollision(10001121);
    DisableCharacterGravity(10001121);
    ResetCharacterPosition(10001121);
    EnableCharacterImmortality(10001122);
    DisableCharacterCollision(10001122);
    DisableCharacterGravity(10001122);
    ResetCharacterPosition(10001122);
    EnableCharacterImmortality(10001123);
    DisableCharacterCollision(10001123);
    DisableCharacterGravity(10001123);
    ResetCharacterPosition(10001123);
});

$Event(100009196, Restart, function() {
    WaitFixedTimeFrames(3);
    DisableAsset(10002101);
    WaitFor(CurrentScenarioSection(ScenarioSection.Wylder) && AnyBatchEventFlags(3122, 3123));
    EnableAsset(10002101);
    WaitFixedTimeFrames(1);
    WaitFor(EventFlag(1119080) && EventFlag(1119082));
    WaitFor(ActionButtonInArea(6945, 10002101));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    ForceAnimationPlayback(10002100, 1, false, false, false);
    WaitFixedTimeSeconds(2);
    ForceAnimationPlayback(10000, 60071, false, false, false);
    WaitFixedTimeSeconds(1);
    SetEventFlagID(1119081, ON);
    FadeToBlack(0, 0, false, -1);
    UnknownTalk2003120(0);
});

$Event(100009197, Restart, function() {
    WaitFixedTimeFrames(3);
    EnableCharacterImmortality(10001020);
    DisableCharacterCollision(10001020);
    DisableCharacterGravity(10001020);
    ResetCharacterPosition(10001020);
});

$Event(100009198, Restart, function() {
    WaitFixedTimeFrames(3);
    EnableCharacterImmortality(10000685);
    DisableCharacterCollision(10000685);
    DisableCharacterGravity(10000685);
    ResetCharacterPosition(10000685);
});

$Event(100009199, Restart, function() {
    WaitFixedTimeFrames(3);
    EndIf(EventFlag(1109020));
    WaitFor(InArea(10000, 10003100));
    SetEventFlagID(1109020, ON);
});

$Event(100009210, Restart, function() {
    WaitFixedTimeFrames(3);
    ClearSpEffect(10001133, 9753);
    WaitFor(CurrentScenarioSection(ScenarioSection.Wylder) && AnyBatchEventFlags(3122, 3123));
    SetSpEffect(10001133, 9753);
    SetNetworkUpdateRate(10001133, true, CharacterUpdateFrequency.AtLeastEvery2Frames);
    WaitFor(EventFlag(1119081));
    ClearSpEffect(10001133, 9753);
    SetNetworkUpdateRate(10001133, false, CharacterUpdateFrequency.NoUpdate);
});

$Event(100009211, Restart, function() {
    WaitFixedTimeFrames(3);
    EndIf(EventFlag(1119073));
    WaitFor(CurrentScenarioSection(ScenarioSection.Wylder) && EventFlag(1119073));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    SetEventFlagID(10001851, ON);
    WaitFixedTimeSeconds(1);
    PlaySE(10002021, SoundType.EnvironmentalSound, 101190100);
    WaitFixedTimeSeconds(9);
    DisplayGenericDialogAndSetEventFlags(70040, PromptType.YESNO, NumberofOptions.NoButtons, 0, 5, 10003060, 10003060, 10003060);
    WaitFor(EventFlag(10003060));
    FadeToBlack(0, 0, false, -1);
    UnknownTalk2003120(0);
});

$Event(100009212, Restart, function(assetEntityId, eventFlagId, itemLotId) {
    WaitFixedTimeFrames(3);
    DeleteAssetfollowingSFX(assetEntityId, true);
    WaitFixedTimeFrames(1);
    WaitFor(
        (IsHero(Hero.Wylder)
            && CurrentScenarioSection(ScenarioSection.Wylder)
            && AnyBatchEventFlags(3103, 3107))
            || (IsHero(Hero.Wylder)
                && CurrentScenarioSection(ScenarioSection.None)
                && EventFlag(1119026)));
    EndIf(EventFlag(eventFlagId));
    CreateAssetfollowingSFX(assetEntityId, 90, 6100);
    WaitFor(ActionButtonInArea(6946, assetEntityId));
    DeleteAssetfollowingSFX(assetEntityId, true);
    AwardItemLot(itemLotId);
    EzstateInstructionRequest(10000, 60070, 0);
    SetEventFlagID(eventFlagId, ON);
    RestartEvent();
});

$Event(100009214, Restart, function() {
    WaitFixedTimeFrames(3);
    SetEventFlagID(10003061, ON);
    DisableCharacterGravity(10001128);
    DisableCharacterGravity(10001129);
    DisableCharacterGravity(10001136);
    SetCharacterMaphit(10001128, false);
    SetCharacterMaphit(10001129, false);
    SetCharacterMaphit(10001136, false);
    ClearSpEffect(10001128, 9755);
    ClearSpEffect(10001129, 9755);
    ClearSpEffect(10001136, 9755);
    WaitFor(
        CurrentScenarioSection(ScenarioSection.None)
            || CurrentScenarioSection(ScenarioSection.Wylder));
    SetEventFlagID(10003061, OFF);
    ResetCharacterPosition(10001128);
    ResetCharacterPosition(10001129);
    ResetCharacterPosition(10001136);
    WaitFixedTimeFrames(1);
    SetSpEffect(10001128, 9755);
    SetSpEffect(10001129, 9755);
    SetSpEffect(10001136, 9755);
    SetNetworkUpdateRate(10001128, true, CharacterUpdateFrequency.AtLeastEvery2Frames);
    SetNetworkUpdateRate(10001129, true, CharacterUpdateFrequency.AtLeastEvery2Frames);
    SetNetworkUpdateRate(10001136, true, CharacterUpdateFrequency.AtLeastEvery2Frames);
    EndEvent();
});

$Event(100009216, Restart, function(assetEntityId) {
    WaitFixedTimeFrames(3);
    DeleteAssetfollowingSFX(assetEntityId, true);
    WaitFor(
        CurrentScenarioSection(ScenarioSection.Wylder) && EventFlag(3121) && !EventFlag(1119073));
    CreateAssetfollowingSFX(assetEntityId, 90, 810045);
    WaitFor(EventFlag(1119073));
    DeleteAssetfollowingSFX(assetEntityId, true);
});

$Event(100009217, Restart, function() {
    WaitFixedTimeFrames(3);
    DisableAssetInvunerability(10002031);
    EndIf(EventFlag(1119054));
    EndIf(
        !((IsHero(Hero.Wylder)
            && CurrentScenarioSection(ScenarioSection.Wylder)
            && AnyBatchEventFlags(3102, 3103))
            || (IsHero(Hero.Wylder)
                && CurrentScenarioSection(ScenarioSection.None)
                && EventFlag(1119026))));
    EnableAssetInvunerability(10002031);
    WaitFor(EventFlag(1119054));
    DisableAssetInvunerability(10002031);
});

$Event(100009250, Restart, function() {
    EndIf(EventFlag(1129003));
    WaitFor(EventFlag(10003100));
    WaitFixedTimeFrames(1);
    WaitFor(ActionButtonInArea(6116, 10002237));
    WaitFixedTimeFrames(1);
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    SetSpEffect(10000, 9821);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000, 90201, true, false, false);
    IssueShortWarpRequest(10000, TargetEntityType.Area, 10003215, -1);
    WaitFixedTimeSeconds(3);
    SetEventFlagID(10003100, OFF);
    SetEventFlagID(10003118, ON);
    WaitFor(EventFlag(10003101));
    FadeToBlack(0, 0, true, -1);
    WaitFixedTimeFrames(1);
    FadeToBlack(1, 1, true, -1);
    WaitFixedTimeSeconds(3);
    DisableAsset(10002260);
    EnableAsset(10002261);
    FadeToBlack(0, 1, true, -1);
    SetEventFlagID(10003101, OFF);
    WaitFor(EventFlag(10003102));
    ForceAnimationPlayback(10000, 90212, true, false, false);
    WaitFixedTimeFrames(1);
    WaitFor(CharacterHasSpEffect(10000, 9937));
    FadeToBlack(1, 1, true, -1);
    PlaySE(10003406, SoundType.EnvironmentalSound, 101190010);
    WaitFixedTimeSeconds(1);
    SetEventFlagID(10003102, OFF);
    WaitFor(EventFlag(10003103));
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000, 90202, false, false, false);
    WaitFixedTimeFrames(1);
    ClearSpEffect(10000, 9821);
    WaitFixedTimeSeconds(3);
    FadeToBlack(0, 0, true, -1);
    WaitFor(CharacterHasSpEffect(10000, 9930));
    PlaySE(10003406, SoundType.EnvironmentalSound, 101190011);
    SetEventFlagID(10003103, OFF);
    WaitFor(EventFlag(1129003));
    FadeToBlack(0, 0, false, -1);
    UnknownTalk2003120(0);
    EndEvent();
});

$Event(100009251, Restart, function() {
    WaitFixedTimeFrames(3);
    EnableAsset(10002023);
    DisableAsset(10002235);
    EndIf(EventFlag(1129066));
    WaitFor(EventFlag(3217));
    WaitFixedTimeFrames(1);
    EnableAssetInvunerability(10002235);
    WaitFor(
        TalkNPCEnabled(10001204)
            && TalkNPCEnabled(10001207)
            && (InArea(10000, 10003200) || InArea(10000, 10003220)));
    SetEventFlagID(10003119, ON);
    WaitFor(!EventFlag(10003119));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    SetSpEffect(10000, 9821);
    WaitFixedTimeFrames(20);
    ForceAnimationPlayback(10000, 90203, false, false, false);
    SetEventFlagID(10003122, ON);
    WaitFor(CharacterHasSpEffect(10000, 9931));
    FadeToBlack(1, 1, true, -1);
    PlaySE(10000, SoundType.EnvironmentalSound, 999990020);
    WaitFixedTimeSeconds(1);
    SetEventFlagID(10003104, ON);
    EnableAssetInvunerability(10002235);
    SetEventFlagID(10003115, ON);
    WaitFor(!EventFlag(10003104));
    SuppressSE(SoundType.BGM, 0, true);
    WarpCharacterAndSetFloor(10000, TargetEntityType.Area, 10003201, -1, 0, false);
    WarpCharacterAndSetFloor(10001204, TargetEntityType.Area, 10003203, -1, 0, false);
    WarpCharacterAndSetFloor(10001207, TargetEntityType.Area, 10003202, -1, 0, false);
    WarpCharacterAndSetFloor(10001201, TargetEntityType.Area, 10003204, -1, 0, false);
    RequestAssetRestoration(10002235);
    EnableAsset(10002235);
    WaitFixedTimeFrames(5);
    ForceAnimationPlayback(10001201, 90108, true, false, false);
    IssueShortWarpRequest(10001201, TargetEntityType.Area, 10003204, -1);
    ForceAnimationPlayback(10001204, 90101, true, false, false);
    WaitFixedTimeSeconds(4);
    ForceAnimationPlayback(10000, 90102, true, false, false);
    DisableAsset(10002023);
    WaitFixedTimeSeconds(1);
    SetCameraAngle(25.27, -142.63);
    FadeToBlack(0, 3, true, -1);
    PlaySE(10000, SoundType.EnvironmentalSound, 999990025);
    WaitFixedTimeSeconds(1);
    SuppressSE(SoundType.BGM, 0, false);
    WaitFixedTimeSeconds(3);
    ForceAnimationPlayback(10000, 90204, true, false, false);
    WaitFor(CharacterHasSpEffect(10000, 9932));
    SetEventFlagID(10003105, ON);
    ForceAnimationPlayback(10001204, 90202, true, false, false);
    WaitFor(EventFlag(10003106));
    ForceAnimationPlayback(10000, 90205, true, false, false);
    WaitFixedTimeFrames(1);
    WaitFor(CharacterHasSpEffect(10000, 9933));
    SetEventFlagID(10003106, OFF);
    WaitFor(EventFlag(1129066));
    ForceAnimationPlayback(10000, 90206, true, false, false);
    ClearSpEffect(10000, 9821);
    SetEventFlagID(1209240, OFF);
    WaitFor(CharacterHasSpEffect(10000, 9934));
    WaitFixedTimeSeconds(1);
    FadeToBlack(0, 0, false, -1);
    SetEventFlagID(10003115, OFF);
    UnknownTalk2003120(0);
    WaitFixedTimeSeconds(0.5);
    SetEventFlagID(10003122, OFF);
    EndEvent();
});

$Event(100009252, Restart, function() {
    WaitFixedTimeFrames(3);
    WaitFor(TalkNPCEnabled(10001213));
    DisableCharacter(10001209);
    WaitFixedTimeFrames(1);
    DisableCharacter(10001213);
    EnableCharacter(10001209);
    WarpCharacterAndSetFloor(10001213, TargetEntityType.Area, 10003205, -1, 0, false);
});

$Event(100009253, Restart, function() {
    WaitFixedTimeFrames(3);
    EndIf(EventFlag(1129036));
    EndIf(EventFlag(1129037));
    WaitFor(EventFlag(10003124));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    WaitFor(EventFlag(10003112));
    UnknownTalk2003120(9999);
    FadeToBlack(1, 1, true, -1);
    WaitFixedTimeSeconds(1);
    IssueShortWarpRequest(10000, TargetEntityType.Area, 10003207, -1);
    IssueShortWarpRequest(10001209, TargetEntityType.Area, 10003218, -1);
    SetSpEffect(10000, 9821);
    UnknownHero200490();
    WaitFixedTimeFrames(20);
    ForceAnimationPlayback(10000, 90104, true, false, false);
    ForceAnimationPlayback(10001209, 90210, true, false, false);
    SetCameraAngle(16, -175.13);
    ChangeCamera(1000000);
    FadeToBlack(0, 1, true, -1);
    WaitFixedTimeSeconds(1);
    SetEventFlagID(10003112, OFF);
    WaitFor(EventFlag(10003110) || EventFlag(10003114));
    GotoIf(L1, EventFlag(10003110));
    Goto(L2);
L1:
    UnknownTalk2003120(9999);
    ForceAnimationPlayback(10000, 90208, true, false, false);
    SetEventFlagID(10003115, ON);
    WaitFixedTimeFrames(1);
    WaitFor(CharacterHasSpEffect(10000, 9935));
    FadeToBlack(1, 0, true, -1);
    WaitFixedTimeSeconds(1);
    DeleteAssetfollowingSFX(10002238, true);
    WaitFixedTimeSeconds(1);
    FadeToBlack(0, 1, true, -1);
    WaitFixedTimeSeconds(0.1);
    CreateAssetfollowingSFX(10002238, 90, 807354);
    WaitFixedTimeSeconds(1.2);
    DeleteAssetfollowingSFX(10002238, true);
    WaitFixedTimeSeconds(1.7);
    ForceAnimationPlayback(10001209, 90211, true, false, false);
    WaitFor(CharacterHasSpEffect(10001209, 9938));
    SetEventFlagID(10003110, OFF);
    WaitFixedTimeSeconds(3.5);
    ForceAnimationPlayback(10000, 90215, true, false, false);
    Goto(L20);
L2:
    UnknownTalk2003120(9999);
    ForceAnimationPlayback(10000, 90209, false, true, false);
    SetEventFlagID(10003115, ON);
    WaitFixedTimeFrames(1);
    WaitFor(CharacterHasSpEffect(10000, 9935));
    WaitFixedTimeSeconds(2);
    ForceAnimationPlayback(10001209, 90211, true, false, false);
    WaitFor(CharacterHasSpEffect(10001209, 9938));
    SetEventFlagID(10003114, OFF);
    Goto(L20);
L20:
    WaitFixedTimeFrames(1);
    WaitFor(EventFlag(1129036) || EventFlag(1129037));
    UnknownSound201014(2);
    WaitFor(CharacterHasSpEffect(10000, 9615));
    ForceAnimationPlayback(10000, 90216, false, true, false);
    ClearSpEffect(10000, 9821);
    WaitFixedTimeSeconds(1);
    FadeToBlack(0, 0, false, -1);
    UnknownTalk2003120(0);
    SetEventFlagID(10003115, OFF);
    ChangeCamera(-1);
});

$Event(100009254, Restart, function() {
    WaitFixedTimeFrames(3);
    SetEventFlagID(10003112, OFF);
    EndIf(EventFlag(1129080));
    WaitFor(TalkNPCEnabled(10001211));
    WaitFixedTimeFrames(1);
    WaitFor(EventFlag(10003108));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    if (!EntityInRadiusOfEntity(10000, 10002236, 0.4, 1)) {
        RotateCharacter(10000, 10002236, -1, true);
        RotateCharacter(10000, 10002236, 90006, false);
        Goto(L8);
L8:
        WaitFixedTimeFrames(1);
        time = ElapsedSeconds(2);
        area = EntityInRadiusOfEntity(10000, 10002236, 0.4, 1);
        WaitFor(time || area);
        if (!area.Passed) {
            SetEventFlagID(10003112, ON);
            WaitFixedTimeFrames(3);
            SetEventFlagID(10003108, OFF);
            WaitFixedTimeFrames(3);
            ForceAnimationPlayback(10000, 0, false, false, false);
            FadeToBlack(0, 0, false, -1);
            RestartEvent();
        }
    }
L9:
    RotateCharacter(10000, 10002236, 0, true);
    IssueShortWarpRequest(10000, TargetEntityType.Area, 10003209, -1);
    ForceAnimationPlayback(10001211, 20055, false, false, false);
    WaitFixedTimeFrames(1);
    UnknownSound201014(2);
    WaitFor(CharacterHasSpEffect(10001211, 9930));
    WaitFixedTimeFrames(1);
    SetEventFlagID(10003108, OFF);
    WaitFor(EventFlag(10003109));
    SetSpEffect(10000, 9821);
    WaitFixedTimeFrames(5);
    ForceAnimationPlayback(10000, 90214, false, false, false);
    WaitFixedTimeFrames(1);
    WaitFor(CharacterHasSpEffect(10000, 9936));
    FadeToBlack(1, 1, true, -1);
    WaitFixedTimeSeconds(1);
    ChangeHeroCharacter(10000, 50130);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000, 61020, false, false, false);
    WaitFixedTimeSeconds(2);
    ForceAnimationPlayback(10000, 90210, false, false, false);
    ForceAnimationPlayback(10001211, 30016, false, false, false);
    FadeToBlack(0, 1, true, -1);
    WaitFixedTimeSeconds(1);
    ClearSpEffect(10000, 9821);
    SetEventFlagID(10003109, OFF);
    FadeToBlack(0, 0, false, -1);
    UnknownTalk2003120(0);
    EndEvent();
});

$Event(100009255, Restart, function() {
    EndIf(EventFlag(1129112));
    EndIf(!TalkNPCEnabled(10001208));
    WaitFor(
        EventValue(68510, 8) >= 1
            && EventValue(68520, 8) >= 1
            && EventValue(68530, 8) >= 1
            && EventValue(68540, 8) >= 1);
    SetEventFlagID(1129113, ON);
    EndEvent();
});

$Event(100009256, Restart, function() {
    WaitFixedTimeFrames(3);
    EndIf(EventFlag(1129112));
    WaitFor(TalkNPCEnabled(10001208));
    WaitFixedTimeFrames(1);
    WaitFor(EventFlag(10003123));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    WaitFixedTimeFrames(1);
    WaitFor(EventFlag(10003111));
    UnknownTalk2003120(9999);
    RotateCharacter(10000, 10001208, -1, true);
    SetSpEffect(10000, 9821);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000, 90207, false, false, false);
    FadeToBlack(1, 1, true, -1);
    WaitFixedTimeSeconds(1);
    ForceAnimationPlayback(10000, 90100, true, false, false);
    WaitFixedTimeSeconds(2);
    PlaySE(10003206, SoundType.EnvironmentalSound, 101190057);
    WaitFor(EventFlag(10003121));
    WaitFixedTimeSeconds(3);
    SetEventFlagID(10003121, OFF);
    WaitFixedTimeSeconds(2);
    ForceAnimationPlayback(10001208, 20031, false, false, false);
    IssueShortWarpRequest(10001208, TargetEntityType.Area, 10003213, -1);
    ForceAnimationPlayback(10000, 90213, true, false, false);
    ClearSpEffect(10000, 9821);
    WaitFixedTimeFrames(1);
    IssueShortWarpRequest(10000, TargetEntityType.Area, 10003206, -1);
    SetCameraAngle(21.74, -129.53);
    ChangeCamera(1000000);
    WaitFixedTimeSeconds(1);
    PlaySE(10003206, SoundType.EnvironmentalSound, 101190059);
    WaitFixedTimeSeconds(3);
    FadeToBlack(0, 1, true, -1);
    WaitFixedTimeSeconds(1);
    WaitFor(!EventFlag(10003111));
    DisableCharacter(10001208);
    SetCharacterBackreadState(10001208, true);
    WaitFixedTimeSeconds(1);
    FadeToBlack(0, 0, false, -1);
    SetEventFlagID(10002312, ON);
    UnknownTalk2003120(0);
    ChangeCamera(-1);
    WaitFixedTimeFrames(1);
    EndEvent();
});

$Event(100009258, Restart, function() {
    WaitFixedTimeFrames(3);
    DisableAsset(10002215);
    DeleteAssetfollowingSFX(10002239, true);
    ClearSpEffect(10001230, 9753);
    EndIf(EventFlag(1129032));
    WaitFixedTimeFrames(1);
    WaitFor(
        (CurrentScenarioSection(ScenarioSection.Guardian)
            && TalkNPCEnabled(10001230)
            && TalkNPCEnabled(10001231))
            && (EventFlag(3226) || EventFlag(3232)));
    EnableAsset(10002215);
    SetSpEffect(10001230, 9753);
    SetNetworkUpdateRate(10001230, true, CharacterUpdateFrequency.AtLeastEvery2Frames);
    CreateAssetfollowingSFX(10002239, 90, 810045);
    SetCharacterMaphit(10001230, false);
    DisableCharacterGravity(10001230);
    WaitFixedTimeFrames(1);
    ResetCharacterPosition(10001230);
    WaitFor(EventFlag(1129032));
    ClearSpEffect(10001230, 9753);
    DeleteAssetfollowingSFX(10002239, true);
    SetNetworkUpdateRate(10001230, false, CharacterUpdateFrequency.NoUpdate);
    EndEvent();
});

$Event(100009259, Restart, function() {
    WaitFixedTimeFrames(3);
    EndIf(EventFlag(1129032));
    WaitFor(EventFlag(10003120));
    RotateCharacter(10001209, 10000, 90300, true);
    RotateCharacter(10001209, 10000, 90207, false);
    SetEventFlagID(10003120, OFF);
    RestartEvent();
});

$Event(100009260, Restart, function() {
    WaitFor(TalkNPCEnabled(10001208) && EntityInRadiusOfEntity(10001208, 10000, 1, 1));
    DisableLockOnPoint(10001208, 220);
    WaitFor(!EntityInRadiusOfEntity(10001208, 10000, 1, 1));
    EnableLockOnPoint(10001208, 220);
    RestartEvent();
});

$Event(100009261, Restart, function() {
    WaitFixedTimeFrames(3);
    flag = CurrentScenarioSection(ScenarioSection.Guardian) && EventFlag(3232);
    EndIf(!flag);
    WaitFor(flag);
    IssueShortWarpRequest(10000, TargetEntityType.Area, 10003006, -1);
    SetCameraAngle(19.5, -61.67);
    EndEvent();
});

$Event(100009262, Restart, function() {
    EndIf(EventFlag(1129032));
    WaitFixedTimeFrames(1);
    WaitFor(
        (CurrentScenarioSection(ScenarioSection.Guardian)
            && TalkNPCEnabled(10001230)
            && TalkNPCEnabled(10001231))
            && (EventFlag(3226) || EventFlag(3232)));
    WaitFor(EntityInRadiusOfEntity(10000, 10001230, 2.5, 1) || EventFlag(1129032));
    EndIf(EventFlag(1129032));
    SetEventFlagID(10003045, ON);
    WaitFor(!EntityInRadiusOfEntity(10000, 10001230, 3, 1) || EventFlag(1129032));
    SetEventFlagID(10003045, OFF);
    EndIf(EventFlag(1129032));
    RestartEvent();
});

$Event(100009280, Restart, function() {
    WaitFixedTimeFrames(3);
    EndIf(EventFlag(1139041));
    WarpAssetToCharacter(10002300, 10001303, 600);
    SetEventFlagID(10003154, OFF);
    WaitFor(EventFlag(10003150) && EventFlag(10003151));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    if (!EntityInRadiusOfEntity(10000, 10002300, 0.4, 1)) {
        RotateCharacter(10000, 10002300, -1, true);
        RotateCharacter(10000, 10002300, 90006, false);
        Goto(L8);
L8:
        WaitFixedTimeFrames(1);
        time = ElapsedSeconds(2);
        area = EntityInRadiusOfEntity(10000, 10002300, 0.4, 1);
        WaitFor(time || area);
        if (!area.Passed) {
            SetEventFlagID(10003154, ON);
            WaitFixedTimeFrames(3);
            SetEventFlagID(10003151, OFF);
            WaitFixedTimeFrames(3);
            ForceAnimationPlayback(10000, 0, false, false, false);
            FadeToBlack(0, 0, false, -1);
            UnknownTalk2003120(0);
            RestartEvent();
        }
    }
L9:
    RotateCharacter(10000, 10002300, 0, true);
    IssueShortWarpRequest(10000, TargetEntityType.Character, 10001303, 600);
    SetSpEffect(10000, 9822);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000, 90203, false, false, false);
    WaitFixedTimeFrames(1);
    WaitFor(CharacterHasSpEffect(10000, 9947));
    ForceAnimationPlayback(10001303, 90330, true, false, false);
    WaitFixedTimeSeconds(0.5);
    SetEventFlagID(10003151, OFF);
    ClearSpEffect(10000, 9822);
    WaitFor(EventFlag(10003157));
    WaitFixedTimeSeconds(6);
    SetEventFlagID(10003157, OFF);
    WaitFor(!EventFlag(10003150));
    FadeToBlack(0, 0, false, -1);
    UnknownTalk2003120(0);
    EndEvent();
});

$Event(100009281, Restart, function() {
    WaitFixedTimeFrames(3);
    EndIf(EventFlag(1139047));
    WarpAssetToCharacter(10002300, 10001303, 600);
    SetEventFlagID(10003155, OFF);
    WaitFor(EventFlag(10003152) && EventFlag(10003153));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    if (!EntityInRadiusOfEntity(10000, 10002300, 0.4, 1)) {
        RotateCharacter(10000, 10002300, -1, true);
        RotateCharacter(10000, 10002300, 90006, false);
        Goto(L8);
L8:
        WaitFixedTimeFrames(1);
        time = ElapsedSeconds(2);
        area = EntityInRadiusOfEntity(10000, 10002300, 0.4, 1);
        WaitFor(time || area);
        if (!area.Passed) {
            SetEventFlagID(10003155, ON);
            WaitFixedTimeFrames(3);
            SetEventFlagID(10003153, OFF);
            WaitFixedTimeFrames(3);
            ForceAnimationPlayback(10000, 0, false, false, false);
            FadeToBlack(0, 0, false, -1);
            UnknownTalk2003120(0);
            RestartEvent();
        }
    }
L9:
    RotateCharacter(10000, 10002300, 0, true);
    IssueShortWarpRequest(10000, TargetEntityType.Character, 10001303, 600);
    SetSpEffect(10000, 9822);
    SetSpEffect(10000, 9764);
    SetSpEffect(10000, 9765);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000, 90203, false, false, false);
    WaitFixedTimeFrames(1);
    WaitFor(CharacterHasSpEffect(10000, 9947));
    ForceAnimationPlayback(10001303, 90330, true, false, false);
    WaitFixedTimeSeconds(0.5);
    SetEventFlagID(10003153, OFF);
    ClearSpEffect(10000, 9822);
    ClearSpEffect(10000, 9764);
    WaitFor(EventFlag(10003158));
    WaitFixedTimeSeconds(4);
    SetEventFlagID(10003158, OFF);
    WaitFor(!EventFlag(10003152));
    FadeToBlack(0, 0, false, -1);
    UnknownTalk2003120(0);
    EndEvent();
});

$Event(100009282, Restart, function() {
    WaitFixedTimeFrames(3);
    ClearSpEffect(10001330, 9753);
    EndIf(EventFlag(1139020));
    EndIf(EventFlag(1139040));
    WaitFor(CurrentScenarioSection(ScenarioSection.Ironeye) && TalkNPCEnabled(10001330));
    SetSpEffect(10001330, 9753);
    SetNetworkUpdateRate(10001330, true, CharacterUpdateFrequency.AtLeastEvery2Frames);
    WaitFor(EventFlag(1139020) || EventFlag(1139040));
    ClearSpEffect(10001330, 9753);
    SetNetworkUpdateRate(10001330, false, CharacterUpdateFrequency.NoUpdate);
});

$Event(100009283, Restart, function() {
    WaitFor(InArea(10000, 10002227) && CurrentScenarioSection(ScenarioSection.Ironeye));
    SetEventFlagID(1139060, ON);
    RestartEvent();
});

$Event(100009300, Restart, function() {
    EndIf(EventFlag(1149100));
    SetEventFlagID(10003208, OFF);
    WaitFor(EventFlag(10003200));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    if (!EntityInRadiusOfEntity(10000, 10003400, 0.4, 1)) {
        RotateCharacter(10000, 10003400, -1, true);
        RotateCharacter(10000, 10003400, 90006, false);
        Goto(L8);
L8:
        WaitFixedTimeFrames(1);
        time = ElapsedSeconds(2);
        area = EntityInRadiusOfEntity(10000, 10003400, 0.4, 1);
        WaitFor(time || area);
        if (!area.Passed) {
            SetEventFlagID(10003208, ON);
            WaitFixedTimeFrames(3);
            SetEventFlagID(10003200, OFF);
            WaitFixedTimeFrames(3);
            ForceAnimationPlayback(10000, 0, false, false, false);
            FadeToBlack(0, 0, false, -1);
            UnknownTalk2003120(0);
            RestartEvent();
        }
    }
L9:
    RotateCharacter(10000, 10002408, 0, true);
    IssueShortWarpRequest(10000, TargetEntityType.Area, 10003400, -1);
    SetSpEffect(10000, 9823);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000, 90201, false, true, false);
    ClearSpEffect(10000, 9823);
    WaitFixedTimeFrames(1);
    WaitFor(CharacterHasSpEffect(10000, 9922));
    SetEventFlagID(10003200, OFF);
    WaitFixedTimeFrames(1);
    WaitFor(EventFlag(1149005));
    FadeToBlack(0, 0, false, -1);
    UnknownTalk2003120(0);
    RestartEvent();
});

$Event(100009301, Restart, function() {
    WaitFixedTimeFrames(3);
    EnableAsset(10002255);
    DisableAssetInvunerability(10002251);
    WaitFixedTimeFrames(1);
    DisableAsset(10002255);
    WaitFor(TalkNPCEnabled(10001411));
    DisableAsset(10002251);
    EnableAsset(10002255);
    EnableAssetInvunerability(10002255);
    ForceAnimationPlayback(10001411, 90101, true, false, false);
    WaitFixedTimeFrames(1);
    IssueShortWarpRequest(10001411, TargetEntityType.Area, 10003405, -1);
    EndIf(EventFlag(1149029));
    WaitFor(EventFlag(10003202));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    WaitFixedTimeFrames(1);
    SetEventFlagID(10003202, OFF);
    Goto(L1);
L0:
L1:
    WaitFor(EventFlag(1149027));
    UnknownTalk2003120(0);
    FadeToBlack(0, 0, false, -1);
    EndEvent();
});

$Event(100009302, Restart, function() {
    WaitFixedTimeFrames(3);
    if (!EventFlag(1149047)) {
        WaitFor(TalkNPCEnabled(10001409));
        DisableCharacter(10001409);
        if (!EventFlag(1149051)) {
            WaitFixedTimeFrames(1);
            WaitFor(EventFlag(1149042));
            UnknownTalk2003121();
            UnknownTalk2003120(9999);
            FadeToBlack(0, 0, true, -1);
            WaitFixedTimeFrames(1);
            FadeToBlack(1, 1, true, -1);
            PlaySE(10000, SoundType.EnvironmentalSound, 999990000);
            WaitFixedTimeSeconds(1);
            EnableCharacter(10001409);
            EnableCharacterDefaultBackread(10001409);
            SetCharacterTeamType(10001409, TeamType.FriendlyNPC);
            ForceAnimationPlayback(10001409, 90101, false, false, false);
            EnableCharacterInvincibility(10001409);
            WarpCharacterAndCopyFloor(10000, TargetEntityType.Area, 10003412, -1, 0);
            SetCameraAngle(18.05, -45.01);
            WaitFixedTimeSeconds(2);
            FadeToBlack(0, 1, false, -1);
            PlaySE(10000, SoundType.EnvironmentalSound, 999990001);
            UnknownTalk2003120(0);
            SetEventFlagID(1149051, ON);
            SetEventFlagID(10003203, OFF);
        } else {
L0:
            EnableCharacter(10001409);
            EnableCharacterDefaultBackread(10001409);
            SetCharacterTeamType(10001409, TeamType.FriendlyNPC);
            ForceAnimationPlayback(10001409, 90101, false, false, false);
            EnableCharacterInvincibility(10001409);
        }
L1:
        EndEvent();
    }
L20:
    WaitFor(TalkNPCEnabled(10001409));
    SetCharacterTeamType(10001409, TeamType.FriendlyNPC);
    WarpCharacterAndCopyFloor(10001409, TargetEntityType.Area, 10003960, -1, 0);
    ForceAnimationPlayback(10001409, -1, false, false, false);
    WaitFixedTimeFrames(20);
    ForceAnimationPlayback(10001409, 90100, true, false, false);
    EnableCharacterInvincibility(10001409);
});

$Event(100009303, Restart, function() {
    DisableAsset(10002407);
    WaitFixedTimeFrames(3);
    DisableCharacter(10001430);
    DisableCharacter(10001431);
    DisableCharacter(10001432);
    EndIf(EventFlag(1149047));
    WaitFor(EventFlag(10003204));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    WaitFixedTimeFrames(1);
    FadeToBlack(1, 1, true, -1);
    PlaySE(10000, SoundType.EnvironmentalSound, 999990000);
    SetBossBGM(920910, BossBGMState.Start);
    WaitFixedTimeSeconds(1);
    SetSpEffect(10000, 604000);
    SetSpEffect(10000, 604001);
    SetSpEffect(10000, 604002);
    SetSpEffect(10000, 604003);
    SetSpEffect(10000, 604004);
    SetSpEffect(10000, 604005);
    SetSpEffect(10000, 604006);
    SetSpEffect(10000, 604007);
    SetSpEffect(10000, 604008);
    SetSpEffect(10000, 604009);
    SetSpEffect(10000, 604010);
    SetSpEffect(10000, 604011);
    SetSpEffect(10000, 604012);
    SetSpEffect(10000, 604013);
    SetSpEffect(10000, 604014);
    SetSpEffect(10000, 604015);
    SetSpEffect(10000, 604016);
    UnknownHero200490();
    SetEventFlagID(10003209, ON);
    SetCharacterTalkRange(10001409, 80);
    SetCharacterTeamType(10001409, TeamType.Enemy);
    DisableCharacterInvincibility(10001409);
    EnableCharacterImmortality(10001409);
    IssueShortWarpRequest(10001409, TargetEntityType.Area, 10003402, -1);
    SetNetworkUpdateRate(10001409, true, CharacterUpdateFrequency.AlwaysUpdate);
    SetSpEffect(10000, 9773);
    ClearSpEffect(10000, 705012);
    SetSpEffect(10001409, 9752);
    ClearSpEffect(10000, 9752);
    IssueShortWarpRequest(10000, TargetEntityType.Area, 10003401, -1);
    SetCameraAngle(12.33, -130.22);
    SetSpEffect(10000, 103420);
    ClearSpEffect(10000, 9621);
    SetSpEffect(10000, 9777);
    ClearSpEffect(10000, 103400);
    ClearSpEffect(10000, 103530);
    ClearSpEffect(10000, 103540);
    ClearSpEffect(10000, 103550);
    ClearSpEffect(10000, 103560);
    ClearSpEffect(10000, 103570);
    EnableAsset(10002407);
    DisableCharacterHPBarDisplay(10001409);
    DisplayBossHealthBar(Enabled, 10001409, 0, 911000010);
    EnableCharacter(10001430);
    EnableCharacter(10001431);
    EnableCharacter(10001432);
    ForceAnimationPlayback(10001430, 1830, false, false, false);
    ForceAnimationPlayback(10001431, 1830, false, false, false);
    ForceAnimationPlayback(10001432, 1830, false, false, false);
    FadeToBlack(0, 1, false, -1);
    PlaySE(10000, SoundType.EnvironmentalSound, 999990001);
    WaitFixedTimeSeconds(1);
    UnknownTalk2003120(0);
    ForceAnimationPlayback(10001409, 0, true, false, false);
    hpChr = CharacterHPValue(10000) <= 0 || CharacterDead(10000);
    WaitFor(CharacterHPValue(10001409) <= 1 || hpChr);
    if (!hpChr.Passed) {
L9:
        UnknownTalk2003121();
        UnknownTalk2003120(9999);
        EnableCharacterInvincibility(10001409);
        SetCharacterTeamType(10001409, TeamType.FriendlyNPC);
        DisableCharacterHPBarDisplay(10001409);
        SetSpEffect(10000, 9752);
        WaitFor(ElapsedFrames(1));
        ClearSpEffect(10001409, 9752);
        ForceCharacterDeath(10001430, true);
        ForceCharacterDeath(10001431, true);
        ForceCharacterDeath(10001432, true);
        SetSpEffect(10001409, 9925);
        SetBossBGM(10000001, BossBGMState.Start);
        WaitFixedTimeFrames(1);
        WaitFor(CharacterHasSpEffect(10001409, 9924));
        DisplayBossHealthBar(Disabled, 10001409, 0, 911000010);
        SetEventFlagID(10003204, OFF);
        SetEventFlagID(10003205, ON);
        WaitFixedTimeSeconds(2);
        SetEventFlagID(10003209, OFF);
        WaitFor(!EventFlag(10003205));
        SetEventFlagID(1149052, ON);
        DisableAsset(10002407);
        SetBossBGM(10000000, BossBGMState.Start);
        ClearSpEffect(10000, 103420);
        DisplayTextEffectId(1060);
    } else {
L10:
        WaitFixedTimeSeconds(5);
    }
L11:
    SetEventFlagID(10003204, OFF);
    UnknownTalk2003120(2.5);
    EndEvent();
});

$Event(100009304, Restart, function() {
    WaitFor(EventFlag(10002100));
    WaitFixedTimeFrames(1);
    SetEventFlagID(10002100, OFF);
    WaitFixedTimeFrames(1);
    WarpPlayer(10, 0, 0, 0, 10003411, 0);
});

$Event(10009305, Restart, function() {
    SetEventFlagID(10003212, OFF);
    EndIf(EventFlag(1149100));
    WaitFor(EntityInRadiusOfEntity(10000, 10001407, 1, 1));
    SetEventFlagID(10003212, ON);
    WaitFixedTimeFrames(1);
    WaitFor(!EntityInRadiusOfEntity(10000, 10001407, 1, 1));
    SetEventFlagID(10003212, OFF);
    WaitFixedTimeFrames(1);
    RestartEvent();
});

$Event(10009306, Restart, function() {
    EndIf(EventFlag(1149070));
    WaitFor(EventFlag(10003206));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    WaitFixedTimeFrames(1);
    FadeToBlack(1, 1, true, -1);
    UnknownSound201014(4);
    WaitFixedTimeSeconds(1);
    SetSpEffect(10000, 9823);
    WaitFixedTimeFrames(20);
    ChangeHeroCharacter(10000, 50330);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000, 61020, false, false, false);
    WaitFixedTimeFrames(20);
    WaitFixedTimeFrames(1);
    IssueShortWarpRequest(10001413, TargetEntityType.Area, 10003415, -1);
    IssueShortWarpRequest(10000, TargetEntityType.Area, 10003407, -1);
    SetCameraAngle(9.01, 24.83);
    WaitFixedTimeSeconds(1);
    FadeToBlack(0, 1, true, -1);
    WaitFixedTimeSeconds(1);
    SetEventFlagID(10003206, OFF);
    WaitFor(EventFlag(10003207));
    FadeToBlack(0, 0, true, -1);
    WaitFor(!EventFlag(10003207));
    FadeToBlack(0, 0, false, -1);
    ChangeHeroGarbMenuSelection(Hero.Duchess, 50330);
    UnknownTalk2003120(0);
    EndEvent();
});

$Event(10009308, Restart, function(entityId, dummypolyId, sfxId) {
    EndIf(!EventFlag(900));
    EndIf(!EventFlag(901));
    EndIf(EventFlag(10009905));
    EndIf(!EventFlag(10009952));
    SpawnOneshotSFX(TargetEntityType.Area, entityId, dummypolyId, sfxId);
    EndEvent();
});

$Event(10009309, Restart, function() {
    WaitFixedTimeFrames(3);
    ClearSpEffect(10001414, 9753);
    ClearSpEffect(10001415, 9753);
    WaitFor(TalkNPCEnabled(10001414) && TalkNPCEnabled(10001415));
    EndIf(EventFlag(1149100));
    SetSpEffect(10001414, 9753);
    SetSpEffect(10001415, 9753);
    SetNetworkUpdateRate(10001414, true, CharacterUpdateFrequency.AtLeastEvery2Frames);
    SetNetworkUpdateRate(10001415, true, CharacterUpdateFrequency.AtLeastEvery2Frames);
    WaitFor(EventFlag(1149100));
    ClearSpEffect(10001414, 9753);
    ClearSpEffect(10001415, 9753);
    SetNetworkUpdateRate(10001414, false, CharacterUpdateFrequency.NoUpdate);
    SetNetworkUpdateRate(10001415, false, CharacterUpdateFrequency.NoUpdate);
});

$Event(10009307, Restart, function() {
    WaitFixedTimeFrames(3);
    ClearSpEffect(10001416, 9753);
    WaitFor(TalkNPCEnabled(10001416));
    EndIf(EventFlag(1149052));
    SetSpEffect(10001416, 9753);
    SetNetworkUpdateRate(10001416, true, CharacterUpdateFrequency.AtLeastEvery2Frames);
    SetCharacterMaphit(10001416, false);
    DisableCharacterGravity(10001416);
    WaitFixedTimeFrames(1);
    ResetCharacterPosition(10001416);
    WaitFor(EventFlag(1149052));
    ClearSpEffect(10001416, 9753);
    SetNetworkUpdateRate(10001416, false, CharacterUpdateFrequency.NoUpdate);
});

$Event(10009440, Restart, function() {
    WaitFixedTimeFrames(3);
    WaitFor(TalkNPCEnabled(10001417));
    EndIf(EventFlag(1149110));
    WaitFor(EventFlag(10003213));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    SetSpEffect(10000, 9823);
    FadeToBlack(0, 0, true, -1);
    WaitFixedTimeFrames(1);
    RotateCharacter(10000, 10002210, 0, true);
    RotateCharacter(10000, 10002210, 90213, true);
    WaitFixedTimeFrames(1);
    SetEventFlagID(10003213, OFF);
    WaitFor(EventFlag(1149110));
    FadeToBlack(0, 0, false, -1);
    UnknownTalk2003120(0);
    ClearSpEffect(10000, 9823);
});

$Event(10009441, Restart, function() {
    WaitFixedTimeFrames(3);
    WaitFor(TalkNPCEnabled(10001412));
    SetEventFlagID(10003218, OFF);
    EndIf(EventFlag(1149007));
    EnableAssetInvunerability(10002410);
    EnableAssetInvunerability(10002411);
    WaitFor(EventFlag(3424));
    SetEventFlagID(10003222, ON);
    WaitFixedTimeFrames(1);
    WaitFor(EventFlag(10003217));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    if (!EntityInRadiusOfEntity(10000, 10003417, 0.4, 1)) {
        RotateCharacter(10000, 10003417, -1, true);
        RotateCharacter(10000, 10003417, 90006, false);
        Goto(L8);
L8:
        WaitFixedTimeFrames(1);
        time = ElapsedSeconds(2);
        area = EntityInRadiusOfEntity(10000, 10003417, 0.4, 1);
        WaitFor(time || area);
        if (!area.Passed) {
            SetEventFlagID(10003218, ON);
            WaitFixedTimeFrames(3);
            SetEventFlagID(10003217, OFF);
            WaitFixedTimeFrames(3);
            ForceAnimationPlayback(10000, 0, false, false, false);
            FadeToBlack(0, 0, false, -1);
            UnknownTalk2003120(0);
            RestartEvent();
        }
    }
L9:
    RotateCharacter(10000, 10002412, 0, true);
    IssueShortWarpRequest(10000, TargetEntityType.Area, 10003417, -1);
    SetEventFlagID(10003217, OFF);
    SetSpEffect(10000, 9823);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000, 90203, false, true, false);
    ClearSpEffect(10000, 9823);
    WaitFixedTimeFrames(1);
    WaitFor(CharacterHasSpEffect(10000, 9922));
    SetEventFlagID(10003219, ON);
    SetEventFlagID(10003222, OFF);
    WaitFixedTimeFrames(1);
    WaitFor(EventFlag(1149007));
    FadeToBlack(0, 0, false, -1);
    UnknownTalk2003120(0);
    RestartEvent();
});

$Event(10009442, Restart, function() {
    WaitFixedTimeFrames(3);
    WaitFor(TalkNPCEnabled(10001414) && TalkNPCEnabled(10001415));
    EndIf(EventFlag(1149100));
    SetEventFlagID(1149101, ON);
    WaitFor(
        EventFlag(10003216)
            || (EventFlag(1149101)
                && EventFlag(1149102)
                && !EventFlag(1149103)
                && !EventFlag(10003216)
                && InArea(10000, 10003416)));
    EndIf(EventFlag(1149104));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    SetEventFlagID(10003221, ON);
    WaitFixedTimeSeconds(2);
    SetEventFlagID(10003221, OFF);
    SetEventFlagID(1149103, ON);
    DisplayGenericDialog(70020, PromptType.YESNO, NumberofOptions.NoButtons, 0, 5);
    FadeToBlack(0, 0, false, -1);
    UnknownTalk2003120(0);
});

$Event(10009443, Restart, function() {
    WaitFixedTimeFrames(3);
    ClearSpEffect(10001419, 9753);
    WaitFor(TalkNPCEnabled(10001419));
    EndIf(EventFlag(1149066));
    SetSpEffect(10001419, 9753);
    SetNetworkUpdateRate(10001419, true, CharacterUpdateFrequency.AtLeastEvery2Frames);
    WaitFor(EventFlag(1149066));
    ClearSpEffect(10001419, 9753);
    SetNetworkUpdateRate(10001419, false, CharacterUpdateFrequency.NoUpdate);
});

$Event(10009444, Restart, function() {
    WaitFixedTimeFrames(3);
    EndIf(EventFlag(1149032));
    WaitFor(EventFlag(10003220));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    WaitFor(EventFlag(1149032));
    FadeToBlack(0, 0, false, -1);
    UnknownTalk2003120(0);
});

$Event(10009445, Restart, function() {
    WaitFixedTimeFrames(3);
    WaitFor(TalkNPCEnabled(10001414) && TalkNPCEnabled(10001415));
    EndIf(EventFlag(1149100));
    EndIf(EventFlag(1149104));
    WaitFor(InArea(10000, 10003418));
    SetEventFlagID(1149104, ON);
    SetEventFlagID(1149103, ON);
    DisplayGenericDialog(70050, PromptType.YESNO, NumberofOptions.NoButtons, 0, 5);
});

$Event(10009446, Restart, function() {
    WaitFixedTimeFrames(3);
    flag = CurrentScenarioSection(ScenarioSection.Duchess) && AnyBatchEventFlags(3412, 3421);
    EndIf(!flag);
    WaitFor(flag);
    IssueShortWarpRequest(10000, TargetEntityType.Area, 10003419, -1);
    SetCameraAngle(19.34, 95.28);
    EndEvent();
});

$Event(10009447, Restart, function() {
    EndIf(EventFlag(1149052));
    WaitFixedTimeFrames(1);
    WaitFor(
        (CurrentScenarioSection(ScenarioSection.Duchess) && TalkNPCEnabled(10001416))
            && AnyBatchEventFlags(3412, 3421));
    WaitFor(EntityInRadiusOfEntity(10000, 10001416, 2.5, 1) || EventFlag(1149052));
    EndIf(EventFlag(1149052));
    SetEventFlagID(10003045, ON);
    WaitFor(!EntityInRadiusOfEntity(10000, 10001416, 3, 1) || EventFlag(1149052));
    SetEventFlagID(10003045, OFF);
    EndIf(EventFlag(1149052));
    RestartEvent();
});

$Event(10009448, Restart, function() {
    SetEventFlagID(10003223, OFF);
    WaitFor(
        TalkNPCEnabled(10001411)
            && CurrentScenarioSection(ScenarioSection.Duchess)
            && (CharacterHasSpEffect(10000, 102000)
                || CharacterHasSpEffect(10000, 102001)
                || CharacterHasSpEffect(10000, 102010))
            && EntityInRadiusOfEntity(10000, 10001411, 10, 1));
    SetEventFlagID(10003223, ON);
    WaitFixedTimeFrames(1);
    WaitFor(
        !(TalkNPCEnabled(10001411)
            && CurrentScenarioSection(ScenarioSection.Duchess)
            && (CharacterHasSpEffect(10000, 102000)
                || CharacterHasSpEffect(10000, 102001)
                || CharacterHasSpEffect(10000, 102010))
            && EntityInRadiusOfEntity(10000, 10001411, 10, 1)));
    SetEventFlagID(10003223, OFF);
    RestartEvent();
});

$Event(10009449, Restart, function() {
    WaitFixedTimeFrames(3);
    EndIf(EventFlag(1149068));
    WaitFor(EventFlag(10003224));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    WaitFor(EventFlag(1149068) || !EntityInRadiusOfEntity(10000, 10001413, 3.5, 1));
    if (EntityInRadiusOfEntity(10000, 10001413, 3.5, 1)) {
        FadeToBlack(0, 0, false, -1);
        UnknownTalk2003120(0);
        EndEvent();
    }
L0:
    FadeToBlack(0, 0, false, -1);
    UnknownTalk2003120(0);
    ForceAnimationPlayback(10001413, 20027, true, false, false);
    RestartEvent();
});

$Event(10009450, Restart, function() {
    WaitFixedTimeFrames(3);
    EndIf(EventFlag(1149100));
    WaitFor(TalkNPCEnabled(10001414) && TalkNPCEnabled(10001415));
    WaitFor(EventFlag(1149104));
    SetEventFlagID(10002218, ON);
    WaitFor(EventFlag(1149100));
    SetEventFlagID(10002218, OFF);
});

$Event(10009451, Restart, function() {
    SetEventFlagID(10003225, OFF);
    WaitFor(
        TalkNPCEnabled(10001411)
            && CurrentScenarioSection(ScenarioSection.Duchess)
            && EventFlag(10003225));
    FadeToBlack(0, 0, true, -1);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000, 90006, true, false, false);
    WaitFixedTimeFrames(10);
    ForceAnimationPlayback(10000, 0, true, false, false);
    SetEventFlagID(10003225, OFF);
    WaitFixedTimeFrames(1);
    FadeToBlack(0, 0, false, -1);
    RestartEvent();
});

$Event(10009310, Restart, function() {
    WaitFixedTimeFrames(1);
    WaitFor(TalkNPCEnabled(10001200));
    SetEventFlagID(1209240, ON);
    GotoIf(L1, !EventFlag(1129003));
    GotoIf(L2, EventFlag(1129003));
    Goto(L20);
L1:
    WaitFor(InArea(10000, 10003403) || EventFlag(1129003));
    RestartIf(EventFlag(1129003));
    SetEventFlagID(1209240, OFF);
    WaitFixedTimeFrames(1);
    WaitFor(!InArea(10000, 10003403) || EventFlag(1129003));
    RestartEvent();
L2:
    WaitFor(InArea(10000, 10003404));
    SetEventFlagID(1209240, OFF);
    WaitFixedTimeFrames(1);
    WaitFor(!InArea(10000, 10003404));
    RestartEvent();
L20:
    EndEvent();
});

$Event(10009311, Restart, function() {
    WaitFixedTimeFrames(3);
    EnableAsset(10002262);
    EnableAsset(10002263);
    EnableAsset(10002250);
    EnableAsset(10002251);
    EnableAsset(10002252);
    EnableAsset(10002253);
    DisableAsset(10002240);
    DisableAsset(10002241);
    WaitFixedTimeFrames(1);
    WaitFor(TalkNPCEnabled(10001200));
    DisableAsset(10002251);
    EnableAsset(10002240);
    EnableAssetInvunerability(10002240);
    DisableAsset(10002262);
    DisableAsset(10002263);
    ForceAnimationPlayback(10001200, 90105, true, false, false);
    WaitFixedTimeFrames(1);
    IssueShortWarpRequest(10001200, TargetEntityType.Area, 10003950, -1);
});

$Event(10009313, Restart, function() {
    WaitFixedTimeFrames(3);
    WaitFor(TalkNPCEnabled(10001207));
    SetCharacterTalkRange(10001207, 30);
    WaitFixedTimeFrames(1);
    WaitFor(AnyBatchEventFlags(3219, 3220) && !EventFlag(10003107));
    ForceAnimationPlayback(10001207, 30016, true, false, false);
    IssueShortWarpRequest(10001207, TargetEntityType.Area, 10003993, -1);
});

$Event(10009390, Restart, function() {
    WaitFixedTimeFrames(3);
});

$Event(10009391, Restart, function() {
    DisableAssetInvunerability(10002020);
    SetSpEffect(10000700, 9940);
    WaitFor(TalkNPCEnabled(10000700) && CharacterBackreadStatus(10000700));
    WaitFixedTimeFrames(1);
    GotoIf(L1, EventFlag(10000910));
    GotoIf(L2, EventFlag(10000911));
    GotoIf(L3, EventFlag(10000912));
    GotoIf(L2, 
        IsHero(Hero.Guardian)
            && CurrentScenarioSection(ScenarioSection.Guardian)
            && AnyBatchEventFlags(3206, 3213));
    GotoIf(L1, 
        IsHero(Hero.Guardian)
            && CurrentScenarioSection(ScenarioSection.Guardian)
            && (AnyBatchEventFlags(3215, 3219) || AnyBatchEventFlags(3221, 3222)));
    GotoIf(L2, 
        IsHero(Hero.Guardian)
            && CurrentScenarioSection(ScenarioSection.Guardian)
            && (AnyBatchEventFlags(3223, 3230) || EventFlag(3232)));
    GotoIf(L3, IsHero(Hero.Executor) && AnyBatchEventFlags(3800, 3808));
    GotoIf(L3, IsHero(Hero.Revenant) && AnyBatchEventFlags(3600, 3607));
    GotoIf(L2, 
        IsHero(Hero.Duchess)
            && CurrentScenarioSection(ScenarioSection.Duchess)
            && (AnyBatchEventFlags(3412, 3415) || AnyBatchEventFlags(3417, 3419)));
    GotoIf(L3, 
        IsHero(Hero.Recluse)
            && CurrentScenarioSection(ScenarioSection.Recluse)
            && AnyBatchEventFlags(3700, 3704));
    GotoIf(L1, 
        IsHero(Hero.Recluse)
            && CurrentScenarioSection(ScenarioSection.Recluse)
            && AnyBatchEventFlags(3707, 3710));
    BatchSetEventFlags(10003450, 10003454, OFF);
    RandomlySetEventFlagInRange(10003450, 10003454, ON);
    WaitFixedTimeFrames(1);
    GotoIf(L3, EventFlag(2001));
    GotoIf(L1, AnyBatchEventFlags(10003450, 10003452));
    GotoIf(L2, EventFlag(10003453));
    GotoIf(L3, EventFlag(10003454));
    EndEvent();
L1:
    IssueShortWarpRequest(10000700, TargetEntityType.Area, 10003914, -1);
    WaitFixedTimeFrames(10);
    ForceAnimationPlayback(10000700, 90107, true, false, false);
    ClearSpEffect(10000700, 9940);
    EndEvent();
L2:
    IssueShortWarpRequest(10000700, TargetEntityType.Area, 10003913, -1);
    WaitFixedTimeFrames(10);
    ForceAnimationPlayback(10000700, 90105, true, false, false);
    WaitFixedTimeFrames(1);
    IssueShortWarpRequest(10000700, TargetEntityType.Area, 10003910, -1);
    ClearSpEffect(10000700, 9940);
    EndEvent();
L3:
    EnableAssetInvunerability(10002020);
    WaitFixedTimeFrames(1);
    IssueShortWarpRequest(10000700, TargetEntityType.Area, 10003915, -1);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000700, 90102, true, false, false);
    WaitFixedTimeFrames(1);
    IssueShortWarpRequest(10000700, TargetEntityType.Area, 10003912, -1);
    ClearSpEffect(10000700, 9940);
    EndEvent();
});

$Event(10009392, Restart, function() {
    DisableAsset(10002900);
    DisableAssetInvunerability(10002900);
    SetSpEffect(10000760, 9940);
    WaitFor(TalkNPCEnabled(10000760) && CharacterBackreadStatus(10000760));
    WaitFixedTimeFrames(2);
    GotoIf(L1, EventFlag(10000910));
    GotoIf(L2, EventFlag(10000911));
    GotoIf(L3, EventFlag(10000912));
    GotoIf(L3, CurrentScenarioSection(ScenarioSection.None) && EventFlag(10002405));
    GotoIf(L2, 
        IsHero(Hero.Wylder)
            && CurrentScenarioSection(ScenarioSection.Wylder)
            && AnyBatchEventFlags(3102, 3106));
    GotoIf(L1, 
        IsHero(Hero.Wylder)
            && CurrentScenarioSection(ScenarioSection.Wylder)
            && (AnyBatchEventFlags(3108, 3110) || EventFlag(3121) || EventFlag(3124)));
    GotoIf(L3, 
        IsHero(Hero.Wylder)
            && CurrentScenarioSection(ScenarioSection.Wylder)
            && (AnyBatchEventFlags(3112, 3118) || AnyBatchEventFlags(3122, 3123)));
    GotoIf(L3, 
        IsHero(Hero.Duchess)
            && CurrentScenarioSection(ScenarioSection.Duchess)
            && (AnyBatchEventFlags(3400, 3406)
                || AnyBatchEventFlags(3408, 3410)
                || AnyBatchEventFlags(3412, 3415)));
    GotoIf(L2, 
        IsHero(Hero.Duchess)
            && CurrentScenarioSection(ScenarioSection.Duchess)
            && (AnyBatchEventFlags(3422, 3425) || EventFlag(3428)));
    GotoIf(L1, 
        IsHero(Hero.Raider)
            && CurrentScenarioSection(ScenarioSection.Raider)
            && AnyBatchEventFlags(3500, 3521));
    GotoIf(L1, 
        IsHero(Hero.Recluse)
            && CurrentScenarioSection(ScenarioSection.Recluse)
            && AnyBatchEventFlags(3700, 3704));
    GotoIf(L3, 
        IsHero(Hero.Recluse)
            && CurrentScenarioSection(ScenarioSection.Recluse)
            && AnyBatchEventFlags(3707, 3710));
    BatchSetEventFlags(10003455, 10003459, OFF);
    RandomlySetEventFlagInRange(10003455, 10003459, ON);
    WaitFixedTimeFrames(1);
    GotoIf(L1, EventFlag(2001));
    GotoIf(L1, AnyBatchEventFlags(10003455, 10003457));
    GotoIf(L2, EventFlag(10003458));
    GotoIf(L3, EventFlag(10003459));
    EndEvent();
L1:
    ForceAnimationPlayback(10000760, 90107, true, false, false);
    ClearSpEffect(10000760, 9940);
    EndEvent();
L2:
    EnableAsset(10002900);
    EnableAssetInvunerability(10002900);
    WaitFixedTimeFrames(1);
    IssueShortWarpRequest(10000760, TargetEntityType.Area, 10003920, -1);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000760, 90105, true, false, false);
    WaitFixedTimeFrames(1);
    IssueShortWarpRequest(10000760, TargetEntityType.Area, 10003920, -1);
    ClearSpEffect(10000760, 9940);
    EndEvent();
L3:
    IssueShortWarpRequest(10000760, TargetEntityType.Area, 10003921, -1);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000760, 90106, true, false, false);
    ClearSpEffect(10000760, 9940);
    EndEvent();
});

$Event(10009393, Restart, function() {
    DisableAsset(10002908);
    SetSpEffect(10000750, 9940);
    WaitFor(TalkNPCEnabled(10000750) && CharacterBackreadStatus(10000750));
    WaitFixedTimeFrames(1);
    GotoIf(L1, EventFlag(10000910));
    GotoIf(L2, EventFlag(10000911));
    GotoIf(L3, EventFlag(10000912));
    GotoIf(L3, 
        IsHero(Hero.Wylder)
            && CurrentScenarioSection(ScenarioSection.Wylder)
            && AnyBatchEventFlags(3100, 3106));
    GotoIf(L1, 
        IsHero(Hero.Wylder)
            && CurrentScenarioSection(ScenarioSection.Wylder)
            && (AnyBatchEventFlags(3108, 3110) || EventFlag(3121) || EventFlag(3124)));
    GotoIf(L2, 
        IsHero(Hero.Duchess)
            && CurrentScenarioSection(ScenarioSection.Duchess)
            && (AnyBatchEventFlags(3400, 3406) || AnyBatchEventFlags(3408, 3410)));
    GotoIf(L3, 
        IsHero(Hero.Duchess)
            && CurrentScenarioSection(ScenarioSection.Duchess)
            && (AnyBatchEventFlags(3412, 3415) || AnyBatchEventFlags(3417, 3419)));
    GotoIf(L2, 
        IsHero(Hero.Duchess)
            && CurrentScenarioSection(ScenarioSection.Duchess)
            && (AnyBatchEventFlags(3422, 3425) || EventFlag(3428)));
    GotoIf(L2, 
        IsHero(Hero.Guardian)
            && CurrentScenarioSection(ScenarioSection.Guardian)
            && (AnyBatchEventFlags(3206, 3213) || AnyBatchEventFlags(3215, 3219)));
    GotoIf(L2, 
        IsHero(Hero.Guardian)
            && CurrentScenarioSection(ScenarioSection.Guardian)
            && (AnyBatchEventFlags(3223, 3230) || EventFlag(3232)));
    GotoIf(L2, 
        IsHero(Hero.Recluse)
            && CurrentScenarioSection(ScenarioSection.Recluse)
            && AnyBatchEventFlags(3707, 3710));
    BatchSetEventFlags(10003460, 10003464, OFF);
    RandomlySetEventFlagInRange(10003460, 10003464, ON);
    WaitFixedTimeFrames(1);
    GotoIf(L1, AnyBatchEventFlags(10003460, 10003462));
    GotoIf(L2, EventFlag(10003463));
    GotoIf(L3, EventFlag(10003464));
    EndEvent();
L1:
    ForceAnimationPlayback(10000750, 90108, true, false, false);
    WaitFixedTimeFrames(1);
    IssueShortWarpRequest(10000750, TargetEntityType.Area, 10003932, -1);
    ClearSpEffect(10000750, 9940);
    EndEvent();
L2:
    IssueShortWarpRequest(10000750, TargetEntityType.Area, 10003930, -1);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000750, 90105, true, false, false);
    ClearSpEffect(10000750, 9940);
    EndEvent();
L3:
    IssueShortWarpRequest(10000750, TargetEntityType.Area, 10003931, -1);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000750, 90104, true, false, false);
    WaitFixedTimeFrames(1);
    IssueShortWarpRequest(10000750, TargetEntityType.Area, 10003931, -1);
    EnableAsset(10002908);
    ClearSpEffect(10000750, 9940);
    EndEvent();
L4:
    ForceAnimationPlayback(10000750, 90100, true, false, false);
    IssueShortWarpRequest(10000750, TargetEntityType.Area, 10003933, -1);
    ClearSpEffect(10000750, 9940);
    EndEvent();
});

$Event(10009394, Restart, function() {
    SetSpEffect(10000711, 9940);
    WaitFor(CharacterBackreadStatus(10000711));
    WaitFixedTimeFrames(1);
    EnableAsset(10002903);
    DisableAssetInvunerability(10002903);
    DisableAsset(10002904);
    DisableAssetInvunerability(10002904);
    GotoIf(L12, EventFlag(2001));
    GotoIf(L17, !EventFlag(6031));
    if (!EventFlag(1209460)) {
        SetEventFlagID(1209460, ON);
    } else if (!EventFlag(1209461)) {
        SetEventFlagID(1209461, ON);
    } else if (!EventFlag(1209462)) {
        SetEventFlagID(1209462, ON);
    } else if (!EventFlag(1209463)) {
        SetEventFlagID(1209463, ON);
    } else if (!EventFlag(1209464)) {
        SetEventFlagID(1209464, ON);
    } else if (!EventFlag(1209465)) {
        SetEventFlagID(1209465, ON);
    } else {
        BatchSetEventFlags(1209470, 1209477, OFF);
        WaitFixedTimeFrames(1);
        RandomlySetEventFlagInRange(1209470, 1209477, ON);
        WaitFixedTimeFrames(1);
        GotoIf(S0, AnyBatchEventFlags(1209470, 1209476));
        ChangeHeroCharacter(10000711, 20300);
        SetSpEffect(10000711, 9832);
        SetCharacterName(10000711, 100020);
        WaitFixedTimeFrames(1);
        ForceAnimationPlayback(10000711, 90302, false, false, false);
        EnableCharacter(10000711);
        Goto(L15);
    }
S0:
L0:
    Goto(L10);
L10:
    EnableCharacter(10000711);
    GotoIf(L11, EventFlag(10000910));
    GotoIf(L12, EventFlag(10000911));
    GotoIf(L13, EventFlag(10000912));
    GotoIf(L13, 
        IsHero(Hero.Wylder)
            && CurrentScenarioSection(ScenarioSection.Wylder)
            && (AnyBatchEventFlags(3112, 3118) || AnyBatchEventFlags(3122, 3123)));
    GotoIf(L11, 
        IsHero(Hero.Guardian)
            && CurrentScenarioSection(ScenarioSection.Guardian)
            && AnyBatchEventFlags(3205, 3213));
    GotoIf(L13, 
        IsHero(Hero.Guardian)
            && CurrentScenarioSection(ScenarioSection.Guardian)
            && AnyBatchEventFlags(3215, 3220));
    GotoIf(L11, 
        IsHero(Hero.Recluse)
            && CurrentScenarioSection(ScenarioSection.Recluse)
            && (AnyBatchEventFlags(3700, 3704) || AnyBatchEventFlags(3707, 3710)));
    BatchSetEventFlags(10003465, 10003469, OFF);
    RandomlySetEventFlagInRange(10003465, 10003469, ON);
    WaitFixedTimeFrames(1);
    GotoIf(L11, AnyBatchEventFlags(10003465, 10003467));
    GotoIf(L12, EventFlag(10003468));
    GotoIf(L13, EventFlag(10003469));
    EndEvent();
L11:
    ForceAnimationPlayback(10000711, 90100, true, false, false);
    IssueShortWarpRequest(10000711, TargetEntityType.Area, 10002744, -1);
    ClearSpEffect(10000711, 9940);
    EndEvent();
L12:
    ForceAnimationPlayback(10000711, 90103, true, false, false);
    IssueShortWarpRequest(10000711, TargetEntityType.Area, 10003949, -1);
    ClearSpEffect(10000711, 9940);
    EndEvent();
L13:
    WaitFixedTimeFrames(1);
    if (IsHero(Hero.Revenant)) {
        SetEventFlagID(10003013, ON);
    }
    DisableAsset(10002903);
    EnableAsset(10002904);
    EnableAssetInvunerability(10002904);
    IssueShortWarpRequest(10000711, TargetEntityType.Area, 10002707, -1);
    ForceAnimationPlayback(10000711, 0, false, false, false);
    WaitFixedTimeFrames(2);
    ForceAnimationPlayback(10000711, 90104, true, false, false);
    WaitFixedTimeFrames(1);
    IssueShortWarpRequest(10000711, TargetEntityType.Area, 10003942, -1);
    ClearSpEffect(10000711, 9940);
    EndEvent();
L15:
    GotoIf(L18, 
        IsHero(Hero.Guardian)
            && CurrentScenarioSection(ScenarioSection.Guardian)
            && AnyBatchEventFlags(3215, 3219));
    if (!(IsHero(Hero.Guardian)
        && CurrentScenarioSection(ScenarioSection.Guardian)
        && AnyBatchEventFlags(3223, 3232))) {
        chrFlag &= IsHero(Hero.Recluse) && CurrentScenarioSection(ScenarioSection.Recluse);
        chrFlag &= AnyBatchEventFlags(3700, 3704) || AnyBatchEventFlags(3707, 3710);
        if (!chrFlag) {
            BatchSetEventFlags(10003465, 10003469, OFF);
            RandomlySetEventFlagInRange(10003465, 10003469, ON);
            WaitFixedTimeFrames(1);
            if (!AnyBatchEventFlags(10003468, 10003469)) {
                IssueShortWarpRequest(10000711, TargetEntityType.Area, 10003941, -1);
                SetSpEffect(10000711, 9678);
                ClearSpEffect(10000711, 9940);
                EndEvent();
            }
        }
    }
L16:
    IssueShortWarpRequest(10000711, TargetEntityType.Area, 10003945, -1);
    SetSpEffect(10000711, 9679);
    ClearSpEffect(10000711, 9940);
    EndEvent();
L17:
    ChangeHeroCharacter(10000711, 20300);
    SetSpEffect(10000711, 9832);
    SetCharacterName(10000711, 100020);
    WaitFixedTimeFrames(1);
    EnableCharacter(10000711);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000711, 90302, false, false, false);
    ClearSpEffect(10000711, 9940);
    chrFlag &= IsHero(Hero.Guardian)
        && CurrentScenarioSection(ScenarioSection.Guardian)
        && AnyBatchEventFlags(3205, 3213);
    GotoIf(L18, chrFlag);
    EndEvent();
L18:
    IssueShortWarpRequest(10000711, TargetEntityType.Area, 10003999, -1);
    SetSpEffect(10000711, 9678);
    ClearSpEffect(10000711, 9940);
    EndEvent();
});

$Event(10009395, Restart, function() {
    DisableAssetInvunerability(10002251);
    DisableAssetInvunerability(10002907);
    DisableAsset(10002909);
    SetSpEffect(10000720, 9940);
    WaitFor(TalkNPCEnabled(10000720) && CharacterBackreadStatus(10000720));
    WaitFixedTimeFrames(1);
    GotoIf(L1, EventFlag(10000910));
    GotoIf(L2, EventFlag(10000911));
    GotoIf(L3, EventFlag(10000912));
    GotoIf(L1, 
        IsHero(Hero.Duchess)
            && CurrentScenarioSection(ScenarioSection.Duchess)
            && AnyBatchEventFlags(3408, 3410));
    GotoIf(L1, 
        IsHero(Hero.Guardian)
            && CurrentScenarioSection(ScenarioSection.Guardian)
            && AnyBatchEventFlags(3203, 3220));
    GotoIf(L3, IsHero(Hero.Revenant) && AnyBatchEventFlags(3600, 3607));
    GotoIf(L1, 
        IsHero(Hero.Recluse)
            && CurrentScenarioSection(ScenarioSection.Recluse)
            && (AnyBatchEventFlags(3700, 3704) || AnyBatchEventFlags(3707, 3710)));
    GotoIf(L2, 
        IsHero(Hero.Recluse)
            && CurrentScenarioSection(ScenarioSection.Recluse)
            && AnyBatchEventFlags(3712, 3722));
    GotoIf(L2, 
        CurrentScenarioSection(ScenarioSection.None) && EventFlag(3000) && !EventFlag(1109030));
    GotoIf(L2, 
        CurrentScenarioSection(ScenarioSection.None) && EventFlag(3003) && !EventFlag(1109031));
    GotoIf(L2, 
        CurrentScenarioSection(ScenarioSection.None) && EventFlag(3005) && !EventFlag(1109032));
    BatchSetEventFlags(10003470, 10003474, OFF);
    RandomlySetEventFlagInRange(10003470, 10003474, ON);
    WaitFixedTimeFrames(1);
    GotoIf(L1, AnyBatchEventFlags(10003470, 10003472));
    GotoIf(L2, EventFlag(10003473));
    GotoIf(L3, EventFlag(10003474));
    EndEvent();
L1:
    if (IsHero(Hero.Revenant)) {
        SetEventFlagID(10003011, ON);
    }
    IssueShortWarpRequest(10000720, TargetEntityType.Area, 10003952, -1);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000720, 90103, true, false, false);
    ClearSpEffect(10000720, 9940);
    EndEvent();
L2:
    if (IsHero(Hero.Revenant) || IsHero(Hero.Duchess)) {
        SetEventFlagID(10003012, ON);
    }
    DisableAsset(10002251);
    EnableAsset(10002909);
    EnableAssetInvunerability(10002909);
    WaitFixedTimeFrames(1);
    IssueShortWarpRequest(10000720, TargetEntityType.Area, 10003950, -1);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000720, 90101, true, false, false);
    WaitFixedTimeFrames(1);
    IssueShortWarpRequest(10000720, TargetEntityType.Area, 10003950, -1);
    ClearSpEffect(10000720, 9940);
    EndEvent();
L3:
    if (IsHero(Hero.Duchess)) {
        SetEventFlagID(10003015, ON);
    }
    EnableAssetInvunerability(10002907);
    IssueShortWarpRequest(10000720, TargetEntityType.Area, 10003953, -1);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000720, 90108, true, false, false);
    WaitFixedTimeFrames(1);
    IssueShortWarpRequest(10000720, TargetEntityType.Area, 10003951, -1);
    ClearSpEffect(10000720, 9940);
    EndEvent();
});

$Event(10009396, Restart, function() {
    DisableAssetInvunerability(10002911);
    SetSpEffect(10000770, 9940);
    WaitFor(TalkNPCEnabled(10000770) && CharacterBackreadStatus(10000770));
    WaitFixedTimeFrames(1);
    GotoIf(L1, EventFlag(10000910));
    GotoIf(L2, EventFlag(10000911));
    GotoIf(L3, EventFlag(10000912));
    GotoIf(L2, 
        IsHero(Hero.Wylder)
            && CurrentScenarioSection(ScenarioSection.Wylder)
            && AnyBatchEventFlags(3108, 3117));
    GotoIf(L2, 
        IsHero(Hero.Wylder)
            && CurrentScenarioSection(ScenarioSection.Wylder)
            && AnyBatchEventFlags(3118, 3119));
    GotoIf(L2, 
        IsHero(Hero.Duchess)
            && CurrentScenarioSection(ScenarioSection.Duchess)
            && AnyBatchEventFlags(3408, 3410));
    GotoIf(L2, 
        IsHero(Hero.Guardian)
            && CurrentScenarioSection(ScenarioSection.Guardian)
            && (AnyBatchEventFlags(3206, 3213) || AnyBatchEventFlags(3215, 3219)));
    GotoIf(L2, 
        IsHero(Hero.Guardian)
            && CurrentScenarioSection(ScenarioSection.Guardian)
            && (AnyBatchEventFlags(3223, 3230) || EventFlag(3232)));
    GotoIf(L2, 
        IsHero(Hero.Raider)
            && CurrentScenarioSection(ScenarioSection.Raider)
            && AnyBatchEventFlags(3500, 3521));
    BatchSetEventFlags(10003475, 10003479, OFF);
    RandomlySetEventFlagInRange(10003475, 10003479, ON);
    WaitFixedTimeFrames(1);
    GotoIf(L1, AnyBatchEventFlags(10003475, 10003477));
    GotoIf(L2, EventFlag(10003478));
    GotoIf(L3, EventFlag(10003479));
    EndEvent();
L1:
    IssueShortWarpRequest(10000770, TargetEntityType.Area, 10003902, -1);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000770, 90107, true, false, false);
    WaitFixedTimeFrames(1);
    IssueShortWarpRequest(10000770, TargetEntityType.Area, 10003902, -1);
    ClearSpEffect(10000770, 9940);
    EndEvent();
L2:
    IssueShortWarpRequest(10000770, TargetEntityType.Area, 10003960, -1);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000770, 90106, true, false, false);
    ClearSpEffect(10000770, 9940);
    EndEvent();
L3:
    EnableAssetInvunerability(10002911);
    IssueShortWarpRequest(10000770, TargetEntityType.Area, 10003961, -1);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000770, 90105, true, false, false);
    WaitFixedTimeFrames(1);
    IssueShortWarpRequest(10000770, TargetEntityType.Area, 10003961, -1);
    ClearSpEffect(10000770, 9940);
    EndEvent();
});

$Event(10009397, Restart, function() {
    DisableAssetInvunerability(10002901);
    DisableAssetInvunerability(10002902);
    SetSpEffect(10000740, 9940);
    WaitFor(TalkNPCEnabled(10000740) && CharacterBackreadStatus(10000740));
    WaitFixedTimeFrames(1);
    GotoIf(L1, EventFlag(10000910));
    GotoIf(L2, EventFlag(10000911));
    GotoIf(L3, EventFlag(10000912));
    GotoIf(L1, 
        IsHero(Hero.Wylder)
            && CurrentScenarioSection(ScenarioSection.Wylder)
            && AnyBatchEventFlags(3100, 3106));
    chr = IsHero(Hero.Wylder) && CurrentScenarioSection(ScenarioSection.Wylder);
    flag = AnyBatchEventFlags(3108, 3110) || EventFlag(3121) || EventFlag(3124);
    GotoIf(L2, chr);
    GotoIf(L1, 
        IsHero(Hero.Duchess)
            && CurrentScenarioSection(ScenarioSection.Duchess)
            && AnyBatchEventFlags(3400, 3406));
    GotoIf(L3, 
        IsHero(Hero.Duchess)
            && CurrentScenarioSection(ScenarioSection.Duchess)
            && AnyBatchEventFlags(3408, 3410));
    GotoIf(L2, 
        IsHero(Hero.Guardian)
            && CurrentScenarioSection(ScenarioSection.Guardian)
            && AnyBatchEventFlags(3219, 3220));
    GotoIf(L1, 
        IsHero(Hero.Revenant)
            && CurrentScenarioSection(ScenarioSection.Revenant)
            && AnyBatchEventFlags(3608, 3611));
    BatchSetEventFlags(10003480, 10003484, OFF);
    RandomlySetEventFlagInRange(10003480, 10003484, ON);
    WaitFixedTimeFrames(1);
    GotoIf(L4, EventFlag(2001));
    GotoIf(L1, AnyBatchEventFlags(10003480, 10003482));
    GotoIf(L2, EventFlag(10003483));
    GotoIf(L3, EventFlag(10003484));
    EndEvent();
L1:
    EnableAssetInvunerability(10002901);
    IssueShortWarpRequest(10000740, TargetEntityType.Area, 10003901, -1);
    ClearSpEffect(10000740, 9940);
    EndEvent();
L2:
    if (IsHero(Hero.Revenant)) {
        SetEventFlagID(10003014, ON);
    }
    EnableAssetInvunerability(10002902);
    WaitFixedTimeFrames(1);
    IssueShortWarpRequest(10000740, TargetEntityType.Area, 10003971, -1);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000740, 0, false, false, false);
    EnableCharacterInvincibility(10000740);
    WaitFor(EntityInRadiusOfEntity(10000, 10000740, 40, 1));
    ForceAnimationPlayback(10000740, 90103, true, false, false);
    WaitFixedTimeFrames(1);
    IssueShortWarpRequest(10000740, TargetEntityType.Area, 10003970, -1);
    ClearSpEffect(10000740, 9940);
    EndEvent();
L3:
    IssueShortWarpRequest(10000740, TargetEntityType.Area, 10003971, -1);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000740, 0, false, false, false);
    EnableCharacterInvincibility(10000740);
    WaitFor(EntityInRadiusOfEntity(10000, 10000740, 40, 1));
    ForceAnimationPlayback(10000740, 90101, true, false, false);
    ClearSpEffect(10000740, 9940);
    EndEvent();
L4:
    ForceAnimationPlayback(10000740, 90100, true, false, false);
    IssueShortWarpRequest(10000740, TargetEntityType.Area, 10003210, -1);
    ClearSpEffect(10000740, 9940);
    EndEvent();
});

$Event(10009398, Restart, function() {
    EnableAsset(10002905);
    DisableAsset(10002906);
    SetSpEffect(10000730, 9940);
    WaitFor(TalkNPCEnabled(10000730) && CharacterBackreadStatus(10000730));
    WaitFixedTimeFrames(1);
    GotoIf(L1, EventFlag(10000910));
    GotoIf(L2, EventFlag(10000911));
    GotoIf(L3, EventFlag(10000912));
    chr = IsHero(Hero.Wylder) && CurrentScenarioSection(ScenarioSection.Wylder);
    flag = AnyBatchEventFlags(3108, 3110) || EventFlag(3121) || EventFlag(3124);
    GotoIf(L1, chr);
    GotoIf(L1, 
        IsHero(Hero.Duchess)
            && CurrentScenarioSection(ScenarioSection.Duchess)
            && (AnyBatchEventFlags(3400, 3406)
                || AnyBatchEventFlags(3408, 3410)
                || AnyBatchEventFlags(3412, 3415)
                || AnyBatchEventFlags(3417, 3419)));
    GotoIf(L3, 
        IsHero(Hero.Duchess)
            && CurrentScenarioSection(ScenarioSection.Duchess)
            && (AnyBatchEventFlags(3422, 3425) || EventFlag(3428)));
    GotoIf(L1, 
        IsHero(Hero.Guardian)
            && CurrentScenarioSection(ScenarioSection.Guardian)
            && (AnyBatchEventFlags(3206, 3213) || AnyBatchEventFlags(3215, 3219)));
    GotoIf(L2, 
        IsHero(Hero.Guardian)
            && CurrentScenarioSection(ScenarioSection.Guardian)
            && (AnyBatchEventFlags(3223, 3230) || EventFlag(3232)));
    GotoIf(L1, 
        IsHero(Hero.Recluse)
            && CurrentScenarioSection(ScenarioSection.Recluse)
            && (AnyBatchEventFlags(3700, 3704) || AnyBatchEventFlags(3707, 3710)));
    flag2 &= !EventFlag(6037) && CurrentScenarioSection(ScenarioSection.None);
    GotoIf(L3, flag2);
    BatchSetEventFlags(10003485, 10003489, OFF);
    RandomlySetEventFlagInRange(10003485, 10003489, ON);
    WaitFixedTimeFrames(1);
    GotoIf(L1, AnyBatchEventFlags(10003485, 10003487));
    GotoIf(L2, EventFlag(10003488));
    GotoIf(L3, EventFlag(10003489));
    EndEvent();
L1:
    ForceAnimationPlayback(10000730, 90106, true, false, false);
    ClearSpEffect(10000730, 9940);
    EndEvent();
L2:
    flag2 &= !EventFlag(6037) && CurrentScenarioSection(ScenarioSection.None);
    GotoIf(L3, flag2);
    if (IsHero(Hero.Revenant) || IsHero(Hero.Duchess)) {
        SetEventFlagID(10003010, ON);
    }
    IssueShortWarpRequest(10000730, TargetEntityType.Area, 10003980, -1);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000730, 90108, true, false, false);
    ClearSpEffect(10000730, 9940);
    EndEvent();
L3:
    IssueShortWarpRequest(10000730, TargetEntityType.Area, 10003981, -1);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000730, 90105, true, false, false);
    ClearSpEffect(10000730, 9940);
    EndEvent();
});

$Event(10009401, Restart, function() {
    SetEventFlagID(10002400, OFF);
    SetEventFlagID(10002401, OFF);
    SetEventFlagID(10002402, OFF);
    SetSpEffect(10000780, 9940);
    WaitFor(TalkNPCEnabled(10000780) && CharacterBackreadStatus(10000780));
    WaitFixedTimeFrames(2);
    GotoIf(L1, EventFlag(10000910));
    GotoIf(L2, EventFlag(10000911));
    GotoIf(L3, EventFlag(10000912));
    GotoIf(L10, CurrentScenarioSection(ScenarioSection.None) && EventFlag(10002405));
    GotoIf(L2, 
        IsHero(Hero.Duchess)
            && CurrentScenarioSection(ScenarioSection.Duchess)
            && AnyBatchEventFlags(3400, 3406));
    GotoIf(L1, 
        IsHero(Hero.Duchess)
            && CurrentScenarioSection(ScenarioSection.Duchess)
            && (AnyBatchEventFlags(3412, 3415) || AnyBatchEventFlags(3417, 3419)));
    BatchSetEventFlags(10003490, 10003494, OFF);
    RandomlySetEventFlagInRange(10003490, 10003494, ON);
    WaitFixedTimeFrames(1);
    GotoIf(L1, AnyBatchEventFlags(10003490, 10003492));
    GotoIf(L2, EventFlag(10003493));
    GotoIf(L3, EventFlag(10003494));
    EndEvent();
L1:
    SetEventFlagID(10002400, ON);
    ClearSpEffect(10000780, 9940);
    EndEvent();
L2:
    IssueShortWarpRequest(10000780, TargetEntityType.Area, 10003991, -1);
    SetEventFlagID(10002401, ON);
    ClearSpEffect(10000780, 9940);
    EndEvent();
L3:
    ForceAnimationPlayback(10000780, 30021, true, false, false);
    IssueShortWarpRequest(10000780, TargetEntityType.Area, 10003992, -1);
    SetEventFlagID(10002402, ON);
    ClearSpEffect(10000780, 9940);
    EndEvent();
L10:
    ForceAnimationPlayback(10000780, 30016, true, false, false);
    IssueShortWarpRequest(10000780, TargetEntityType.Area, 10003994, -1);
    ClearSpEffect(10000780, 9940);
    EndEvent();
});

$Event(10009402, Restart, function() {
    WaitFixedTimeFrames(1);
    EnableCharacterInvincibility(10000580);
});

$Event(10009403, Restart, function() {
    WaitFor(EventFlag(10009394));
    DisableCharacter(10000712);
});

$Event(10009404, Restart, function() {
    WaitFixedTimeFrames(3);
    DisableAsset(10002021);
    DisableAsset(10002022);
    WaitFixedTimeFrames(1);
    if (EventFlag(10001851)) {
        EnableAsset(10002022);
        if (EventFlag(10001852)) {
            SetEventFlagID(10001850, ON);
        }
    }
    if (!EventFlag(10001851)) {
        EnableAsset(10002021);
    }
    chrFlag &= IsHero(Hero.Wylder)
        && CurrentScenarioSection(ScenarioSection.Wylder)
        && EventFlag(3121)
        && !EventFlag(1119073);
    GotoIf(L2, chrFlag);
    GotoIf(L2, 
        IsHero(Hero.Wylder)
            && CurrentScenarioSection(ScenarioSection.Wylder)
            && AnyBatchEventFlags(3100, 3107));
    GotoIf(L2, 
        IsHero(Hero.Duchess)
            && CurrentScenarioSection(ScenarioSection.Duchess)
            && AnyBatchEventFlags(3400, 3421));
    GotoIf(L1, 
        IsHero(Hero.Duchess)
            && CurrentScenarioSection(ScenarioSection.Duchess)
            && AnyBatchEventFlags(3422, 3428));
    GotoIf(L2, 
        IsHero(Hero.Recluse)
            && CurrentScenarioSection(ScenarioSection.Recluse)
            && AnyBatchEventFlags(3712, 3716));
    GotoIf(L2, 
        IsHero(Hero.Recluse)
            && CurrentScenarioSection(ScenarioSection.Recluse)
            && (AnyBatchEventFlags(3700, 3711) || EventFlag(3727)));
    GotoIf(L2, 
        IsHero(Hero.Ironeye)
            && CurrentScenarioSection(ScenarioSection.Ironeye)
            && AnyBatchEventFlags(3305, 3310));
    chr = IsHero(Hero.Ironeye) && CurrentScenarioSection(ScenarioSection.Ironeye);
    chrFlag &= EventFlag(1139100);
    GotoIf(L1, chr);
    GotoIf(L2, 
        CurrentScenarioSection(ScenarioSection.Guardian)
            || CurrentScenarioSection(ScenarioSection.Raider)
            || CurrentScenarioSection(ScenarioSection.Revenant)
            || CurrentScenarioSection(ScenarioSection.Executor));
    EndEvent();
L1:
    DisableAsset(10002021);
    EnableAsset(10002022);
    if (EventFlag(10001852)) {
        SetEventFlagID(10001850, ON);
    }
    EndEvent();
L2:
    EnableAsset(10002021);
    DisableAsset(10002022);
    SetEventFlagID(10001850, OFF);
    WaitFor(EventFlag(10003060) || EventFlag(10003366));
    DisableAsset(10002021);
    EnableAsset(10002022);
    SetEventFlagID(10001851, ON);
    EndEvent();
});

$Event(10009405, Restart, function() {
    WaitFixedTimeFrames(3);
    GotoIf(L1, IsHero(Hero.Wylder) && CurrentScenarioSection(ScenarioSection.Wylder));
    GotoIf(L2, IsHero(Hero.Guardian) && CurrentScenarioSection(ScenarioSection.Guardian));
    GotoIf(L3, IsHero(Hero.Ironeye) && CurrentScenarioSection(ScenarioSection.Ironeye));
    GotoIf(L4, IsHero(Hero.Duchess) && CurrentScenarioSection(ScenarioSection.Duchess));
    GotoIf(L5, IsHero(Hero.Raider) && CurrentScenarioSection(ScenarioSection.Raider));
    GotoIf(L6, IsHero(Hero.Revenant) && CurrentScenarioSection(ScenarioSection.Revenant));
    GotoIf(L7, IsHero(Hero.Recluse) && CurrentScenarioSection(ScenarioSection.Recluse));
    GotoIf(L8, IsHero(Hero.Executor) && CurrentScenarioSection(ScenarioSection.Executor));
    EndEvent();
L1:
    ClearSpEffect(10000, 9821);
    ClearSpEffect(10000, 9822);
    ClearSpEffect(10000, 9823);
    ClearSpEffect(10000, 9824);
    ClearSpEffect(10000, 9825);
    ClearSpEffect(10000, 9826);
    ClearSpEffect(10000, 9827);
    WaitFixedTimeFrames(1);
    SetSpEffect(10000, 9820);
    EndEvent();
L2:
    ClearSpEffect(10000, 9820);
    ClearSpEffect(10000, 9822);
    ClearSpEffect(10000, 9823);
    ClearSpEffect(10000, 9824);
    ClearSpEffect(10000, 9825);
    ClearSpEffect(10000, 9826);
    ClearSpEffect(10000, 9827);
    WaitFixedTimeFrames(1);
    SetSpEffect(10000, 9821);
    EndEvent();
L3:
    ClearSpEffect(10000, 9820);
    ClearSpEffect(10000, 9821);
    ClearSpEffect(10000, 9823);
    ClearSpEffect(10000, 9824);
    ClearSpEffect(10000, 9825);
    ClearSpEffect(10000, 9826);
    ClearSpEffect(10000, 9827);
    WaitFixedTimeFrames(1);
    SetSpEffect(10000, 9822);
    EndEvent();
L4:
    ClearSpEffect(10000, 9820);
    ClearSpEffect(10000, 9821);
    ClearSpEffect(10000, 9822);
    ClearSpEffect(10000, 9824);
    ClearSpEffect(10000, 9825);
    ClearSpEffect(10000, 9826);
    ClearSpEffect(10000, 9827);
    WaitFixedTimeFrames(1);
    SetSpEffect(10000, 9823);
    EndEvent();
L5:
    ClearSpEffect(10000, 9820);
    ClearSpEffect(10000, 9821);
    ClearSpEffect(10000, 9822);
    ClearSpEffect(10000, 9823);
    ClearSpEffect(10000, 9825);
    ClearSpEffect(10000, 9826);
    ClearSpEffect(10000, 9827);
    WaitFixedTimeFrames(1);
    SetSpEffect(10000, 9824);
    EndEvent();
L6:
    ClearSpEffect(10000, 9820);
    ClearSpEffect(10000, 9821);
    ClearSpEffect(10000, 9822);
    ClearSpEffect(10000, 9823);
    ClearSpEffect(10000, 9824);
    ClearSpEffect(10000, 9826);
    ClearSpEffect(10000, 9827);
    WaitFixedTimeFrames(1);
    SetSpEffect(10000, 9825);
    EndEvent();
L7:
    ClearSpEffect(10000, 9820);
    ClearSpEffect(10000, 9821);
    ClearSpEffect(10000, 9822);
    ClearSpEffect(10000, 9823);
    ClearSpEffect(10000, 9824);
    ClearSpEffect(10000, 9825);
    ClearSpEffect(10000, 9827);
    WaitFixedTimeFrames(1);
    SetSpEffect(10000, 9826);
    EndEvent();
L8:
    ClearSpEffect(10000, 9820);
    ClearSpEffect(10000, 9821);
    ClearSpEffect(10000, 9822);
    ClearSpEffect(10000, 9823);
    ClearSpEffect(10000, 9824);
    ClearSpEffect(10000, 9825);
    ClearSpEffect(10000, 9826);
    WaitFixedTimeFrames(1);
    SetSpEffect(10000, 9827);
    EndEvent();
});

$Event(100009380, Restart, function() {
    WaitFor(EventFlag(3709) && TalkNPCEnabled(10001701) && EventFlag(10003362));
    FadeToBlack(0, 0, true, 0);
    UnknownTalk2003120(9999);
    PlaySE(10001712, SoundType.EnvironmentalSound, 101200000);
    WaitFor(EventFlag(10003351));
    UnknownTalk2003121();
    WaitFixedTimeFrames(1);
    FadeToBlack(1, 1, true, 0);
    WaitFixedTimeSeconds(1);
    PlaySE(10001712, SoundType.EnvironmentalSound, 101190300);
    WarpCharacterAndSetFloor(10000, TargetEntityType.Area, 10003700, -1, 0, false);
    WarpCharacterAndSetFloor(10001701, TargetEntityType.Area, 10003701, -1, 0, false);
    ForceAnimationPlayback(10001701, 30016, true, false, false);
    SetCameraAngle(5.8, 156.35);
    ChangeCamera(1000000);
    DisableAsset(10002730);
    DisableAsset(10002732);
    ClearSpEffect(10000, 9707);
    WaitFixedTimeSeconds(7);
    FadeToBlack(0, 1, true, -1);
    SetEventFlagID(10003352, ON);
    WaitFor(!EventFlag(10003352));
    FadeToBlack(0, 0, false, -1);
    SetEventFlagID(10003351, OFF);
    SetEventFlagID(10003045, OFF);
    UnknownTalk2003120(0);
    ChangeCamera(-1);
    SetEventFlagID(1179131, ON);
    EndEvent();
});

$Event(100009381, Restart, function() {
    WaitFixedTimeFrames(3);
    DisableCharacter(10001710);
    DisableCharacterCollision(10001710);
    SetEventFlagID(10002311, ON);
    DisableAsset(10000550);
    if (!EventFlag(1179068)) {
        EnableCharacterImmortality(10001702);
        SetCharacterTalkRange(10001702, 80);
        EnableCharacter(10001710);
        SetSpEffect(10001710, 10124);
        DisableCharacterCollision(10001710);
        EnableCharacterInvincibility(10001710);
        SetEventFlagID(10003359, ON);
        WaitFor(EventFlag(10003353));
        EnableCharacterInvincibility(10001702);
        DisableCharacterCollision(10001702);
        SetEventFlagID(10002410, ON);
        ForceAnimationPlayback(10001702, 20047, false, false, false);
        DisableCharacterHPBarDisplay(10001702);
        WaitFixedTimeFrames(1);
        WaitFor(CharacterHasSpEffect(10001702, 9931));
        WarpCharacterAndCopyFloor(10001710, TargetEntityType.Character, 10001702, 3, 0);
        WaitFixedTimeFrames(1);
        ClearSpEffect(10001710, 10124);
        EnableCharacterCollision(10001710);
        ForceAnimationPlayback(10001710, 90200, false, false, false);
        EnableAsset(10000550);
        WarpAssetToCharacter(10000550, 10001702, 3);
        SetEventFlagID(10002311, OFF);
        SetEventFlagID(10002336, ON);
        WaitFixedTimeFrames(2);
        WaitFixedTimeSeconds(1);
        WaitFor(CharacterHasSpEffect(10001710, 9932));
        SetEventFlagID(10003354, ON);
        SetCharacterBackreadState(10001702, true);
        WaitFor(!EventFlag(10003354));
        SetEventFlagID(10003353, OFF);
        SetEventFlagID(1179068, ON);
        WaitFor(EventFlag(1179069));
        SetCharacterBackreadState(10001710, true);
        DisableCharacter(10001710);
        DisableAsset(10000550);
        SetEventFlagID(10002311, ON);
        SetEventFlagID(10002410, OFF);
        EndEvent();
    }
L0:
    DisableCharacter(10001702);
    SetCharacterBackreadState(10001702, true);
    SetEventFlagID(10002311, OFF);
    SetEventFlagID(10002336, ON);
    EnableCharacter(10001710);
    SetCharacterBackreadState(10001710, false);
    EnableCharacterImmortality(10001710);
    ClearSpEffect(10001710, 10124);
    EnableCharacterCollision(10001710);
    EnableAsset(10000550);
    WaitFor(EventFlag(1179069));
    SetCharacterBackreadState(10001710, true);
    DisableCharacter(10001710);
    DisableAsset(10000550);
    SetEventFlagID(10002311, ON);
    SetEventFlagID(10002410, OFF);
L1:
    EndEvent();
});

$Event(100009382, Restart, function() {
    DisableCharacter(10001703);
    SetCharacterBackreadState(10001703, true);
    WaitFor(EventFlag(1179035));
    EnableCharacter(10001703);
    SetCharacterBackreadState(10001703, false);
    if (!EventFlag(1179036)) {
        ForceAnimationPlayback(10001703, 30024, true, false, false);
        WaitFor(EventFlag(10003358));
        UnknownTalk2003121();
        UnknownTalk2003120(9999);
        FadeToBlack(0, 0, true, -1);
        RotateCharacter(10000, 10001703, -1, true);
        RotateCharacter(10000, 10001703, 90006, false);
        WaitFixedTimeFrames(1);
        ForceAnimationPlayback(10000, 0, false, false, false);
        SetEventFlagID(10003358, OFF);
        WaitFor(EventFlag(10003355));
        WaitFixedTimeSeconds(1);
        SetEventFlagID(10003355, OFF);
        WaitFor(EventFlag(1179036));
        FadeToBlack(0, 0, false, -1);
        UnknownTalk2003120(0);
        EndEvent();
    }
L0:
    EndEvent();
});

$Event(100009383, Restart, function() {
    WaitFixedTimeFrames(3);
    DisableAsset(10002700);
    SetCharacterBackreadState(10001711, true);
    WaitFixedTimeFrames(1);
    DisableCharacter(10001711);
    EndIf(EventFlag(1179071));
    WaitFor(
        CurrentScenarioSection(ScenarioSection.None)
            && IsHero(Hero.Recluse)
            && EventFlag(962)
            && AnyBatchEventFlags(3724, 3725));
    if (!(EventFlag(1179072) && !EventFlag(1179071))) {
        SetCharacterBackreadState(10001711, false);
        WaitFixedTimeFrames(1);
        EnableCharacter(10001711);
        WaitFor(EventFlag(10003357));
        WaitFixedTimeFrames(1);
        SetEventFlagID(10003361, ON);
        WaitFor(CharacterHasSpEffect(10001711, 9935));
        DisableCharacterCollision(10001711);
        EnableAsset(10002700);
        ForceAnimationPlayback(10002700, 1, true, false, false);
        WaitFixedTimeFrames(1);
        WaitFor(CharacterHasSpEffect(10001711, 9933));
        SetEventFlagID(10003357, OFF);
        WaitFixedTimeFrames(1);
        WaitFor(CharacterHasSpEffect(10001711, 9934));
        DisableCharacter(10001711);
        SetCharacterBackreadState(10001711, true);
        SetEventFlagID(10003361, OFF);
        SetEventFlagID(1179072, ON);
        EndEvent();
    }
L10:
    UnknownSound201014(7);
    EndEvent();
});

$Event(100009384, Restart, function() {
    WaitFor(AssetHitBy(10000550, 20000));
    WaitFor(HasDamageType(10000550, 20000, DamageType.Any));
    CreateAssetfollowingSFX(10000550, 200, 121);
    WaitFor(ElapsedSeconds(3));
    DeleteAssetfollowingSFX(10000550, true);
    RestartEvent();
});

$Event(100009385, Restart, function() {
    WaitFor(TalkNPCEnabled(10001701));
    if (EventFlag(1179037)) {
        if (!EventFlag(1179038)) {
            ForceAnimationPlayback(10001701, 30014, true, false, false);
            SetEventFlagID(1179038, ON);
            EndEvent();
        }
    }
L1:
    SetEventFlagID(1179038, OFF);
    if (!EventFlag(1179039)) {
        ForceAnimationPlayback(10001701, 30015, true, false, false);
        SetEventFlagID(1179039, ON);
        EndEvent();
    }
    ForceAnimationPlayback(10001701, 30019, true, false, false);
    SetEventFlagID(1179039, OFF);
    EndEvent();
});

$Event(100009386, Restart, function() {
    WaitFixedTimeFrames(3);
    WaitFor(
        IsHero(Hero.Recluse)
            && AnyBatchEventFlags(3724, 3726)
            && CurrentScenarioSection(ScenarioSection.None));
    WaitFixedTimeFrames(1);
    EndIf(EventFlag(1179070));
    if (EventFlag(1179072)) {
        EnableAsset(10002700);
        ForceAnimationPlayback(10002700, 1, false, false, false);
        ReproduceAssetAnimation(10002700, 1);
    }
    WaitFor(EventFlag(1179072));
    WaitFixedTimeFrames(1);
    WaitFor(ActionButtonInArea(6951, 10002700));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    WaitFixedTimeFrames(1);
    ChangeAssetEnableStateUnknown200510(10002700, Disabled, 1);
    AwardItemLot(105030);
    SetEventFlagID(1179070, ON);
    SetEventFlagID(1179071, ON);
    SaveRequest();
    WaitFixedTimeSeconds(1);
    FadeToBlack(0, 1, false, -1);
    UnknownTalk2003120(0);
});

$Event(100009387, Restart, function() {
    WaitFor(TalkNPCEnabled(10001703) && IsHero(Hero.Recluse));
    WaitFixedTimeFrames(1);
    WaitFor(EventFlag(10003360));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    WaitFixedTimeSeconds(1);
    WaitFor(!EventFlag(10003360));
    UnknownTalk2003120(0);
    FadeToBlack(0, 0, false, -1);
});

$Event(100009388, Restart, function() {
    WaitFixedTimeFrames(3);
    DisableAsset(10002730);
    DisableAsset(10002732);
    ChangeAssetEnableStateUnknown200510(10002730, Disabled, 0);
    EndIf(EventFlag(1179131));
    WaitFor(
        IsHero(Hero.Recluse)
            && AnyBatchEventFlags(3707, 3710)
            && CurrentScenarioSection(ScenarioSection.Recluse));
    WaitFixedTimeFrames(1);
    if (!EventFlag(1179130)) {
        WaitFor(EventFlag(10003367));
        SetEventFlagID(1179130, ON);
        DisplayNetworkconnectedPermanentBuffPopup(107);
        WaitFor(EventFlag(10003364) || ElapsedSeconds(6));
        EnableAsset(10002730);
        ChangeAssetEnableStateUnknown200510(10002730, Enabled, 2);
        EnableAsset(10002732);
        DisplayGenericDialog(70030, PromptType.YESNO, NumberofOptions.NoButtons, 0, 5);
        EndEvent();
    }
L1:
    EnableAsset(10002730);
    ChangeAssetEnableStateUnknown200510(10002730, Enabled, 0);
    EnableAsset(10002732);
});

$Event(100009389, Restart, function() {
    WaitFixedTimeFrames(3);
    ClearSpEffect(10001713, 9753);
    WaitFor(TalkNPCEnabled(10001713));
    EndIf(EventFlag(1179040));
    SetSpEffect(10001713, 9753);
    SetNetworkUpdateRate(10001713, true, CharacterUpdateFrequency.AtLeastEvery2Frames);
    SetCharacterMaphit(10001713, false);
    DisableCharacterGravity(10001713);
    WaitFixedTimeFrames(1);
    ResetCharacterPosition(10001713);
    WaitFor(EventFlag(1179040));
    ClearSpEffect(10001713, 9753);
    SetNetworkUpdateRate(10001713, false, CharacterUpdateFrequency.NoUpdate);
});

$Event(10009470, Restart, function() {
    WaitFixedTimeFrames(3);
    WaitFor(EventFlag(10003365));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    SetEventFlagID(10001851, ON);
    WaitFixedTimeSeconds(2);
    PlaySE(10002021, SoundType.EnvironmentalSound, 101190100);
    WaitFixedTimeSeconds(9);
    DisplayGenericDialogAndSetEventFlags(70040, PromptType.YESNO, NumberofOptions.NoButtons, 0, 5, 10003366, 10003366, 10003366);
    WaitFor(EventFlag(10003366));
    FadeToBlack(0, 0, false, -1);
    UnknownTalk2003120(0);
    SetEventFlagID(10003361, OFF);
});

$Event(10009471, Restart, function() {
    WaitFixedTimeFrames(3);
    DisableAssetInvunerability(10002701);
    WaitFor(TalkNPCEnabled(10001700));
    WaitFixedTimeFrames(1);
    EnableAssetInvunerability(10002701);
    WaitFixedTimeFrames(1);
    WaitFor(EventFlag(10003368));
    DisableCharacterAI(10001700);
    WaitFor(CharacterHasSpEffect(10001700, 9932));
    WaitFixedTimeSeconds(0.2);
    RequestCharacterAIReplan(10001700);
    EnableCharacterAI(10001700);
    SetSpEffect(10001700, 9957);
});

$Event(10009472, Restart, function() {
    WaitFixedTimeFrames(3);
    flag = CurrentScenarioSection(ScenarioSection.Recluse) && (EventFlag(3707) || EventFlag(3727));
    EndIf(!flag);
    WaitFor(flag);
    IssueShortWarpRequest(10000, TargetEntityType.Area, 10003006, -1);
    SetCameraAngle(19.5, -61.67);
    EndEvent();
});

$Event(10009473, Restart, function() {
    EndIf(EventFlag(1179040));
    WaitFixedTimeFrames(1);
    WaitFor(
        (CurrentScenarioSection(ScenarioSection.Recluse) && TalkNPCEnabled(10001713))
            && (EventFlag(3707) || EventFlag(3727)));
    WaitFor(EntityInRadiusOfEntity(10000, 10001713, 2.5, 1) || EventFlag(1179040));
    EndIf(EventFlag(1179040));
    SetEventFlagID(10003045, ON);
    WaitFor(!EntityInRadiusOfEntity(10000, 10001713, 3, 1) || EventFlag(1179040));
    SetEventFlagID(10003045, OFF);
    EndIf(EventFlag(1179040));
    RestartEvent();
});

$Event(10009474, Restart, function() {
    WaitFixedTimeFrames(3);
    WaitFor(
        IsHero(Hero.Recluse)
            && CurrentScenarioSection(ScenarioSection.Recluse)
            && TalkNPCEnabled(10001702));
    if (!EventFlag(1179068)) {
        WaitFor(!EventFlag(10003353) && CharacterHasSpEffect(10001702, 1673034));
        SetEventFlagID(10003353, ON);
        EndEvent();
    }
L0:
    EndEvent();
});

$Event(100009390, Restart, function() {
    WaitFixedTimeFrames(3);
    WaitFor(
        IsHero(Hero.Executor)
            && CurrentScenarioSection(ScenarioSection.Executor)
            && TalkNPCEnabled(10001807));
    EnableCharacter(10001807);
    SetCharacterBackreadState(10001807, false);
    DisableCharacterCollision(10001807);
    SetSpEffect(10001807, 10124);
    EndIf(EventFlag(1189050));
    WaitFixedTimeFrames(1);
    WaitFor(EventFlag(10003405));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    SetSpEffect(10000, 9827);
    WaitFixedTimeFrames(20);
    ForceAnimationPlayback(10000, 90305, false, false, false);
    WaitFixedTimeFrames(1);
    IssueShortWarpRequest(10000, TargetEntityType.Area, 10003801, -1);
    WaitFor(CharacterHasSpEffect(10000, 9948));
    WaitFixedTimeSeconds(1);
    ClearSpEffect(10001807, 10124);
    WaitFixedTimeFrames(1);
    SetEventFlagID(10003406, ON);
    WaitFor(!EventFlag(10003406));
    SetSpEffect(10001807, 10124);
    WaitFixedTimeSeconds(1);
    ForceAnimationPlayback(10000, 90307, false, false, false);
    WaitFixedTimeFrames(1);
    ClearSpEffect(10000, 9827);
    WaitFor(CharacterHasSpEffect(10000, 9949));
    FadeToBlack(0, 0, false, -1);
    WaitFor(!CharacterHasSpEffect(10000, 9624));
    SetEventFlagID(10003405, OFF);
    UnknownTalk2003120(0);
    EndEvent();
});

$Event(100009391, Restart, function() {
    WaitFor(TalkNPCEnabled(10001802));
    WaitFixedTimeFrames(1);
L0:
    SetEventFlagID(10003410, OFF);
    WaitFor(EventFlag(10003401) || EventFlag(10003402));
    GotoIf(L1, EventFlag(10003401));
    GotoIf(L2, EventFlag(10003402));
    EndEvent();
L1:
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    RotateCharacter(10000, 10002724, -1, true);
    ForceAnimationPlayback(10001802, 90315, true, false, false);
    WaitFixedTimeSeconds(1);
    SpawnOneshotSFX(TargetEntityType.Area, 10002724, -1, 807360);
    WaitFixedTimeSeconds(6.5);
    SetEventFlagID(10003401, OFF);
    WaitFor(EventFlag(10003410));
    if (MissionProgress(801) <= 1) {
        SetEventFlagID(1189032, ON);
    } else if (MissionProgress(801) <= 2) {
        SetEventFlagID(1189033, ON);
    } else if (MissionProgress(801) <= 3) {
        SetEventFlagID(1189034, ON);
    } else {
        SetEventFlagID(1189035, ON);
    }
L10:
    FadeToBlack(0, 0, false, -1);
    UnknownTalk2003120(0);
    Goto(L0);
L2:
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    RotateCharacter(10000, 10002724, -1, true);
    ForceAnimationPlayback(10001802, 90315, true, false, false);
    WaitFixedTimeSeconds(1);
    SpawnOneshotSFX(TargetEntityType.Area, 10002724, -1, 807360);
    WaitFixedTimeSeconds(6.5);
    SetEventFlagID(10003402, OFF);
    WaitFor(EventFlag(10003410));
    FadeToBlack(0, 0, false, -1);
    UnknownTalk2003120(0);
    Goto(L0);
});

$Event(100009392, Restart, function() {
    WaitFor(EventFlag(10003411));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    WaitFixedTimeFrames(1);
    SetSpEffect(10000, 9827);
    WaitFor(EventFlag(10003403));
    RotateCharacter(10000, 10002724, -1, true);
    RotateCharacter(10000, 10002724, 90106, false);
    SetEventFlagID(10003403, OFF);
    SpawnOneshotSFX(TargetEntityType.Area, 10002724, -1, 807370);
    PlaySE(10002724, SoundType.SFX, 807370);
    WaitFixedTimeSeconds(7);
    FadeToBlack(0, 1.5, true, -1);
    PlaySE(10000, SoundType.EnvironmentalSound, 999990080);
    WaitFixedTimeSeconds(2.5);
    WarpPlayerToScenarioBattle(13, 0, 0, 0, 0, 0);
});

$Event(100009393, Restart, function() {
    WaitFixedTimeFrames(3);
    EnableAsset(10002025);
    DisableAsset(10002815);
    WaitFixedTimeFrames(1);
    EndIf(EventFlag(1189029));
    WaitFor(EventFlag(1189056) && EventFlag(3823) && TalkNPCEnabled(10001804));
    DisableAsset(10002025);
    EnableAsset(10002815);
    EnableAssetInvunerability(10002815);
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(1, 0, true, -1);
    ChangeHeroCharacter(10000, 50730);
    SetEventFlagID(10003045, ON);
    SuppressSE(SoundType.BGM, 0, true);
    SetEventFlagID(10002060, ON);
    SetEventFlagID(9021, ON);
    SetSpEffect(10000, 9827);
    WaitFixedTimeFrames(20);
    ForceAnimationPlayback(10000, 90103, false, false, false);
    WaitFixedTimeFrames(1);
    WarpCharacterAndSetFloor(10000, TargetEntityType.Area, 10003800, -1, 0, false);
    WarpCharacterAndSetFloor(10001804, TargetEntityType.Area, 10003810, -1, 0, false);
    SetCameraAngle(7.43, 116.68);
    WaitFixedTimeSeconds(2);
    UnknownSound201014(8);
    WaitFixedTimeSeconds(2);
    FadeToBlack(0, 3, true, -1);
    WaitFixedTimeSeconds(3);
    ForceAnimationPlayback(10000, 90203, false, false, false);
    WaitFor(CharacterHasSpEffect(10000, 9951));
    SuppressSE(SoundType.BGM, 0, false);
    SetEventFlagID(10002060, OFF);
    SetEventFlagID(9021, OFF);
    SetEventFlagID(10003404, ON);
    WaitFixedTimeFrames(1);
    WaitFor(!EventFlag(10003404));
    ForceAnimationPlayback(10000, 90204, false, false, false);
    WaitFixedTimeFrames(1);
    WaitFor(CharacterHasSpEffect(10000, 9952));
    ChangeHeroGarbMenuSelection(Hero.Executor, 50730);
    FadeToBlack(0, 0, false, -1);
    SetEventFlagID(10003045, OFF);
    UnknownTalk2003120(0);
    EndEvent();
});

$Event(100009394, Restart, function() {
    EndIf(EventFlag(1189029));
    WaitFor(EventFlag(1189056) && EventFlag(3823) && TalkNPCEnabled(10001804));
    SuppressSE(SoundType.BGM, 0, true);
    SetEventFlagID(10002060, ON);
});

$Event(100009396, Restart, function() {
    GotoIf(L1, MissionProgress(801) == 1);
    GotoIf(L2, MissionProgress(801) == 2);
    GotoIf(L3, MissionProgress(801) == 3);
    GotoIf(L4, MissionProgress(801) == 4);
    EndEvent();
L1:
    if (!EventFlag(1189032)) {
        SetEventFlagID(10003400, ON);
    }
    EndEvent();
L2:
    if (!EventFlag(1189033)) {
        SetEventFlagID(10003400, ON);
    }
    EndEvent();
L3:
    if (!EventFlag(1189034)) {
        SetEventFlagID(10003400, ON);
    }
    EndEvent();
L4:
    if (!EventFlag(1189035)) {
        SetEventFlagID(10003400, ON);
    }
    EndEvent();
});

$Event(100009397, Restart, function() {
    WaitFixedTimeFrames(3);
    EndIf(!CurrentScenarioSection(ScenarioSection.Executor));
    WaitFor(EventFlag(1189056) && TalkNPCEnabled(10001806));
    if (EventFlag(1189043)) {
        ForceAnimationPlayback(10001806, 30016, true, false, false);
    }
    if (TalkNPCEnabled(10001804)) {
        IssueShortWarpRequest(10001804, TargetEntityType.Area, 10003810, -1);
    }
});

$Event(100009398, Restart, function() {
    WaitFixedTimeFrames(3);
    SetEventFlagID(1189058, OFF);
});

$Event(100005001, Restart, function() {
    WaitFixedTimeFrames(3);
    EndIf(
        !(CurrentScenarioSection(ScenarioSection.Raider)
            && IsHero(Hero.Raider)
            && AnyBatchEventFlags(3517, 3518)
            && EventFlag(1159084)));
    WarpCharacterAndCopyFloor(10000, TargetEntityType.Area, 10004000, -1, 0);
    SetCameraAngle(0, -180);
});

$Event(100005002, Restart, function() {
    WaitFixedTimeFrames(3);
    if (TalkNPCEnabled(10001510)) {
        DisableCharacterGravity(10001510);
        SetCharacterMaphit(10001510, false);
        WaitFixedTimeFrames(1);
        ResetCharacterPosition(10001510);
    }
    WaitFor(EventFlag(10003250));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    WaitFixedTimeFrames(1);
    SetEventFlagID(10003250, OFF);
    RotateCharacter(10000, 10003513, -1, true);
    RotateCharacter(10000, 10003513, 90006, false);
    WaitFixedTimeFrames(1);
    RotateCharacter(10000, 10003513, 60490, false);
    WaitFixedTimeSeconds(0.3);
    SpawnOneshotSFX(TargetEntityType.Area, 10003518, -1, 807381);
    PlaySE(10000, SoundType.EnvironmentalSound, 101190120);
    WaitFixedTimeSeconds(1);
    FadeToBlack(1, 1.5, true, -1);
    PlaySE(10003513, SoundType.EnvironmentalSound, 999990050);
    WaitFixedTimeSeconds(2.5);
    WarpPlayerToScenarioBattle(13, 20, 0, 0, 0, 0);
    EndEvent();
});

$Event(100005003, Restart, function() {
    WaitFixedTimeFrames(3);
    if (TalkNPCEnabled(10001511)) {
        DisableCharacterGravity(10001511);
        SetCharacterMaphit(10001511, false);
        WaitFixedTimeFrames(1);
        ResetCharacterPosition(10001511);
    }
    if (!EventFlag(1159042)) {
        ForceAnimationPlayback(10001501, 90306, true, false, false);
    }
    WaitFor(EventFlag(10003251));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    SetEventFlagID(10003251, OFF);
    FadeToBlack(0, 0, true, -1);
    RotateCharacter(10000, 10003513, -1, true);
    RotateCharacter(10000, 10003513, 90006, false);
    WaitFixedTimeFrames(1);
    RotateCharacter(10000, 10003513, 60490, false);
    WaitFixedTimeSeconds(0.3);
    SpawnOneshotSFX(TargetEntityType.Area, 10003518, -1, 807381);
    PlaySE(10000, SoundType.EnvironmentalSound, 101190120);
    WaitFixedTimeSeconds(1);
    FadeToBlack(1, 1.5, true, -1);
    PlaySE(10003513, SoundType.EnvironmentalSound, 999990051);
    WaitFixedTimeSeconds(2.5);
    WarpPlayerToScenarioBattle(13, 20, 0, 0, 0, 0);
    EndEvent();
});

$Event(100005004, Restart, function() {
    WaitFor(
        EventFlag(3517)
            && IsHero(Hero.Raider)
            && CurrentScenarioSection(ScenarioSection.Raider)
            && InArea(10000, 10003511));
    SetEventFlagID(10003255, ON);
    WaitFor(!EventFlag(10003255));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    WaitFixedTimeFrames(1);
    DisplayGenericDialog(70010, PromptType.YESNO, NumberofOptions.NoButtons, 0, 100);
    PlaySE(10000, SoundType.EnvironmentalSound, 101190080);
    WaitFixedTimeSeconds(4);
    SetEventFlagID(1159084, ON);
    FadeToBlack(0, 0, true, -1);
    WaitFixedTimeFrames(1);
    FadeToBlack(1, 2, true, -1);
    WaitFixedTimeSeconds(4);
    PlaySE(10003511, SoundType.EnvironmentalSound, 999990052);
    WaitFixedTimeSeconds(2);
    WarpPlayerToScenarioBattle(13, 20, 0, 0, 0, 0);
});

$Event(100005005, Restart, function() {
    WaitFixedTimeFrames(3);
    if (TalkNPCEnabled(10001512)) {
        DisableCharacterGravity(10001512);
        SetCharacterMaphit(10001512, false);
        WaitFixedTimeFrames(1);
        ResetCharacterPosition(10001512);
    }
    WaitFor(EventFlag(10003252));
    SetEventFlagID(10003252, OFF);
    WarpPlayerToScenarioBattle(13, 20, 0, 0, 0, 0);
    EndEvent();
});

$Event(100005006, Restart, function() {
    WaitFor(EventFlag(1159086));
    WaitFor(IsHero(Hero.Raider));
    WarpCharacterAndCopyFloor(10000, TargetEntityType.Area, 10003510, -1, 0);
    WaitFixedTimeFrames(1);
    SetEventFlagID(1159086, OFF);
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(1, 0, true, -1);
    WaitFixedTimeSeconds(2);
    FadeToBlack(0, 3, false, -1);
    SuppressSE(SoundType.BGM, 0, false);
    WaitFixedTimeSeconds(3);
    UnknownTalk2003120(0);
});

$Event(100005007, Restart, function() {
    if (CurrentScenarioSection(ScenarioSection.Raider) && TalkNPCEnabled(10001505) && EventFlag(3520)) {
        SetEventFlagID(1009521, OFF);
        SetEventFlagID(1159052, OFF);
        SetEventFlagID(1159053, OFF);
    }
    WaitFor(EventFlag(10003253));
    SetSpEffect(10000, 9824);
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    WaitFixedTimeFrames(1);
    FadeToBlack(1, 1, true, -1);
    PlaySE(10000, SoundType.EnvironmentalSound, 999990053);
    WaitFixedTimeSeconds(1);
    IssueShortWarpRequest(10000, TargetEntityType.Area, 10003512, -1);
    DisableAsset(10002510);
    EnableAsset(10002511);
    SetCameraAngle(14.26, -150.04);
    IssueShortWarpRequest(10001505, TargetEntityType.Area, 10003515, -1);
    IssueShortWarpRequest(10001502, TargetEntityType.Area, 10003516, -1);
    ChangeHeroCharacter(10000, 50400);
    ForceAnimationPlayback(10000, 61020, false, false, false);
    PlaySE(10000, SoundType.EnvironmentalSound, 101190121);
    WaitFixedTimeSeconds(4);
    FadeToBlack(0, 1, false, -1);
    PlaySE(10000, SoundType.EnvironmentalSound, 999990058);
    UnknownTalk2003120(0);
    WaitFor(ActionButtonInArea(6971, 10002520));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    ChangeCamera(1000000);
    WaitFixedTimeFrames(1);
    FadeToBlack(0, 0, true, -1);
    ForceAnimationPlayback(10000, 90205, false, false, false);
    IssueShortWarpRequest(10000, TargetEntityType.Area, 10003517, -1);
    WaitFixedTimeFrames(1);
    WaitFor(CharacterHasSpEffect(10000, 9938));
    FadeToBlack(1, 1, true, -1);
    WaitFixedTimeSeconds(1);
    SetCameraAngle(12.27, -147.37);
    EnableAsset(10002510);
    DisableAsset(10002511);
    ChangeHeroCharacter(10000, 50430);
    PlaySE(10000, SoundType.EnvironmentalSound, 101190122);
    IssueShortWarpRequest(10000, TargetEntityType.Area, 10003519, -1);
    WaitFixedTimeSeconds(1);
    UnknownSound201014(5);
    WaitFixedTimeSeconds(1);
    ForceAnimationPlayback(10000, 90208, true, false, false);
    WaitFixedTimeFrames(5);
    ClearSpEffect(10000, 9824);
    FadeToBlack(0, 1, true, -1);
    WaitFixedTimeSeconds(1);
    SetEventFlagID(10003254, ON);
    WaitFor(CharacterHasSpEffect(10000, 9939));
    WaitFor(!EventFlag(10003254));
    FadeToBlack(0, 0, false, -1);
    SetEventFlagID(10003253, OFF);
    ChangeHeroGarbMenuSelection(Hero.Raider, 50430);
    UnknownTalk2003120(0);
    ChangeCamera(-1);
    EndEvent();
});

$Event(100005008, Restart, function() {
    WaitFixedTimeFrames(3);
    EndIf(EventFlag(1159042));
    WaitFor(EventFlag(1159042));
    ForceAnimationPlayback(10001501, 90307, true, false, false);
});

$Event(100005009, Restart, function() {
    WaitFixedTimeFrames(3);
    EndIf(
        !(CurrentScenarioSection(ScenarioSection.Raider)
            && IsHero(Hero.Raider)
            && AnyBatchEventFlags(3521, 3522)));
    IssueShortWarpRequest(10001505, TargetEntityType.Area, 10003515, -1);
    IssueShortWarpRequest(10001502, TargetEntityType.Area, 10003516, -1);
});

$Event(100006001, Restart, function() {
    WaitFor(TalkNPCEnabled(10001610));
    WaitFor(EventFlag(10003300));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    WaitFor(EventFlag(10003301));
    FadeToBlack(0, 0, true, -1);
    WaitFixedTimeFrames(1);
    FadeToBlack(1, 1, true, -1);
    WaitFixedTimeSeconds(1);
    PlaySE(10001610, SoundType.EnvironmentalSound, 101190040);
    SetEventFlagID(1169090, OFF);
    SetSpEffect(10000, 9825);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000, 90341, true, false, false);
    IssueShortWarpRequest(10000, TargetEntityType.Area, 10003602, -1);
    WaitFixedTimeSeconds(1);
    ForceAnimationPlayback(10001610, 30028, true, false, false);
    SetCameraAngle(17.47, 150.26);
    WaitFixedTimeFrames(5);
    FadeToBlack(0, 1, true, -1);
    WaitFixedTimeSeconds(1);
    SetEventFlagID(10003301, OFF);
    WaitFixedTimeSeconds(1);
    ForceAnimationPlayback(10000, 90342, true, false, false);
    WaitFixedTimeFrames(1);
    ClearSpEffect(10000, 9825);
    WaitFor(!EventFlag(10003300));
    FadeToBlack(0, 0, false, -1);
    UnknownTalk2003120(0);
    EndEvent();
});

$Event(100006002, Restart, function() {
    WaitFor(TalkNPCEnabled(10001607));
    WaitFor(EventFlag(10003302));
    SetEventFlagID(1169042, OFF);
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    WaitFixedTimeSeconds(0.1);
    if (!EventFlag(1169050)) {
        SetSpEffect(10000, 9825);
        WaitFixedTimeSeconds(0.1);
        ForceAnimationPlayback(10000, 90305, true, false, false);
        IssueShortWarpRequest(10000, TargetEntityType.Area, 10003603, -1);
        RotateCharacter(10001607, 10001620, 90300, false);
        WaitFor(CharacterHasSpEffect(10000, 9931));
        SetEventFlagID(10003303, ON);
        WaitFor(EventFlag(1169042) || ElapsedSeconds(1));
        FadeToBlack(1, 2, true, -1);
        PlaySE(10003603, SoundType.EnvironmentalSound, 999990060);
        WaitFixedTimeSeconds(8);
        WaitFor(!EventFlag(10003303));
    }
L0:
    WarpPlayerToScenarioBattle(15, 0, 0, 0, 0, 0);
});

$Event(100006004, Restart, function() {
    WaitFor(TalkNPCEnabled(10001608));
    WaitFor(EventFlag(10003304));
    SetEventFlagID(1169046, OFF);
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    FadeToBlack(0, 0, true, -1);
    WaitFixedTimeSeconds(0.1);
    if (!EventFlag(1169051)) {
        SetSpEffect(10000, 9825);
        WaitFixedTimeSeconds(0.1);
        ForceAnimationPlayback(10000, 90305, true, false, false);
        IssueShortWarpRequest(10000, TargetEntityType.Area, 10003603, -1);
        RotateCharacter(10001608, 10001621, 90300, false);
        WaitFor(CharacterHasSpEffect(10000, 9931));
        SetEventFlagID(10003305, ON);
        WaitFor(EventFlag(1169046) || ElapsedSeconds(1));
        FadeToBlack(1, 0.7, true, -1);
        PlaySE(10003603, SoundType.EnvironmentalSound, 999990061);
        WaitFixedTimeSeconds(8);
        WaitFor(!EventFlag(10003305));
    }
L0:
    WarpPlayerToScenarioBattle(15, 0, 0, 0, 0, 0);
});

$Event(100006003, Restart, function() {
    EndIf(!EventFlag(1169070));
    WaitFor(
        EventFlag(1169070)
            && IsHero(Hero.Revenant)
            && CurrentScenarioSection(ScenarioSection.Revenant));
    UnknownTalk2003121();
    UnknownTalk2003120(9999);
    GotoIf(L1, EventFlag(3615));
    GotoIf(L2, EventFlag(3616));
    GotoIf(L1, EventFlag(3619));
    GotoIf(L3, EventFlag(3620));
    GotoIf(L10, EventFlag(3617));
    GotoIf(L10, EventFlag(3621));
    WaitFixedTimeFrames(1);
    UnknownTalk2003120(0);
    EndEvent();
L1:
    FadeToBlack(1, 0, true, -1);
    WarpCharacterAndCopyFloor(10000, TargetEntityType.Area, 10003601, -1, 0);
    SetCameraAngle(8.38, -4.7);
    WaitFixedTimeFrames(1);
    FadeToBlack(0, 1, true, -1);
    WaitFixedTimeSeconds(1);
    FadeToBlack(0, 0, false, -1);
    Goto(L10);
L2:
    SetSpEffect(10000, 9825);
    WaitFixedTimeFrames(1);
    FadeToBlack(1, 0, true, -1);
    WarpCharacterAndCopyFloor(10000, TargetEntityType.Area, 10003601, -1, 0);
    SetCameraAngle(8.38, -4.7);
    SuppressSE(SoundType.BGM, 0, true);
    SetEventFlagID(10002060, ON);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000, 90306, true, false, false);
    WaitFixedTimeSeconds(2);
    RotateCharacter(10001607, 10000, 90300, false);
    WaitFixedTimeSeconds(2);
    FadeToBlack(0, 2, true, -1);
    WaitFixedTimeSeconds(2);
    SuppressSE(SoundType.BGM, 0, false);
    SetEventFlagID(10002060, OFF);
    SetEventFlagID(9021, OFF);
    ForceAnimationPlayback(10000, 90307, true, false, false);
    sp &= CharacterHasSpEffect(10000, 9932);
    WaitFor(sp);
    ClearSpEffect(10000, 9825);
    WaitFixedTimeSeconds(0.5);
    FadeToBlack(0, 0, false, -1);
    SetEventFlagID(1169073, ON);
    Goto(L10);
L3:
    SetSpEffect(10000, 9825);
    SuppressSE(SoundType.BGM, 0, true);
    SetEventFlagID(10002060, ON);
    SetEventFlagID(10003310, ON);
    WaitFixedTimeFrames(1);
    FadeToBlack(1, 0, true, -1);
    WarpCharacterAndCopyFloor(10000, TargetEntityType.Area, 10003607, -1, 0);
    DisableCharacterCollision(10001608);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10001608, 90103, true, false, false);
    IssueShortWarpRequest(10001608, TargetEntityType.Area, 10003604, -1);
    SetCameraAngle(8.38, -4.7);
    ChangeCamera(1000000);
    WaitFixedTimeFrames(1);
    ForceAnimationPlayback(10000, 90103, true, false, false);
    WaitFixedTimeSeconds(3);
    SetEventFlagID(10003306, ON);
    UnknownSound201014(6);
    FadeToBlack(0, 2, true, -1);
    SuppressSE(SoundType.BGM, 0, false);
    SetEventFlagID(10002060, OFF);
    SetEventFlagID(9021, OFF);
    WaitFixedTimeSeconds(2);
    ForceAnimationPlayback(10000, 90315, true, false, false);
    sp &= CharacterHasSpEffect(10000, 9933);
    WaitFor(sp);
    WaitFixedTimeSeconds(5.5);
    SetEventFlagID(10003307, ON);
    SetEventFlagID(10003310, OFF);
    WaitFixedTimeSeconds(0.3);
    SetEventFlagID(10003310, ON);
    WaitFor(!EventFlag(10003307));
    ForceAnimationPlayback(10000, 90317, true, false, false);
    WaitFixedTimeFrames(1);
    WaitFor(CharacterHasSpEffect(10000, 9932));
    ClearSpEffect(10000, 9825);
    WaitFixedTimeSeconds(0.5);
    FadeToBlack(0, 0, false, -1);
    SetEventFlagID(10003306, OFF);
    SetEventFlagID(10003310, OFF);
    Goto(L10);
L10:
    SetEventFlagID(1169070, OFF);
    UnknownTalk2003120(0);
    ChangeCamera(-1);
    WaitFixedTimeSeconds(2);
    EnableCharacterCollision(10001608);
    EndEvent();
});

$Event(100006005, Restart, function(eventFlagId, areaEntityId, areaEntityId2) {
    WaitFor(IsHero(Hero.Revenant) && EventFlag(3608));
    if (!EventFlag(eventFlagId)) {
        WaitFor(InArea(10000, areaEntityId));
        SetEventFlagID(eventFlagId, ON);
    }
L0:
    WaitFor(!InArea(10000, areaEntityId) && !InArea(10000, areaEntityId2));
    SetEventFlagID(eventFlagId, OFF);
    RestartEvent();
});

$Event(100006006, Restart, function() {
    WaitFixedTimeFrames(3);
    if (CurrentScenarioSection(ScenarioSection.Revenant) && IsHero(Hero.Revenant) && EventFlag(3621)) {
        ForceAnimationPlayback(10001608, 90103, true, false, false);
        IssueShortWarpRequest(10001608, TargetEntityType.Area, 10003604, -1);
    }
});
