From 9361aa027f9b998ba7c7c41e83e7a673bd66433c Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Thu, 25 Oct 2018 07:49:15 -0300 Subject: Cindy Quest, probably complete --- npc/021-4/doors.txt | 10 +++++++++ npc/021-4/main.txt | 65 +++++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 66 insertions(+), 9 deletions(-) diff --git a/npc/021-4/doors.txt b/npc/021-4/doors.txt index 49e84cfb9..c97aec317 100644 --- a/npc/021-4/doors.txt +++ b/npc/021-4/doors.txt @@ -6,10 +6,20 @@ 021-4,67,27,0 script #Leave0214 NPC_NO_SPRITE,0,0,{ if ($@CINDY_STATE % 2 == 1 && $@CINDY_STATE < 150000) goto L_Blocked; + if ($@CINDY_STATE > 150000) goto L_Check; +L_Warp: warp "021-3", 24, 123; end; L_Blocked: dispbottom l("You cannot leave this room until either ALL yetis are dead, or you are dead yourself."); end; + +L_Check: + .@pl = getmapusers("021-4"); + if (.@pl <= 1) { // Because we must include the one who triggered this script wasn't warped yet + $@CINDY_HERO=""; + setnpcdisplay "Cindy#Outside", NPC_CINDY_CAGE; + } + goto L_Warp; } diff --git a/npc/021-4/main.txt b/npc/021-4/main.txt index f343bbf69..1252c3fd6 100644 --- a/npc/021-4/main.txt +++ b/npc/021-4/main.txt @@ -44,7 +44,11 @@ function script CindySwitch_Check_214 { if ($@CINDY_STATE % 2 == 0) goto L_Start; // Victory check missing if (CindySwitch_Check_214() == 5) { - // Gate open must advance + // Gate is open, advance to stage 2 + .lifetime+=3; + .wtime=0; + mapannounce "021-4", "*roaaaaar*",0; + npctalk "Take care! More Yetis! And they have friends!!"; setnpcdisplay .name$, NPC_CINDY_UNCAGE; .@pl = getmapusers("021-4")+1; areamonster "021-4", 20, 20, 100, 80, "Yeti", Yeti, (.@pl/2)+rand(2,6), "Cindy#Outside::OnPetDeath"; @@ -55,15 +59,21 @@ function script CindySwitch_Check_214 { hello; end; +// Edge Cases L_Cheat: warp "Save", 0, 0; atcommand "@jail "+strcharinfo(0); dispbottom l("Cheater detected."); end; L_Reset: - $@CINDY_STATE=0; - npctalk l("*beeep*"); + if (is_gm()) { + $@CINDY_STATE=0; + npctalk l("*beeep*"); + } else if ($@CINDY_HERO == strcharinfo(0)) { + goto L_Winner; + } end; +// Start L_Start: mesn; mesq l("Have you came here to rescue me?"); @@ -97,6 +107,26 @@ L_Begin: monster "021-4", 66, 49, "Yeti", Yeti, 1, "Cindy#Outside::OnPetDeath"; close; +// Winner Reward +L_Winner: + mesn; + mesq l("Thanks for saving me. I'll return home on my own, if you don't mind."); + mesq l("Here, take this reward. Good luck. %%1"); + .@q=getq(NivalisQuest_Cindy); + // First time + if (.@q == 4) + getitem ApprenticeWand, 1; + else + Zeny=Zeny+rand(5000,15000); + $@CINDY_HERO=""; + setq1 NivalisQuest_Cindy, 5; + next; + npctalk l("Cindy is gone..."); + closedialog; + setnpcdisplay .name$, NPC_ICE_CAGE; + close; + +// Events OnPetDeath: end; @@ -106,36 +136,53 @@ OnReward: warp "Save", 0, 0; end; } - getexp 10000, 0; + if ($@CINDY_HERO == strcharinfo(0)) + dispbottom l("Congratulations on rescuing Cindy. You should now talk to her before leaving."); + else + dispbottom l("Congratulations on rescuing Cindy."); + setq2 NivalisQuest_Cindy, getq2(NivalisQuest_Cindy)+1; + getexp 10000, JobLevel; end; L_CleanUp: .lifetime=0; + .wtime=0; .canfinish=0; - $@CINDY_HERO=""; - $@CINDY_STATE+=1; + $@CINDY_STATE=gettimetick(2)+60*rand(55,65)*rand(1,36); // It is way too random to I say how long it takes disablenpc "#CindySwitch_06"; disablenpc "#CindySwitch_07"; disablenpc "#CindySwitch_08"; disablenpc "#CindySwitch_09"; disablenpc "#CindySwitch_10"; - setnpcdisplay .name$, NPC_CINDY_CAGE; + setnpcdisplay .name$, NPC_CINDY; end; -OnTimer5000: +OnTimer2500: .@y=mobcount("021-4", "Cindy#Outside::OnPetDeath"); .@v=CindySwitch_Check_214(); if (.@y == 0 && .@v >= 5 && .canfinish) { mapannounce "021-4", "You won.",0; areatimer "021-4", 20, 20, 100, 80, 10, "Cindy#Outside::OnReward"; - goto L_CleanUp; // Too early but oh well + goto L_CleanUp; + } + .wtime+=5; + if (.wtime >= rand(60,80)) { + .wtime=0; + .lifetime+=1; + .@pl = getmapusers("021-4")+1; + // If gate was unlocked, more Yetis will appear depending on switches state. + if (.canfinish) + .@pl+=5-CindySwitch_Check_214(); + areamonster "021-4", 20, 20, 100, 80, "Yeti", Yeti, (.@pl/2)+($@CINDY_STATE/2)+(.lifetime/3), "Cindy#Outside::OnPetDeath"; } + areamonster "021-4", 20, 20, 100, 80, "Slime Blast", SlimeBlast, $@CINDY_STATE; initnpctimer; end; OnInit: .distance=5; .lifetime=0; // Controls Yeti Wave + .wtime=0; // Timer runs sort of often. WTime controls automatic Yeti advance .canfinish=0;// Can finish or must talk to cage first? $@CINDY_HERO=""; disablenpc "#CindySwitch_06"; -- cgit v1.2.3-70-g09d2