From 235709d0d10c632bef619df6f8d6ea27f5c190ac Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Mon, 26 Sep 2011 22:07:59 -0700 Subject: Halloween 2011 Trick-or-Treating --- world/map/npc/001-1/vincent.txt | 7 + world/map/npc/006-1/pachua.txt | 8 +- world/map/npc/008-1/george.txt | 7 + world/map/npc/009-2/kfahr.txt | 6 + world/map/npc/009-2/nurse.txt | 7 + world/map/npc/010-2/workers.txt | 7 + world/map/npc/021-1/eurni.txt | 7 + world/map/npc/021-1/weellos.txt | 7 + world/map/npc/021-2/government_building.txt | 7 + world/map/npc/027-2/caretaker.txt | 7 + world/map/npc/halloween/2011/_import.txt | 2 + world/map/npc/halloween/2011/config.txt | 224 ++++++++++++++++++++++++ world/map/npc/halloween/2011/trick_or_treat.txt | 223 +++++++++++++++++++++++ world/map/npc/scripts.conf | 7 + 14 files changed, 525 insertions(+), 1 deletion(-) create mode 100644 world/map/npc/halloween/2011/_import.txt create mode 100644 world/map/npc/halloween/2011/config.txt create mode 100644 world/map/npc/halloween/2011/trick_or_treat.txt diff --git a/world/map/npc/001-1/vincent.txt b/world/map/npc/001-1/vincent.txt index a6512d80..52285dbb 100644 --- a/world/map/npc/001-1/vincent.txt +++ b/world/map/npc/001-1/vincent.txt @@ -1,6 +1,10 @@ // 001-1.gat,135,42,0|script|Vincent|113,{ + set @hw2011_npc_id, $@hw2011_npc_vincent; + if (gettime(7) == $@hw2011_year && gettime(6) == 10 && gettime(5) >= $@hw2011_start_day) + goto L_TrickOrTreat; + if (TMW_Quest >= 10) goto L_Done; if (TMW_Quest == 9) goto L_Progress; if (TMW_Quest == 8) goto L_Start; @@ -123,4 +127,7 @@ L_Done: L_Close: set @TEMP, 0; close; + +L_TrickOrTreat: + callfunc "TrickOrTreat2011"; } diff --git a/world/map/npc/006-1/pachua.txt b/world/map/npc/006-1/pachua.txt index 824bc9b5..941ffa79 100644 --- a/world/map/npc/006-1/pachua.txt +++ b/world/map/npc/006-1/pachua.txt @@ -1,5 +1,4 @@ 006-1.gat,23,100,0|script|Pachua|143,{ - set @LEATHER_PATCH_PRICE, 300; set @wants_leather_patch, QUEST_Forestbow_state & NIBBLE_4_MASK; @@ -16,6 +15,10 @@ // if (gettime(6) == @month && gettime(5) >= @start_day && gettime(5) <= @end_day && QUEST_Easter11 == 2) goto L_MakeBasket; // if (gettime(6) == @month && gettime(5) >= @start_day && gettime(5) <= @end_day && QUEST_Easter11 == 3) goto L_SeeBunny; + set @hw2011_npc_id, $@hw2011_npc_pachua; + if (gettime(7) == $@hw2011_year && gettime(6) == 10 && gettime(5) >= $@hw2011_start_day) + goto L_TrickOrTreat; + L_Begin: mes "[Chief Pachua]"; mes ""; @@ -312,4 +315,7 @@ L_SeeBunny: mes "\"You need to return to the Easter Bunny now.\""; next; goto L_Begin; + +L_TrickOrTreat: + callfunc "TrickOrTreat2011"; } diff --git a/world/map/npc/008-1/george.txt b/world/map/npc/008-1/george.txt index e4a37718..6144aed2 100644 --- a/world/map/npc/008-1/george.txt +++ b/world/map/npc/008-1/george.txt @@ -1,6 +1,10 @@ // 008-1.gat,136,36,0|script|George|138,{ + set @hw2011_npc_id, $@hw2011_npc_george; + if (gettime(7) == $@hw2011_year && gettime(6) == 10 && gettime(5) >= $@hw2011_start_day) + goto L_TrickOrTreat; + if (getequipid(equip_head) == 617) goto L_Pirate; if (getequipid(equip_head) == 622) goto L_Bandana; if (getequipid(equip_head) == 621) goto L_EyePatch; @@ -22,4 +26,7 @@ L_EyePatch: mes "[George the Pirate]"; mes "\"Arrrrh! Looks like ye lost an eye there!\""; close; + +L_TrickOrTreat: + callfunc "TrickOrTreat2011"; } diff --git a/world/map/npc/009-2/kfahr.txt b/world/map/npc/009-2/kfahr.txt index b5d3abcf..daccd429 100644 --- a/world/map/npc/009-2/kfahr.txt +++ b/world/map/npc/009-2/kfahr.txt @@ -14,6 +14,9 @@ //################################################################################# 009-2.gat,67,57,0|script|Kfahr|125,{ + set @hw2011_npc_id, $@hw2011_npc_kfahr; + if (gettime(7) == $@hw2011_year && gettime(6) == 10 && gettime(5) >= $@hw2011_start_day) + goto L_TrickOrTreat; set @QS_NEWBIE, 0; set @QS_MET_KFAHR, 1; @@ -1078,4 +1081,7 @@ L_end: L_Update_Var: set QUEST_Forestbow_state, (QUEST_Forestbow_state & ~(@Q_MASK) | (@Q_status << @Q_SHIFT)); return; + +L_TrickOrTreat: + callfunc "TrickOrTreat2011"; } diff --git a/world/map/npc/009-2/nurse.txt b/world/map/npc/009-2/nurse.txt index 5ee20905..e1095099 100644 --- a/world/map/npc/009-2/nurse.txt +++ b/world/map/npc/009-2/nurse.txt @@ -23,6 +23,10 @@ //###################################################################################### 009-2.gat,147,65,0|script|Nurse|119,{ + set @hw2011_npc_id, $@hw2011_npc_nurse; + if (gettime(7) == $@hw2011_year && gettime(6) == 10 && gettime(5) >= $@hw2011_start_day) + goto L_TrickOrTreat; + set @SNAKET_AMOUNT, 5; set @BSCORPIONST_AMOUNT, 10; // This quest can be done very often: so give less xp @@ -538,4 +542,7 @@ L_Game_toomuch: mes "[Nurse]"; mes "\"This would be way too much for my scale. I don't want to break it.\""; goto L_choosePut; + +L_TrickOrTreat: + callfunc "TrickOrTreat2011"; } diff --git a/world/map/npc/010-2/workers.txt b/world/map/npc/010-2/workers.txt index 703204d1..9176328f 100644 --- a/world/map/npc/010-2/workers.txt +++ b/world/map/npc/010-2/workers.txt @@ -7,7 +7,14 @@ } 010-2.gat,39,75,0|script|Zack|155,{ + set @hw2011_npc_id, $@hw2011_npc_zack; + if (gettime(7) == $@hw2011_year && gettime(6) == 10 && gettime(5) >= $@hw2011_start_day) + goto L_TrickOrTreat; + mes "[Zack]"; mes "\"My brother and I are fixing the cellar pass.\""; close; + +L_TrickOrTreat: + callfunc "TrickOrTreat2011"; } diff --git a/world/map/npc/021-1/eurni.txt b/world/map/npc/021-1/eurni.txt index 014d8d7a..e24e320a 100644 --- a/world/map/npc/021-1/eurni.txt +++ b/world/map/npc/021-1/eurni.txt @@ -1,6 +1,10 @@ // 021-1.gat,141,113,0|script|Eurni|136,{ + set @hw2011_npc_id, $@hw2011_npc_eurni; + if (gettime(7) == $@hw2011_year && gettime(6) == 10 && gettime(5) >= $@hw2011_start_day) + goto L_TrickOrTreat; + if (BaseLevel < 10) goto L_TooYoung; if (zeny < 10000) goto L_NoMoney; @@ -36,4 +40,7 @@ L_NoMoney: mes "[Eurni the Surgeon]"; mes "\"You don't have enough to pay for my services.\""; close; + +L_TrickOrTreat: + callfunc "TrickOrTreat2011"; } diff --git a/world/map/npc/021-1/weellos.txt b/world/map/npc/021-1/weellos.txt index 2a7dcdf9..5d12bfdd 100644 --- a/world/map/npc/021-1/weellos.txt +++ b/world/map/npc/021-1/weellos.txt @@ -1,6 +1,10 @@ // A historian 021-1.gat,130,125,0|script|Weellos|103,{ + set @hw2011_npc_id, $@hw2011_npc_weellos; + if (gettime(7) == $@hw2011_year && gettime(6) == 10 && gettime(5) >= $@hw2011_start_day) + goto L_TrickOrTreat; + if isin("021-1.gat", 130, 120, 140, 125) goto L_In; mes "[Weellos]"; @@ -12,4 +16,7 @@ L_In: mes "[Weellos]"; mes "\"What did you think of the historic building?\""; close; + +L_TrickOrTreat: + callfunc "TrickOrTreat2011"; } diff --git a/world/map/npc/021-2/government_building.txt b/world/map/npc/021-2/government_building.txt index 48ea528f..5935d06e 100644 --- a/world/map/npc/021-2/government_building.txt +++ b/world/map/npc/021-2/government_building.txt @@ -139,6 +139,10 @@ S_give_rings: } 021-2.gat,36,17,0|script|Tathin|107,{ + set @hw2011_npc_id, $@hw2011_npc_tathin; + if (gettime(7) == $@hw2011_year && gettime(6) == 10 && gettime(5) >= $@hw2011_start_day) + goto L_TrickOrTreat; + set @PARTY_SKILL, 3; mes "[Tathin]"; @@ -215,6 +219,9 @@ L_NotEnoughMoney: mes "[Tathin]"; mes "\"You don't have enough GP\""; close; + +L_TrickOrTreat: + callfunc "TrickOrTreat2011"; } // Guard diff --git a/world/map/npc/027-2/caretaker.txt b/world/map/npc/027-2/caretaker.txt index d86a14f9..d55c8c3b 100644 --- a/world/map/npc/027-2/caretaker.txt +++ b/world/map/npc/027-2/caretaker.txt @@ -3,6 +3,10 @@ // Airlia supports receiving an infinate number of letters 027-2.gat,24,25,0|script|Caretaker|159,{ + set @hw2011_npc_id, $@hw2011_npc_caretaker; + if (gettime(7) == $@hw2011_year && gettime(6) == 10 && gettime(5) >= $@hw2011_start_day) + goto L_TrickOrTreat; + if (QUEST_Graveyard_Caretaker == 1) goto L_Return_Dialog; if (QUEST_Graveyard_Caretaker == 2) goto L_Has_Letter; if (QUEST_Graveyard_Caretaker == 3) goto L_Delivered_Letter; @@ -121,4 +125,7 @@ OnWifeDeath: gmcommand "@ban +5mn " + strcharinfo(0); initnpctimer; end; + +L_TrickOrTreat: + callfunc "TrickOrTreat2011"; } diff --git a/world/map/npc/halloween/2011/_import.txt b/world/map/npc/halloween/2011/_import.txt new file mode 100644 index 00000000..89728d86 --- /dev/null +++ b/world/map/npc/halloween/2011/_import.txt @@ -0,0 +1,2 @@ +npc: npc/halloween/2011/config.txt +npc: npc/halloween/2011/trick_or_treat.txt diff --git a/world/map/npc/halloween/2011/config.txt b/world/map/npc/halloween/2011/config.txt new file mode 100644 index 00000000..39587685 --- /dev/null +++ b/world/map/npc/halloween/2011/config.txt @@ -0,0 +1,224 @@ +// Halloween 2011 +// Authors: alastrim, enchilado, o11c +// This file initializes global constants, which includes dialog. + +// Event Configuration: +// Generic stuff +// $@hw2011_start_day = the first day in October the quest can be done +// $@hw2011_year = the year this quest is activated, for event necromancers +// $@hw2011_memory_count = Number of masks each NPC remembers +// $@hw2011_min_level = Minimum level to go trick-or-treating + +// Global stuff +// $@hw2011_sweets$ = Array with all the sweets to be given as treats +// $@hw2011_mask_IDs = Array with the IDs of all the masks that cover your face + The Scary Axehat +// $@hw2011_scare_factors = Array with the basic scare factor of each mask +// 678 Noh Mask 2 +// 679 Demon Mask 4 +// 1221 Skull Mask 4 +// 634 Face Mask 4 +// 615 Pumpkin Helmet 2 +// 639 Crusade Helmet 3 +// 769 Guy Fawkes Mask 2 +// 801 Pinkie Helmet 2 +// 1218 Paper Bag 1 +// 1276 Opera Mask 3 +// 1277 Jester Mask 2 +// 1279 Goblin Mask 4 +// 4027 Yeti Mask 4 +// 616 Axe Hat 4 + +// Per-NPC stuff +// $@hw2011_npc_ = constants for @hw2011_npc_id, the index into the array +// $@hw2011_npc_names$ = Array with all NPC names inside brackets, to be used in the function +// $@hw2011_greetings$ = Array with all the NPC initial greetings when you "trick or treat" them +// $@hw2011_trick_notscary$ = Array with the less scary menu options +// $@hw2011_react_notscary$ = Array with all the reactions to the less scary menu options +// $@hw2011_trick_scary$ = Array with scary menu options +// $@hw2011_react_scary$ = Array with all the reactions to the scary menu options +// $@hw2011_trick_veryscary$ = Array with the most scary menu options +// $@hw2011_react_veryscary$ = Array with all the reactions to the very scary menu options + +// !!! IMPORTANT NOTE: a maximum of 16 NPCs can be used for this quest !!! + +009-1.gat,43,40,0|script|#hw2011config|45,{ +OnInit: + // Set this to 1 for testing, to enable for all of October + set $@hw2011_start_day, 24; + // Using this means the calling NPCs don't need to be edited when the event + // is done, but allows the possibility of reenabling it in a later year. + // If we make it an annual event it will become obsolete. + set $@hw2011_year, 2011; + // How many, maximum is 8 + set $@hw2011_memory_count, 5; + // Level to go trick-or-treating + // Don't decrease this below 10 or the surgeon will be filled with plot holes + set $@hw2011_min_level, 10; + + // TODO: review this list + // all sweets are equal currently + setarray $@hw2011_sweets$, + "CaramelApple", + "OrangeCupcake", + "ChocolateCake", + "Candy", + "DecorCandy", + "Cake", + "CandyCane", + "XmasCake", + "ChocolateBar", + "GingerBreadMan", + "XmasCandyCane", + "CherryCake", + "WhiteCake", + "OrangeCake", + "AppleCake", + "LollipopColor1", + "LollipopColor2", + "LollipopColor3", + "TonoriDelight", + "Marshmallow", + "JellySkull", + "CandyPumpkin"; + + setarray $@hw2011_mask_IDs, 678, 679, 1221, 634, 615, 639, 769, 801, 1218, 1276, 1277, 1279, 4027, 616; + setarray $@hw2011_scare_factors, 2, 4, 4, 4, 2, 3, 2, 2, 1, 3, 2, 4, 4, 4; + + // temporary counter + set $@n, 0; + + set $@hw2011_npc_caretaker, $@n; + set $@hw2011_npc_names$[$@n], "[Caretaker]"; + set $@hw2011_greetings$[$@n], "\"Alright, come on then. Show me your trick.\""; + set $@hw2011_trick_notscary$[$@n], "Trick? You must have misheard me. I've come because the Government needs to build a road through your house."; + set $@hw2011_react_notscary$[$@n], "\"And?\""; + set $@hw2011_trick_scary$[$@n], "You look pretty deceased to me, old man. Undead must die! Yaah!"; + set $@hw2011_react_scary$[$@n], "\"Now listen here, I'm as alive as you - oh. Say, that was a good trick!\""; + set $@hw2011_trick_veryscary$[$@n], "Your wife... she's - she's - she's DEAD!"; + set $@hw2011_react_veryscary$[$@n], "\"But... I live here! My wife l... is dead here. You can't - oh. I DIDN'T mishear you. You really had me fooled!\""; + + set $@n, $@n + 1; + + set $@hw2011_npc_eurni, $@n; + set $@hw2011_npc_names$[$@n], "[Eurni the Surgeon]"; + set $@hw2011_greetings$[$@n], "\"Oh, right.\""; + set $@hw2011_trick_notscary$[$@n], "I paid good money for your services, and when I get home I find that now I'm not a man OR a woman..."; + set $@hw2011_react_notscary$[$@n], "\"Heheh, sucks, buddy. But there's always a risk.\""; + set $@hw2011_trick_scary$[$@n], "Look out! A scorpion!"; + set $@hw2011_react_scary$[$@n], "\"Where? Darn things, I think they're what keep scaring away my customers.\""; + set $@hw2011_trick_veryscary$[$@n], "I know about your hobby of performing numerous sex changes on yourself."; + set $@hw2011_react_veryscary$[$@n], "\"Shut up! Look, will you hold your tongue if I give you more treats...?\""; + + set $@n, $@n + 1; + + set $@hw2011_npc_george, $@n; + set $@hw2011_npc_names$[$@n], "[George the Pirate]"; + set $@hw2011_greetings$[$@n], "\"Shiver me timbers! What do ye mean?\""; + set $@hw2011_trick_notscary$[$@n], "Well... I do a trick, and then... you give me a treat..."; + set $@hw2011_react_notscary$[$@n], "\"Arrrrh, I knew what ye meant, to be sure! I were just kidding with ye, pretending to be a crazy old pirate! Arrrrh!\""; + set $@hw2011_trick_scary$[$@n], "Your eyepatch is on the wrong eye!"; + set $@hw2011_react_scary$[$@n], "\"Arrrrh, so it is! Ta for pointing it out, mate - wait, no it isn't! Harhar, what a good trick!\""; + set $@hw2011_trick_veryscary$[$@n], "By the powers, ye're a daft landlubber to be sure, ye barnacle-ridden swab!"; + set $@hw2011_react_veryscary$[$@n], "\"Arrrrh, ye scurvy dog! I'm sure my first mate will return with the ship eventually.\""; + + set $@n, $@n + 1; + + set $@hw2011_npc_inac, $@n; + set $@hw2011_npc_names$[$@n], "[Inac]"; + set $@hw2011_greetings$[$@n], "\"Oh, yes?\""; + set $@hw2011_trick_notscary$[$@n], "Yes, we monsters moved into the tunnels... and now we're coming out... for revenge!"; + set $@hw2011_react_notscary$[$@n], "\"Haha! That's the worse trick I've seen today.\""; + set $@hw2011_trick_scary$[$@n], "One of those monsters you mentioned is crawling out of the well!"; + set $@hw2011_react_scary$[$@n], "\"He IS? Where!? Aah! Oh. You were just tricking, right? Hahaha, that was good, I really believed you.\""; + set $@hw2011_trick_veryscary$[$@n], "Yeah, but it's all fossil water. One day it's gonna dry up!"; + set $@hw2011_react_veryscary$[$@n], "\"Fossil water? You mean it's turned to STONE? But you can't drink - oh... you were just tricking, right? You WEREN'T? Aaaah!\""; + + set $@n, $@n + 1; + + set $@hw2011_npc_kfahr, $@n; + set $@hw2011_npc_names$[$@n], "[Kfahr the Warrior]"; + set $@hw2011_greetings$[$@n], "\"Ah, yes!\" He rubs his hands. \"Trick away, then!\""; + set $@hw2011_trick_notscary$[$@n], "Meh... I'm only trick-or-treating you to avoid listening to your BORING stories."; + set $@hw2011_react_notscary$[$@n], "\"Boring?\" He grins. \"You must be mistaking me for someone else.\""; + set $@hw2011_trick_scary$[$@n], " TODO "; + set $@hw2011_react_scary$[$@n], "\" TODO \""; + set $@hw2011_trick_veryscary$[$@n], "Have you heard? Tulimshar was destroyed by a giant Desert Worm!"; + set $@hw2011_react_veryscary$[$@n], "\"What!?\" Kfahr stares. \"And no one called for me? This is appalling! But - what? That was your trick? Hm, nice one. You almost had me fooled!\""; + + set $@n, $@n + 1; + + set $@hw2011_npc_nurse, $@n; + set $@hw2011_npc_names$[$@n], "[Nurse]"; + set $@hw2011_greetings$[$@n], "\"I don't know why I let the Mayor trick me into this... well, go on then.\""; + set $@hw2011_trick_notscary$[$@n], "I ate too much Hallowe'en candy, now I'm sick!"; + set $@hw2011_react_notscary$[$@n], "\"Well, no one's to blame but yourself, you know. Just make sure you don't eat any more.\""; + set $@hw2011_trick_scary$[$@n], "Hurnscald has been struck by plague! You must come and tend to the dying!"; + set $@hw2011_react_scary$[$@n], "\"But I don't know how to deal with plague! Oh no! You must get the Doctor! Unless... you were just tricking me! Whew, that's a relief!\""; + set $@hw2011_trick_veryscary$[$@n], "The Doctor asked me to tell you that he doesn't want to see you any more."; + set $@hw2011_react_veryscary$[$@n], "\"What? But we were getting it on so well. I mean, getting on so well! Oh... that was your trick! Dear me, I believed you!\""; + + set $@n, $@n + 1; + + set $@hw2011_npc_pachua, $@n; + set $@hw2011_npc_names$[$@n], "[Chief Pachua]"; + set $@hw2011_greetings$[$@n], "\"Ah, the strange custom the Government man told me about.\""; + set $@hw2011_trick_notscary$[$@n], "Look out! A scorpion!"; + set $@hw2011_react_notscary$[$@n], "\"Don't mind him, he won't hurt you. Er... so I give you sweets now, or what?\""; + set $@hw2011_trick_scary$[$@n], "Yes, the ritual giving of treats... LOTS of treats... or else!"; + set $@hw2011_react_scary$[$@n], "\"Alright, here you go.\""; + set $@hw2011_trick_veryscary$[$@n], "Yes, the ritual giving of treats followed by the sacrifice of the treat-giver..."; + set $@hw2011_react_veryscary$[$@n], "\"I do like a good sacrifice, but less so if it's me! I'll give you extra sweets if you forget the sacrifice.\""; + + set $@n, $@n + 1; + + set $@hw2011_npc_tathin, $@n; + set $@hw2011_npc_names$[$@n], "[Tathin]"; + set $@hw2011_greetings$[$@n], "\"I am employed by the Tonori Government, make sure you abide the regulations we wrote down for Trick-or-Treaters this year...\""; + set $@hw2011_trick_notscary$[$@n], "Of course I will... not!"; + set $@hw2011_react_notscary$[$@n], "\"Hm!\""; + set $@hw2011_trick_scary$[$@n], "Regulations, smegulations. The Tonori Government can go suck a lollipop for all I care!"; + set $@hw2011_react_scary$[$@n], "\"!? How dare you - oh, that was your trick! You did have me worried for a moment...\""; + set $@hw2011_trick_veryscary$[$@n], "What regulations?"; + set $@hw2011_react_veryscary$[$@n], "\"You mean you haven't even READ - I don't believe - this is ghastly - I - oh... that was your trick... gosh, I believed you for a minute! I thought you really hadn't read them!\""; + + set $@n, $@n + 1; + + set $@hw2011_npc_vincent, $@n; + set $@hw2011_npc_names$[$@n], "[Vincent]"; + set $@hw2011_greetings$[$@n], "\"Ooh, okay! Trick away!\""; + set $@hw2011_trick_notscary$[$@n], "Look out! A scorpion!"; + set $@hw2011_react_notscary$[$@n], "\"They're everywhere in this desert! Don't worry about them.\""; + set $@hw2011_trick_scary$[$@n], "Hey, that action figure you're building just CAME TO LIFE!"; + set $@hw2011_react_scary$[$@n], "\"Really? Cool! Where? What? You were tricking me? WAAAH!\""; + set $@hw2011_trick_veryscary$[$@n], "Wow, this is a neat action figure! Haha, check out its moves! Oops! Never mind, I'm sure it'll glue back on."; + set $@hw2011_react_veryscary$[$@n], "\"My Bug Leg action figure! You broke it!\""; + + set $@n, $@n + 1; + + set $@hw2011_npc_weellos, $@n; + set $@hw2011_npc_names$[$@n], "[Weellos]"; + set $@hw2011_greetings$[$@n], "\"Trick me, then!\""; + set $@hw2011_trick_notscary$[$@n], "Look out! A scorpion!"; + set $@hw2011_react_notscary$[$@n], "\"Pesky things, I know, but they're everywhere around here...\""; + set $@hw2011_trick_scary$[$@n], "Actually, it's a fake. It was built just ten years ago."; + set $@hw2011_react_scary$[$@n], "\"No! But I've read all the accounts... oh, haha! Very funny!\""; + set $@hw2011_trick_veryscary$[$@n], "They say the earthquake ruined the foundations of this building, and that it's going to fall down."; + set $@hw2011_react_veryscary$[$@n], "\"B-but it's one of the oldest buildings around! And... wait, I just remembered that it was designed to be earthquake-proof. You were tricking me!\""; + + set $@n, $@n + 1; + + set $@hw2011_npc_zack, $@n; + set $@hw2011_npc_names$[$@n], "[Zack]"; + set $@hw2011_greetings$[$@n], "\"I thought no one would find me down here, but I'm glad I was wrong! Let's see your trick, then.\""; + set $@hw2011_trick_notscary$[$@n], "You think this is something to do with Hallowe'en? Hands up!"; + set $@hw2011_react_notscary$[$@n], "\"Heh... That was ok.\""; + set $@hw2011_trick_scary$[$@n], "And now that I've found you, you die!"; + set $@hw2011_react_scary$[$@n], "\"Aah! What did I do? Oh - wait - I see! That was a good one!\""; + set $@hw2011_trick_veryscary$[$@n], "Yes, I have found you. After all these years."; + set $@hw2011_react_veryscary$[$@n], "\"Uncle Henry? But how, I covered my tracks so well! I never told anyone that - wait... that was your trick! You had me worried for a minute!\""; + + set $@hw2011_num_npcs, $@n + 1; + set $@hw2011_all_npc_bits, 0xFFFFFFFF << (32 - $@hw2011_all_npc_bits); + + set $@n, 0; +} diff --git a/world/map/npc/halloween/2011/trick_or_treat.txt b/world/map/npc/halloween/2011/trick_or_treat.txt new file mode 100644 index 00000000..3f3aa890 --- /dev/null +++ b/world/map/npc/halloween/2011/trick_or_treat.txt @@ -0,0 +1,223 @@ +// Halloween 2011 +// Authors: alastrim, enchilado, o11c +// This is a function that implements the whole quest (or at least stage 1) +// Note: this function doesn't usually return + +// In the appropriate NPCs, do something like: +//+ set @hw2011_npc_id, $@hw2011_npc_vincent; +//+ if (gettime(7) == $@hw2011_year && gettime(6) == 10 && gettime(5) >= $@hw2011_start_day) +//+ callfunc "TrickOrTreat2011"; + +// Variables: +// $@hw2011_maskmemory = Sliced Array containing the record of the last masks used to trick or treat each NPC. +// @hw2011_npc_id = NPC id, this variable is set when calling this function by an NPC +// hw2011 = Permanent variable used to control your progress in the quest. +// The high bits are used to keep track of the NPCs you already tricked while showing your face. +// The low bits are used to keep track of how many times you've gotten treats. +// Currently, the vague plan is 16 for each, but we may need to use this variable for the second part of the quest. + +function|script|TrickOrTreat2011|{ + if (BaseLevel < $@hw2011_min_level) + goto L_QuickReturn; + menu + "Trick or Treat", -, + "[Go to normal NPC dialog]", L_QuickReturn; + + set @mask, getequipid(equip_head); + if (@mask == 647) + menu + "Reset my quest state", L_ResetMe, + "Reset this NPC's mask memory", L_ResetMask, + "Just do the quest", -; +L_Begin: + // must be early to handle all the one-off mes;s in the init stuff + mes $@hw2011_npc_names$[@hw2011_npc_id]; + + if (@mask == -1) + goto L_NoMask; + + // set the scare factor of the equipped mask + set @mask_index, 0; + set @scare_factor, 1; +L_MaskLoop: + if ($@hw2011_mask_IDs[@mask_index] == @mask) + goto L_FoundMask; + set @mask_index, @mask_index + 1; + if ($@hw2011_mask_IDs[@mask_index]) + goto L_MaskLoop; + // not a mask in the list + set @mask, 0; + goto L_MaskDone; + +L_FoundMask: + set @scare_factor, $@hw2011_scare_factors[@mask_index]; + if (@mask != 616) + goto L_MaskDone; + mes "\"Aaargh... Gross! This is sick! I can't even look at your face...\""; + // I would have done this instead of having the dialog explain + //set @mask, 0; +L_MaskDone: + set @mask_index, 0; + + // check if the mask is in the memory + set @loop, 0; + // Note: we don't handle remembered faces until they get their candy + if (!@mask) + goto L_MaskMemoryNo; + // check if the mask is remembered +L_MaskMemoryCheck: + set @tmp, $@hw2011_maskmemory[8 * @hw2011_npc_id + @loop]; + if (!@tmp) + goto L_MaskMemoryNo; + if (@tmp == @mask) + goto L_MaskMemoryYes; + set @loop, @loop + 1; + if (@loop != $@hw2011_memory_count) + goto L_MaskMemoryCheck; + goto L_MaskMemoryNo; + +L_MaskMemoryYes: + // not necessarily true + mes "\"I remember you, " + getequipname(equip_head) + " person. No more treats for you!\""; + goto L_Close; + +L_MaskMemoryNo: + // player will probably get treats + set @loop, 0; + set @sweets_types, 0; +L_Count_Sweets: + if (!$@hw2011_sweets$[@loop]) + goto L_Check_Inventory; + if (countitem($@hw2011_sweets$[@loop])) + set @sweets_types, @sweets_types + 1; + set @loop, @loop + 1; + goto L_Count_Sweets; + +L_Check_Inventory: + getinventorylist; + if (@inventorylist_count + (@loop - @hw2011_invy) > 100) + goto L_Full_Inventory; + + if (@mask) + goto L_Check_Karma; + // check if the player's face is remembered + if (hw2011 & (0x1 << (31 - @hw2011_npc_id))) + goto L_Remember_Face; + goto L_Tricking_Trick_or_Treat; + +L_Check_Karma: + // Please don't change this, you'll break stuff. + if (rand($@hw2011_num_npcs, 0xffff) <= (hw2011 & 0xffff)) + goto L_Cheater; + goto L_Tricking_Trick_or_Treat; + +L_Cheater: + mes "I recognize you despite your mask, you have been taking sweets you do not deserve."; + goto L_Close; + +L_Remember_Face: + // mes "You've been here before; I remember your face"; + mes "\"I remember your face, " + strcharinfo(0) + ". No more treats for you!\""; + goto L_Close; + + +L_Tricking_Trick_or_Treat: + // moved above +// mes $@hw2011_npc_names$[@hw2011_npc_id]; + mes $@hw2011_greetings$[@hw2011_npc_id]; + next; + // TODO: should we randomize these? (in a subsequent commit) + menu + $@hw2011_trick_notscary$[@hw2011_npc_id], L_Tricking_Notscary, + $@hw2011_trick_scary$[@hw2011_npc_id], L_Tricking_Scary, + $@hw2011_trick_veryscary$[@hw2011_npc_id], L_Tricking_Veryscary; + +L_Tricking_Notscary: + mes $@hw2011_npc_names$[@hw2011_npc_id]; + mes $@hw2011_react_notscary$[@hw2011_npc_id]; + goto L_Tricking_Reward; + +L_Tricking_Scary: + mes $@hw2011_npc_names$[@hw2011_npc_id]; + mes $@hw2011_react_scary$[@hw2011_npc_id]; + set @scare_factor, @scare_factor * 2; + goto L_Tricking_Reward; + +L_Tricking_Veryscary: + mes $@hw2011_npc_names$[@hw2011_npc_id]; + mes $@hw2011_react_veryscary$[@hw2011_npc_id]; + set @scare_factor, @scare_factor * 3; + goto L_Tricking_Reward; + +L_Tricking_Reward: + if (!@scare_factor) + goto L_Tricking_End; + // NOTE: it gives out one piece at a time, but can loop several times + getitem $@hw2011_sweets$[rand(21)], 1; + + set @scare_factor, @scare_factor - 1; + goto L_Tricking_Reward; +L_SetRememberFace: + set hw2011, hw2011 | (0x1 << (31 - @hw2011_npc_id)); + goto L_Close; + +L_Tricking_End: + mes $@hw2011_npc_names$[@hw2011_npc_id]; + mes "\"That should be enough sweets for you. Thanks for participating!\""; + if (!@mask) + goto L_SetRememberFace; + + // add the player's mask to the list + set @loop, 7; +L_SetRememberMask: + set $@hw2011_maskmemory[8 * @hw2011_npc_id + @loop], $@hw2011_maskmemory[8 * @hw2011_npc_id + @loop - 1]; + set @loop, @loop - 1; + if (@loop) + goto L_SetRememberMask; + set $@hw2011_maskmemory[8 * @hw2011_npc_id], @mask; + set hw2011, hw2011 + 1; + goto L_Close; + +L_Full_Inventory: + mes $@hw2011_npc_names$[@hw2011_npc_id]; + mes "\"You are trying to collect candy but you have no space to carry all the kinds of stuff that I have to offer! Please, save room for more stuff and come back.\""; + goto L_Close; + +L_ScaryFace: + mes "\"Eeeeeeeeeeeeeeeeeeeeeeeeeeekkkkkkkkkkkkkkkkk!!!\""; + mes "\"Oh, that's your face ...\""; + next; + set @mask, 0; + set @scarefactor, 5; + goto L_MaskDone; + +L_NoMask: + // TODO: are there any other players to make fun of? + if (getcharid(3) == 2160466 || getcharid(3) == 2177906 || getcharid(3) == 2157647) + goto L_ScaryFace; + mes $@hw2011_npc_names$[@hw2011_npc_id]; + mes "\"Hey " + strcharinfo(0) + ", are you trying to scare me with your face? Interesting! hahaha...\""; + goto L_Close; + +L_Close: + set @tmp, 0; + set @mask, 0; + + set @loop, 0; + set @menu, 0; + set @hw2011_npc_id, 0; + close; + +L_QuickReturn: + set @hw2011_npc_id, 0; + return; + +L_ResetMe: + set hw2011, 0; + goto L_Close; + +L_ResetMask: + // the rest will be implicitly cleared + set $@hw2011_maskmemory[8 * @hw2011_npc_id], 0; + goto L_Close; +} diff --git a/world/map/npc/scripts.conf b/world/map/npc/scripts.conf index 9557a361..a15e57f6 100644 --- a/world/map/npc/scripts.conf +++ b/world/map/npc/scripts.conf @@ -84,3 +84,10 @@ import: npc/_import.txt // npc: npc/halloween/2010/gak.txt // import: npc/xmas/2010/_import.txt + +// it's probably safe to just leave NPCs as-is when disabling +// this is a pretty well-behaved quest +// of course, we haven't written a part 2 yet +// There has been some discussion about making this an annual quest, +// although there would need to be more work for that. +import: npc/halloween/2011/_import.txt -- cgit v1.2.3-60-g2f50