From 0eb8928d17583cf5b5892efa5bce6c2a414b582e Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Tue, 26 Oct 2010 21:16:40 +0200 Subject: better bounds checking + comments in orum --- npc/009-4/_mobs.txt | 4 +-- npc/009-4/barriers.txt | 21 ++++++++------- npc/009-4/orum.txt | 73 ++++++++++++++++++++++++-------------------------- npc/009-4/torches.txt | 1 + npc/009-4/waric.txt | 4 +++ 5 files changed, 53 insertions(+), 50 deletions(-) (limited to 'npc/009-4') diff --git a/npc/009-4/_mobs.txt b/npc/009-4/_mobs.txt index df580666..71cf010f 100644 --- a/npc/009-4/_mobs.txt +++ b/npc/009-4/_mobs.txt @@ -1,5 +1,5 @@ // 009-4 Cave mobs - +// # see detailed description at orum.txt // Cavern 009-4.gat,107,88,19,28 monster Silkworm 1035,3,20000,14000,Mob009-4::OnSilkworm 009-4.gat,107,88,19,28 monster Cave Snake 1021,5,20000,14000,Mob009-4::OnCaveSnake @@ -26,4 +26,4 @@ OnSilkworm: break; end; -} \ No newline at end of file +} diff --git a/npc/009-4/barriers.txt b/npc/009-4/barriers.txt index 7dcb0b34..0185a2fd 100644 --- a/npc/009-4/barriers.txt +++ b/npc/009-4/barriers.txt @@ -1,3 +1,4 @@ +//# see detailed description at orum.txt function script GetBarrierColor { if (@Barrier < 0 || @Barrier > 2) goto L_Error; @@ -154,26 +155,26 @@ L_Advance_Quest: set @secondary, @BarrierColor + 1; // Make sure it's in bounds - if (@secondary > 12) set @secondary, 1; - if (@secondary < 1) set @secondary, 12; + if (@secondary > 12) set @secondary, @secondary - 12; + if (@secondary < 1) set @secondary, @secondary + 12; // Extract first 2 required colors set @firstColor, @secondary - 2; set @secondColor, @secondary + 2; - if (@firstColor > 12) set @firstColor, 1; - if (@firstColor < 1) set @firstColor, 12; - if (@secondColor > 12) set @secondColor, 1; - if (@secondColor < 1) set @secondColor, 12; + if (@firstColor > 12) set @firstColor, @firstColor - 12; + if (@firstColor < 1) set @firstColor, @firstColor + 12; + if (@secondColor > 12) set @secondColor, @secondColor - 12; + if (@secondColor < 1) set @secondColor, @secondColor + 12; set @thirdColor, 12; set @offsetOne, @BarrierColor + 1; set @offsetTwo, @BarrierColor - 1; // Make sure they in bounds - if (@offsetOne > 12) set @offsetOne, 1; - if (@offsetOne < 1) set @offsetOne, 12; - if (@offsetTwo > 12) set @offsetTwo, 1; - if (@offsetTwo < 1) set @offsetTwo, 12; + if (@offsetOne > 12) set @offsetOne, @offsetOne - 12; + if (@offsetOne < 1) set @offsetOne, @offsetOne + 12; + if (@offsetTwo > 12) set @offsetTwo, @offsetTwo - 12; + if (@offsetTwo < 1) set @offsetTwo, @offsetTwo + 12; // Extract third needed color if (@secondary == @offsetOne) diff --git a/npc/009-4/orum.txt b/npc/009-4/orum.txt index fc2467ec..cbc5e12f 100644 --- a/npc/009-4/orum.txt +++ b/npc/009-4/orum.txt @@ -1,6 +1,14 @@ //################################################################################# -//# Orum/Waric Quest Part 1 - By Liana, reviewed by Stefan Beller # -//# GPL v.2 # +//# Orum/Waric Quest Part 1 - By Liana, reviewed by Stefan Beller # +//# GPL v.2 # +//# # +//# The first quest is to find Waric in the Caves with lots of torches. # +//# These torches must be set in the right color to have access to the next # +//# room, guarded by a magical barrier of other torches. # +//# # +//# The second quest is an easy, but background-story telling quest. # +//# Just visit the cave again, find what is really in there. # +//# # //# # //# Used variables: # //# # @@ -25,6 +33,9 @@ // how many colorful powders each do you get as reward? set @BT_REWARDCOUNT, 10; + // no exp for breaking the barrier ? + set @EXP_BREAK_BARRIERS, 0; + if (OrumQuest > 0) goto L_Started; mes "[Orum]"; @@ -186,10 +197,10 @@ L_List_Materials: mes "He scavenges around in his pocket for another piece of paper then writes a new list.."; next; - mes "" + @B0_WISPPOWDER + " Wisp Powders,"; - mes "" + @B0_POLTERGEISTPOWDER + " Poltergeist Powders,"; - mes "" + @B0_SPECTREPOWDER + " Spectre Powders,"; - mes "" + @B0_HARDSPIKES + " Hard Spikes"; + mes @B0_WISPPOWDER + " Wisp Powders,"; + mes @B0_POLTERGEISTPOWDER + " Poltergeist Powders,"; + mes @B0_SPECTREPOWDER + " Spectre Powders,"; + mes @B0_HARDSPIKES + " Hard Spikes"; next; mes "[Orum]"; @@ -202,6 +213,12 @@ L_Check_Materials: countitem("SpectrePowder") < @B0_SPECTREPOWDER || countitem("HardSpike") < @B0_HARDSPIKES) goto L_Missing_Materials; + // check directly before deleting the objects. + delitem "WispPowder", @B0_WISPPOWDER; + delitem "PoltergeistPowder", @B0_POLTERGEISTPOWDER; + delitem "SpectrePowder", @B0_SPECTREPOWDER; + delitem "HardSpike", @B0_HARDSPIKES; + mes "Orum carefully looks over all of the items then grins.."; next; @@ -214,17 +231,6 @@ L_Check_Materials: mes "You watch as they begin mold together glowing brightly. He sprinkles in the powder you gathered and presses his hands together."; - //check directly before deleting the objects, the player could have traded the stuff, after the first check. - if (countitem("WispPowder") < @B0_WISPPOWDER || - countitem("PoltergeistPowder") < @B0_POLTERGEISTPOWDER || - countitem("SpectrePowder") < @B0_SPECTREPOWDER || - countitem("HardSpike") < @B0_HARDSPIKES) goto L_Missing_Materials; - - delitem "WispPowder", @B0_WISPPOWDER; - delitem "PoltergeistPowder", @B0_POLTERGEISTPOWDER; - delitem "SpectrePowder", @B0_SPECTREPOWDER; - delitem "HardSpike", @B0_HARDSPIKES; - misceffect sfx_magic_transmute; next; @@ -468,16 +474,6 @@ L_List_Materials_More: close; L_Finished_Gathering_More: - if (countitem("IronPowder") < @BT_IRONPOWDER || - countitem("PileOfAsh") < @BT_PILESOFASH || - countitem("GambogeHerb") < @BT_HERBS || - countitem("AlizarinHerb") < @BT_HERBS || - countitem("CobaltHerb") < @BT_HERBS) goto L_Missing_Materials_More; - - mes "[Orum]"; - mes "\"Excellent work! And once again you did not take as long as I was expecting. I guess I will get started..\""; - next; - if (countitem("IronPowder") < @BT_IRONPOWDER || countitem("PileOfAsh") < @BT_PILESOFASH || countitem("GambogeHerb") < @BT_HERBS || @@ -490,6 +486,10 @@ L_Finished_Gathering_More: delitem "AlizarinHerb", @BT_HERBS; delitem "CobaltHerb", @BT_HERBS; + mes "[Orum]"; + mes "\"Excellent work! And once again you did not take as long as I was expecting. I guess I will get started..\""; + next; + mes "You watch as Orum takes the iron powder and ash and begins chanting some words.. The two start to glow and mold together turning into a light metalic looking powder.."; next; misceffect sfx_magic_transmute; @@ -560,16 +560,6 @@ L_More_Powder: close; L_More_Powder_Make: - if (countitem("IronPowder") < @BT_IRONPOWDER || - countitem("PileOfAsh") < @BT_PILESOFASH || - countitem("GambogeHerb") < @BT_HERBS || - countitem("AlizarinHerb") < @BT_HERBS || - countitem("CobaltHerb") < @BT_HERBS) goto L_Missing_Materials_More; - - mes "[Orum]"; - mes "\"Hmm all of the items appear to be here.. Give me a moment to make that powder for you.\""; - next; - if (countitem("IronPowder") < @BT_IRONPOWDER || countitem("PileOfAsh") < @BT_PILESOFASH || countitem("GambogeHerb") < @BT_HERBS || @@ -582,6 +572,10 @@ L_More_Powder_Make: delitem "AlizarinHerb", @BT_HERBS; delitem "CobaltHerb", @BT_HERBS; + mes "[Orum]"; + mes "\"Hmm all of the items appear to be here.. Give me a moment to make that powder for you.\""; + next; + mes "Orum begins chanting the same words as he did when he made the powder before.. He seems to be quicker at it this time.."; misceffect sfx_magic_transmute; next; @@ -634,7 +628,10 @@ L_Ready_Cavern: mes "\"Very good work you have done! Please take this for your efforts.\""; next; - mes "TODO: [Insirt reward hir]"; + getexp @EXP_BREAK_BARRIERS, 0; + // TODO put item name and remove following line and this line as well! + getitem "", 1; + mes "[Insert reward here...]"; next; mes "\"You've done enough here to help. I will go the rest of the way alone so that your life is not endangered.. You must promise me not to go any further!\""; diff --git a/npc/009-4/torches.txt b/npc/009-4/torches.txt index 2e8f4604..d1ea73be 100644 --- a/npc/009-4/torches.txt +++ b/npc/009-4/torches.txt @@ -1,3 +1,4 @@ +//# see detailed description at orum.txt function script GetTorchColor { if (@Torch < 0 || @Torch > 2) goto L_Error; diff --git a/npc/009-4/waric.txt b/npc/009-4/waric.txt index 122fb2f7..b160dfbb 100644 --- a/npc/009-4/waric.txt +++ b/npc/009-4/waric.txt @@ -1,3 +1,5 @@ +//# see detailed description at orum.txt + 009-4.gat,99,33,0 script #WizardTrap 0,2,1,{ set @gender$, "They're"; if (Sex == 0) set @gender$, "She's"; @@ -23,6 +25,7 @@ } 009-4.gat,118,42,0 script Waric 153,{ + set @EXP_LEARNED_ALOT, 10000; if (OrumQuest >= 13) goto L_Behave; mes "Waric looks toward you rubbing his chin.."; next; @@ -87,5 +90,6 @@ L_Explain: misceffect 10; warp "008-1.gat", 65, 90; mes "You awake on your back with a squrrel sitting on top of you arranging it's acorns.. It quickly gathers them up and runs off as it sees you looking at it them.."; + getexp @EXP_LEARNED_ALOT, 0; close; } -- cgit v1.2.3-60-g2f50