diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2011-08-26 21:06:53 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2011-08-26 21:06:53 -0700 |
commit | 29fd79e3264346a6f3623020036a2e2a5fa7011f (patch) | |
tree | 588d2701c063b23660b9af3bea472873303a397e /world/map/npc/033-1/kimarr.txt | |
parent | 134bb0df0e2ca0d6933668594827cf4d825a4596 (diff) | |
download | classic-serverdata-29fd79e3264346a6f3623020036a2e2a5fa7011f.tar.gz classic-serverdata-29fd79e3264346a6f3623020036a2e2a5fa7011f.tar.bz2 classic-serverdata-29fd79e3264346a6f3623020036a2e2a5fa7011f.tar.xz classic-serverdata-29fd79e3264346a6f3623020036a2e2a5fa7011f.zip |
Fix and comment fluffy hunting quest
Diffstat (limited to 'world/map/npc/033-1/kimarr.txt')
-rw-r--r-- | world/map/npc/033-1/kimarr.txt | 113 |
1 files changed, 87 insertions, 26 deletions
diff --git a/world/map/npc/033-1/kimarr.txt b/world/map/npc/033-1/kimarr.txt index 29113769..fd9dc124 100644 --- a/world/map/npc/033-1/kimarr.txt +++ b/world/map/npc/033-1/kimarr.txt @@ -1,13 +1,35 @@ // Fluffy hunting quest +// initially by Jenalya +// more by alastrim +// broken by o11c, then fixed // Variables: // global $@Fluffy_Hunting - state of the quest // 0: nobody is hunting // 1: somebody is in there but hasn't dropped anything OR (buggily?) all monster have been killed -// 2: somebody is in there and has dropped something +// 2: not used anymore, was: food dropped but no spawn yet // 3: monsters have been spawned // global $@Fluffy_Time - the number of seconds since you entered the area -// global +// global $@Fluffy_Spawn - how many fluffies have been spawned +// global $@Fluffy_Kills - how many fluffies you have killed so far +// global $@Fluffy_Min - how many fluffies you have to kill to get a reward +// global $@Fluffy_PC_Deaths - used to keep track of whether the fluffies kill you +// global $@Fluffy_Fighter$ - name of the person hunting fluffies (only used for ornamentation) +// global $@Fluffy_FighterID - ID of the person hunting fluffies +// nibble 0 of QUEST_Barbarians - state for this and adjacent NPCs +// 0: haven't talked about it +// 1: heard about it +// 2: finished quest +// 3: got reward + +// Note: if you're going to reenable the "drop multiple times" feature +// 1: please do it every second, not just once you've killed everything +// 2: you should change $@Fluffy_Spawn to $@Fluffy_Alive and decrement it on kills +// 3: add a variable to spawn more fluffies if you drop more than 100 apples, as you kill them + +// Also, the $@Fluffy_Extra behaviour should be reconsidered (hardly anything spawns ...) +// that's the only reason I didn't make that one a local variable like it really is + 033-1.gat,74,32,0|script|Kimarr|218,{ if ($@Fluffy_FighterID == getcharid(3)) @@ -74,18 +96,38 @@ L_Ask: "Maybe later.", -; goto L_Close; +L_AlreadyGotReward: + callsub S_Clean; + mes "Once again you prove your worth as a hunter, " + strcharinfo(0); + goto L_Close; + +L_Reward1: + if (@state >= 2) + goto L_AlreadyGotReward; + + set @state, 2; + callsub S_Update_Mask; + callsub S_Clean; + + // as far as I can tell, this fails because it won't resume from the "next" + // when the script is executed via the "OnFluffyDeath" callback + // (I haven't tried via the 301st call of OnTimer1000) + message "Kimarr: talk to me for your reward"; + goto L_Close; + // this label is reached on completion of the quest, or, if you inventory was // full at the time, when you next initiate dialog (with @state == 2) L_Reward: mes "[Kimarr]"; - mes "That was very impressive - now you can call yourself a hunter, " + strcharinfo(0) + "."; + mes "\"That was very impressive - now you can call yourself a hunter, " + strcharinfo(0) + ".\""; next; getinventorylist; if (@inventorylist_count == 100) goto L_Full_Inv; + set @inventorylist_count, 0; mes "[Kimarr]"; - mes "Take this as a symbol of your strength. You're a member of our tribe now."; + mes "\"Take this as a symbol of your strength. You're a member of our tribe now.\""; getitem "YetiSkinShirt", 1; set @state, 3; callsub S_Update_Mask; @@ -94,7 +136,7 @@ L_Reward: L_Full_Inv: mes "[Kimarr]"; - mes "You can't carry the reward I want to give you."; + mes "\"You can't carry the reward I want to give you.\""; goto L_Close; // dialog starts here after you've completed this quest @@ -117,7 +159,8 @@ L_Game: set $@Fluffy_Time, 0; //TODO: set minimum number of killed fluffies (maybe based on level?) - set $@Fluffy_Min, 1; + // Make sure it is more than 1 to avoid grammar issues "%d fluffies killed" + set $@Fluffy_Min, 2; warp "033-1.gat", 79, 34; initnpctimer; goto L_Close; @@ -165,23 +208,22 @@ L_Died: end; L_TimeOver: - warp "033-1.gat", 77, 34; message strcharinfo(0), "Your time is over."; goto L_MaybeRecordScore; L_CheckDrops: if ($@Fluffy_Time > 15) goto L_DidntDrop; - set $@Fluffy_RedApple, getareadropitem("033-1.gat", 79, 29, 88, 42, "RedApple", 1); - set $@Fluffy_XmasCake, getareadropitem("033-1.gat", 79, 29, 88, 42, "XmasCake", 1); - set $@Fluffy_Cake, getareadropitem("033-1.gat", 79, 29, 88, 42, "Cake", 1); - set $@Fluffy_GreenApple, getareadropitem("033-1.gat", 79, 29, 88, 42, "GreenApple", 1); - if ($@Fluffy_RedApple || $@Fluffy_XmasCake || $@Fluffy_Cake || $@Fluffy_GreenApple) + set @Fluffy_RedApple, getareadropitem("033-1.gat", 79, 29, 88, 42, "RedApple", 1); + set @Fluffy_XmasCake, getareadropitem("033-1.gat", 79, 29, 88, 42, "XmasCake", 1); + set @Fluffy_Cake, getareadropitem("033-1.gat", 79, 29, 88, 42, "Cake", 1); + set @Fluffy_GreenApple, getareadropitem("033-1.gat", 79, 29, 88, 42, "GreenApple", 1); + if (@Fluffy_RedApple || @Fluffy_XmasCake || @Fluffy_Cake || @Fluffy_GreenApple) goto L_BeginHunting; goto L_ContinueTimer; L_BeginHunting: - set $@Fluffy_Spawn, $@Fluffy_RedApple + 5 * $@Fluffy_XmasCake + 3 * $@Fluffy_Cake + $@Fluffy_GreenApple; + set $@Fluffy_Spawn, @Fluffy_RedApple + 5 * @Fluffy_XmasCake + 3 * @Fluffy_Cake + @Fluffy_GreenApple; // limit the number of monsters that can be spawned, to prevent people creating lag with massive amount of monsters if ($@Fluffy_Spawn > 100) set $@Fluffy_Spawn, 100; @@ -192,7 +234,7 @@ L_BeginHunting: areamonster "033-1.gat", 79, 29, 88, 42, "", 1020, $@Fluffy_Spawn, "Kimarr::OnFluffyDeath"; // other monsters don't generate a real event - set $@Fluffy_Extra, 5 * $@Fluffy_XmasCake + 3 * $@Fluffy_Cake + 10 * BaseLevel; + set $@Fluffy_Extra, 5 * @Fluffy_XmasCake + 3 * @Fluffy_Cake + 10 * BaseLevel; if ((BaseLevel > 40) && (rand($@Fluffy_Extra) > 500)) // Ice Goblin areamonster "033-1.gat", 79, 29, 88, 42, "", 1058, 1, "Kimarr::OnOtherDeath"; if ((BaseLevel > 60) && (rand($@Fluffy_Extra) > 550)) // Santa Slime @@ -202,20 +244,27 @@ L_BeginHunting: areamonster "033-1.gat", 79, 29, 88, 42, "", 1072, 1, "Kimarr::OnOtherDeath"; set $@Fluffy_Extra, 0; - set $@Fluffy_RedApple, 0; - set $@Fluffy_XmasCake, 0; - set $@Fluffy_Cake, 0; - set $@Fluffy_GreenApple, 0; + set @Fluffy_RedApple, 0; + set @Fluffy_XmasCake, 0; + set @Fluffy_Cake, 0; + set @Fluffy_GreenApple, 0; set $@Fluffy_Hunting, 3; goto L_ContinueTimer; +OnOtherDeath: + // nothing happens + end; + OnFluffyDeath: set $@Fluffy_Kills, $@Fluffy_Kills + 1; //TODO: remove announce after debugging //mapannounce "033-1.gat", "fluffies killed: " + $@Fluffy_Kills, 0; - if ($@Fluffy_Kills >= $@Fluffy_Spawn) + if ($@Fluffy_Kills < $@Fluffy_Spawn) + end; + if (attachrid($@Fluffy_FighterID)) goto L_MaybeRecordScore; + goto L_GotOut; end; L_DidntDrop: @@ -226,6 +275,7 @@ L_DidntDrop: goto L_Close; S_Clean: + stopnpctimer; killmonster "033-1.gat", "Kimarr::OnOtherDeath"; killmonster "033-1.gat", "Kimarr::OnFluffyDeath"; set $@Fluffy_Hunting, 0; @@ -235,20 +285,19 @@ S_Clean: set $@Fluffy_FighterID, 0; set $@Fluffy_Kills, 0; set $@Fluffy_Spawn, 0; - stopnpctimer; return; L_MaybeRecordScore: - callsub S_Clean; + warp "033-1.gat", 77, 34; if ($@Fluffy_Kills < $@Fluffy_Min) - goto L_ShowRecord; + goto L_NotGoodEnough; set @rank, 0; L_MaybeInsertNext: if ($@Fluffy_Kills > $Record_Fluffy_Kills[@rank]) goto L_InsertScore; set @rank, @rank + 1; if (@rank == MAX_HIGH_SCORES) - goto L_ShowRecord; + goto L_Reward1; goto L_MaybeInsertNext; L_InsertScore: @@ -280,20 +329,32 @@ L_FinallyInsertMe: set $Record_Fluffy_Date$[@rank], @ts_date$ + " " + @ts_time$; set @ts_date$, ""; set @ts_time$, ""; + goto L_Reward1; + +L_NotGoodEnough: + callsub S_Clean; L_ShowRecord: set @rank, 0; set @loop, 0; L_ShowNextRecord: - if (! $Record_Fluffy_Kills[@loop]) + if ($Record_Fluffy_Kills[@loop] == 0) goto L_Close; - mes (@loop + 1) + " - " + $Record_Fluffy_Name$[@loop] + " - " + $Record_Fluffy_Kills[@loop] + " fluffies killed in " + $Record_Fluffy_Date$[@loop]; + mes (@loop + 1) + " - " + $Record_Fluffy_Name$[@loop] + " - " + $Record_Fluffy_Kills[@loop] + " fluffies killed at " + $Record_Fluffy_Date$[@loop]; set @loop, @loop + 1; goto L_ShowNextRecord; L_Close: - // TODO: clear all temporary player variables that are not otherwise cleared + // clear all temporary player variables that are not otherwise cleared + + // it is not feasible to otherwise clear @loop + // but, not all jumpers to L_Close have necessarily used it ... + // still, I think it's a good precent to ALWAYS exit via L_Close set @loop, 0; + + // if you unset @state, @Q_Barbarians_MASK or @Q_Barbarians_SHIFT, it might break the script + // If only we had the concept of "local constants" ... + close; S_Update_Mask: |