From fe2f7f944eb90bcbad53a1d9b86f2d09025f2217 Mon Sep 17 00:00:00 2001 From: wushin Date: Mon, 20 Oct 2014 23:08:32 -0500 Subject: Reset barriers if barrier color 0 closes #180 --- world/map/npc/009-4/barriers.txt | 11 ++++- world/map/npc/009-4/orum.txt | 99 +++++++++++++++++++++++++++------------- world/map/npc/009-4/torches.txt | 1 - 3 files changed, 77 insertions(+), 34 deletions(-) diff --git a/world/map/npc/009-4/barriers.txt b/world/map/npc/009-4/barriers.txt index f3f2e085..ae960d97 100644 --- a/world/map/npc/009-4/barriers.txt +++ b/world/map/npc/009-4/barriers.txt @@ -1,8 +1,13 @@ //# see detailed description at orum.txt function|script|GetBarrierColor|, { - if (@Barrier < 0 || @Barrier > 2) goto L_Error; + if (@Barrier < 0 || @Barrier > 2) + goto L_Error; + if (@BarrierColor <= 0 || @BarrierColor > 12) + goto L_Error2; + goto L_GetBarrierColor; +L_GetBarrierColor: set @Mask, 15; set @Shift, 4 * @Barrier; set @BarrierColor, (OrumQuestBarrier >> @Shift) & @Mask; @@ -11,6 +16,10 @@ function|script|GetBarrierColor|, L_Error: mes "Barrier number is out of range."; close; + +L_Error2: + callfunc "SetUpOrumQuest"; + goto L_GetBarrierColor; } function|script|SetBarrierColor|, diff --git a/world/map/npc/009-4/orum.txt b/world/map/npc/009-4/orum.txt index 2b222255..c547af05 100644 --- a/world/map/npc/009-4/orum.txt +++ b/world/map/npc/009-4/orum.txt @@ -18,6 +18,37 @@ //# OrumQuestBarrier nibble (0,1,2) stores the color of the barriers # //################################################################################# +009-4.gat,35,115,0|script|OrumDebug|158, +{ + mes "[Orum Debug]"; + menu + "Set Quest State", L_SetQuest, + "Reset Quest", L_ResetQuest, + "Display Quest", L_Display; + +L_SetQuest: + input @quest_state; + set OrumQuest, @quest_state; + goto L_Close; + +L_ResetQuest: + set OrumQuest, 0; + set OrumQuestBarrier, 0; + set OrumQuestTorch, 0; + goto L_Close; + +L_Display: + mes OrumQuest; + goto L_Close; + +L_Close: + end; + +OnInit: + if (!debug) + disablenpc "OrumDebug"; + end; +} 009-4.gat,37,115,0|script|Orum#barrier|158, { // needed to pass the very first barrier @@ -221,38 +252,7 @@ L_Missing_Materials: L_Setup_Lair: set OrumQuest, 2; - - // Second Barrier - set @BarrierColor, 1 + rand(3) * 4; - set @Barrier, 0; - callfunc "SetBarrierColor"; - - set @TorchIntensity, 0; - - set @Torch, 0; - set @TorchColor, rand(1, 12); - callfunc "SetTorchColor"; - callfunc "SetTorchIntensity"; - - // Third Barrier - set @BarrierColor, 3 + rand(3) * 4; - set @Barrier, 1; - callfunc "SetBarrierColor"; - - set @Torch, 1; - set @TorchColor, rand(1, 12); - callfunc "SetTorchColor"; - callfunc "SetTorchIntensity"; - - // End Barrier - set @BarrierColor, 2 + rand(6) * 2; - set @Barrier, 2; - callfunc "SetBarrierColor"; - - set @Torch, 2; - set @TorchColor, rand(1, 12); - callfunc "SetTorchColor"; - callfunc "SetTorchIntensity"; + callfunc "SetUpOrumQuest"; goto L_Close; L_Use_First_Barrier: @@ -592,3 +592,38 @@ L_Close: set @TorchColor, 0; close; } +function|script|SetUpOrumQuest|, +{ + // Second Barrier + set @BarrierColor, 1 + rand(3) * 4; + set @Barrier, 0; + callfunc "SetBarrierColor"; + + set @TorchIntensity, 0; + + set @Torch, 0; + set @TorchColor, rand(1, 12); + callfunc "SetTorchColor"; + callfunc "SetTorchIntensity"; + + // Third Barrier + set @BarrierColor, 3 + rand(3) * 4; + set @Barrier, 1; + callfunc "SetBarrierColor"; + + set @Torch, 1; + set @TorchColor, rand(1, 12); + callfunc "SetTorchColor"; + callfunc "SetTorchIntensity"; + + // End Barrier + set @BarrierColor, 2 + rand(6) * 2; + set @Barrier, 2; + callfunc "SetBarrierColor"; + + set @Torch, 2; + set @TorchColor, rand(1, 12); + callfunc "SetTorchColor"; + callfunc "SetTorchIntensity"; + return; +} diff --git a/world/map/npc/009-4/torches.txt b/world/map/npc/009-4/torches.txt index f093bc10..e9d8ff3e 100644 --- a/world/map/npc/009-4/torches.txt +++ b/world/map/npc/009-4/torches.txt @@ -1,5 +1,4 @@ //# see detailed description at orum.txt -//# see detailed description at orum.txt function|script|GetTorchColor|, { if (@Torch < 0 || @Torch > 2) goto L_Error; -- cgit v1.2.3-60-g2f50