From dc4e317c99519efb45b23e5402ffc52359f8d319 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sat, 1 May 2021 15:08:05 -0300 Subject: Rewrite Hide'n'Seek quest with new quest system because HoraK was annoyed. --- db/quest_db.conf | 4 + npc/029-1/hideandseek.txt | 198 +++++++++++++++++++++---------------------- npc/functions/clear_vars.txt | 3 + 3 files changed, 104 insertions(+), 101 deletions(-) diff --git a/db/quest_db.conf b/db/quest_db.conf index 1ac277da..18e0818c 100644 --- a/db/quest_db.conf +++ b/db/quest_db.conf @@ -43,6 +43,10 @@ quest_db: ( Id: 21 Name: "CandorQuest_Valon" }, +{ + Id: 22 + Name: "CandorQuest_HideNSeek" +}, // Tonori Quests (60~99) diff --git a/npc/029-1/hideandseek.txt b/npc/029-1/hideandseek.txt index cc7f0dbf..6cb00b09 100644 --- a/npc/029-1/hideandseek.txt +++ b/npc/029-1/hideandseek.txt @@ -12,50 +12,48 @@ OnInit: $@hideandseekNT_ended = (1 << 6); end; } + function script CountHideNSeek { - @hidden_kid_cnt = 0; - if (QL_HIDENSEEK & $@hideandseekNT_found1) - @hidden_kid_cnt = (@hidden_kid_cnt + 1); - if (QL_HIDENSEEK & $@hideandseekNT_found2) - @hidden_kid_cnt = (@hidden_kid_cnt + 1); - if (QL_HIDENSEEK & $@hideandseekNT_found3) - @hidden_kid_cnt = (@hidden_kid_cnt + 1); - if (QL_HIDENSEEK & $@hideandseekNT_found4) - @hidden_kid_cnt = (@hidden_kid_cnt + 1); - if (QL_HIDENSEEK & $@hideandseekNT_found5) - @hidden_kid_cnt = (@hidden_kid_cnt + 1); + .@q=getq2(CandorQuest_HideNSeek); + setq3 CandorQuest_HideNSeek, bitmask_count(.@q); + return getq3(CandorQuest_HideNSeek); +} + +function script UpdateHideNSeek { + setq2 CandorQuest_HideNSeek, getq2(CandorQuest_HideNSeek) | getarg(0); + setq3 CandorQuest_HideNSeek, bitmask_count(getq2(CandorQuest_HideNSeek)); return; } + 029-1,64,90,0 script AyashaDebug NPC258,{ + .@q=getq2(CandorQuest_HideNSeek); mes "[Ayasha Debug]"; menu "Show", L_Show, "Reset", L_Reset, - "Close.", L_close; + "Close.", -; + close; L_Show: - mes "State: " + QL_HIDENSEEK; - if (QL_HIDENSEEK & $@hideandseekNT_started) + mes "State: " + .@q; + if (.@q & $@hideandseekNT_started) mes "Start set"; - if (QL_HIDENSEEK & $@hideandseekNT_found1) + if (.@q & $@hideandseekNT_found1) mes "Found 1 set"; - if (QL_HIDENSEEK & $@hideandseekNT_found2) + if (.@q & $@hideandseekNT_found2) mes "Found 2 set"; - if (QL_HIDENSEEK & $@hideandseekNT_found3) + if (.@q & $@hideandseekNT_found3) mes "Found 3 set"; - if (QL_HIDENSEEK & $@hideandseekNT_found4) + if (.@q & $@hideandseekNT_found4) mes "Found 4 set"; - if (QL_HIDENSEEK & $@hideandseekNT_found5) + if (.@q & $@hideandseekNT_found5) mes "Found 5 set"; - if (QL_HIDENSEEK & $@hideandseekNT_ended) + if (.@q & $@hideandseekNT_ended) mes "Complete set"; - goto L_close; + close; L_Reset: - QL_HIDENSEEK = 0; - goto L_close; - -L_close: + setq CandorQuest_HideNSeek, 0, 0; close; OnInit: @@ -63,80 +61,80 @@ OnInit: disablenpc "AyashaDebug"; end; } + 029-1,62,90,0 script Ayasha NPC258,{ @child_number = 0; callfunc "XmasList"; - @Exp = 75; + .@q=getq2(CandorQuest_HideNSeek); - if (QL_HIDENSEEK > 63) goto L_Done; - if (QL_HIDENSEEK == 63) goto L_Reward; - if (QL_HIDENSEEK > 0) goto L_Doing; + if (.@q > 63) goto L_Done; + if (.@q == 63) goto L_Reward; + if (getq(CandorQuest_HideNSeek)) goto L_Doing; - mes "You see a girl who is holding her hands in front of her face."; - mes "[Ayasha]"; - mes "\"98... 99... 100!\""; - mes "She takes away her hands and looks up."; + mes l("You see a girl who is holding her hands in front of her face."); + mesn; + mesq l("98... 99... 100!"); + mesc l("She takes away her hands and looks up."); menu "Hello, what are you doing?",L_Next, - "(Leave)",L_close; + "(Leave)",-; + close; L_Next: - mes "[Ayasha]"; + mesn; mes "\"I'm playing hide and seek with my friends!"; mes "Do you want to play with us?\""; menu "Sure, sounds like fun.",L_Next1, - "I'm busy with more important things!",L_close; + "I'm busy with more important things!",-; + close; L_Next1: - mes "[Ayasha]"; + mesn; mes "\"Great! You can take my turn with searching. You need to find all five of my friends."; mes "They're hiding somewhere on the island, you will have to explore to find them. They could be hiding anywhere.\""; - QL_HIDENSEEK = QL_HIDENSEEK | $@hideandseekNT_started; - goto L_close; + setq CandorQuest_HideNSeek, 1, 0, 0; + close; L_Doing: - callfunc "CountHideNSeek"; - mes "[Ayasha]"; - mes "\"You still need to find some of my friends. You have found " + @hidden_kid_cnt + " out of 5 of my friends.\""; - mes "\"Remember, they're hiding somewhere on the island, you will have to explore to find them. They could be hiding anywhere.\""; - goto L_close; + mesn; + mesq l("You still need to find some of my friends. You have found %d out of 5 of my friends.", CountHideNSeek()); + mesq l("Remember, they're hiding somewhere on the island, you will have to explore to find them. They could be hiding anywhere."); + close; L_Reward: - mes "[Ayasha]"; - mes "\"Oh, you found them all! Good job! Now it's my turn with searching again. Go and hide!\""; - getexp @Exp, 0; - QL_HIDENSEEK = QL_HIDENSEEK | $@hideandseekNT_ended; + mesn; + mesq l("Oh, you found them all! Good job! Now it's my turn with searching again. Go and hide!"); + getexp 75, 0; + setq CandorQuest_HideNSeek, 2, 127, 0; menu "I think I need to do other things now.",L_Next2; L_Next2: - mes "[Ayasha]"; + mesn; mes "\"Oh, ok."; mes "Have you already seen Hurnscald? It's a very exciting place! I love the entertainer. She can make so many funny faces.\""; - goto L_close; + close; L_Done: - mes "[Ayasha]"; + mesn; mes "\"Hello! It was fun to play with you."; mes "When you go to the Hurnscald, you can say hello to Mikhail. He's very nice! But very shy.\""; - goto L_close; - -L_close: - @Exp = 0; close; } 029-1,50,105,0 script Latif NPC262,{ @child_number = 1; callfunc "XmasList"; - @Exp = 15; + .@Exp = 15; - if (QL_HIDENSEEK > 63) goto L_Done; - if ((QL_HIDENSEEK > 0) && !(QL_HIDENSEEK & $@hideandseekNT_found1)) goto L_Find; - if (QL_HIDENSEEK > 0) goto L_Doing; + .@q=getq(CandorQuest_HideNSeek); + .@q2=getq2(CandorQuest_HideNSeek); + if (.@q2 > 63) goto L_Done; + if (.@q && !(.@q2 & $@hideandseekNT_found1)) goto L_Find; + if (.@q) goto L_Doing; mes "You see a kid hiding behind a box."; menu @@ -165,17 +163,16 @@ L_Agree: L_Find: mes "[Latif]"; mes "\"Hey! Ah, you found me. Well done. But my hiding place wasn't that difficult this time.\""; - getexp @Exp, 0; - QL_HIDENSEEK = QL_HIDENSEEK | $@hideandseekNT_found1; + getexp .@Exp, 0; + UpdateHideNSeek($@hideandseekNT_found1); mes "\"Here, do you want a candy?\""; getitem "Candy", 1; goto L_close; L_Doing: - callfunc "CountHideNSeek"; mes "[Latif]"; mes "\"You didn't find all of us yet? Seems like the other ones found a better place to hide.\""; - mes "\"" + @hidden_kid_cnt + " out of 5 have been found.\""; + mesq l("%d out of 5 have been found.", CountHideNSeek()); goto L_close; L_Done: @@ -184,18 +181,19 @@ L_Done: goto L_close; L_close: - @Exp = 0; close; } 029-1,48,67,0 script Charda NPC260,{ @child_number = 2; callfunc "XmasList"; - @Exp = 15; + .@Exp = 15; - if (QL_HIDENSEEK > 63) goto L_Done; - if ((QL_HIDENSEEK > 0) && !(QL_HIDENSEEK & $@hideandseekNT_found2)) goto L_Find; - if (QL_HIDENSEEK > 0) goto L_Doing; + .@q=getq(CandorQuest_HideNSeek); + .@q2=getq2(CandorQuest_HideNSeek); + if (.@q2 > 63) goto L_Done; + if (.@q && !(.@q2 & $@hideandseekNT_found2)) goto L_Find; + if (.@q) goto L_Doing; mes "[Charda]"; mes "\"Hello. Psht, be careful. I'm playing hide and seek with Ayasha. You'll draw attention to my hiding place.\""; @@ -205,8 +203,8 @@ L_close: L_Find: mes "[Charda]"; mes "\"Oh! Got me! You're good at this.\""; - getexp @Exp, 0; - QL_HIDENSEEK = QL_HIDENSEEK | $@hideandseekNT_found2; + getexp .@Exp, 0; + UpdateHideNSeek($@hideandseekNT_found2); mes "She takes something out of her pocket."; mes "\"I'm hungry now. Do you want chocolate too?\""; getitem "ChocolateBar", 1; @@ -215,10 +213,9 @@ L_Find: goto L_close; L_Doing: - callfunc "CountHideNSeek"; mes "[Charda]"; mes "\"Did you find the others yet?\""; - mes "\"Hrmm, no looks like only " + @hidden_kid_cnt + " out of 5 have been found.\""; + mesq l("Hrmm, no looks like only %d out of 5 have been found.", CountHideNSeek()); goto L_close; L_Done: @@ -231,18 +228,19 @@ L_Done: goto L_close; L_close: - @Exp = 0; close; } 029-1,100,36,0 script Faris NPC259,{ @child_number = 3; callfunc "XmasList"; - @Exp = 25; + .@Exp = 25; - if (QL_HIDENSEEK > 63) goto L_Done; - if ((QL_HIDENSEEK > 0) && !(QL_HIDENSEEK & $@hideandseekNT_found3)) goto L_Find; - if (QL_HIDENSEEK > 0) goto L_Doing; + .@q=getq(CandorQuest_HideNSeek); + .@q2=getq2(CandorQuest_HideNSeek); + if (.@q2 > 63) goto L_Done; + if (.@q && !(.@q2 & $@hideandseekNT_found3)) goto L_Find; + if (.@q) goto L_Doing; mes "[Faris]"; mes "\"Oh, hi there. What are you doing here on the beach?\""; @@ -258,19 +256,18 @@ L_Next: L_Find: mes "[Faris]"; mes "\"You found me! Well done. You look a bit thirsty, here.\""; - getexp @Exp, 0; - getitem "CactusDrink", 1; - QL_HIDENSEEK = QL_HIDENSEEK | $@hideandseekNT_found3; + getexp .@Exp, 0; + getitem CactusDrink, 1; + UpdateHideNSeek($@hideandseekNT_found3); mes "\"It's really cool you're playing with us. I'm sure you have a lot of other things to do."; mes "You're an adventurer, right? I want to become an adventurer too when I'm grown up. I'll talk to Aidan then.\""; mes "\"Aidan is outside Sorfina's place and you can register there for monster points. That's something the Wizard's Council made up. They reward you for slaying monsters. It's so cool.\""; goto L_close; L_Doing: - callfunc "CountHideNSeek"; mes "[Faris]"; mes "\"Are you still searching for the others? Nobody else is here.\""; - mes "\"It seems you found " + @hidden_kid_cnt + " out of 5 of my friends.\""; + mesq l("It seems you found %d out of 5 of my friends.", CountHideNSeek()); goto L_close; L_Done: @@ -279,7 +276,6 @@ L_Done: goto L_close; L_close: - @Exp = 0; close; } @@ -287,11 +283,13 @@ L_close: @child_number = 4; callfunc "XmasList"; - @Exp = 15; + .@Exp = 15; - if (QL_HIDENSEEK > 63) goto L_Done; - if ((QL_HIDENSEEK > 0) && !(QL_HIDENSEEK & $@hideandseekNT_found4)) goto L_Find; - if (QL_HIDENSEEK > 0) goto L_Doing; + .@q=getq(CandorQuest_HideNSeek); + .@q2=getq2(CandorQuest_HideNSeek); + if (.@q2 > 63) goto L_Done; + if (.@q && !(.@q2 & $@hideandseekNT_found4)) goto L_Find; + if (.@q) goto L_Doing; mes "[Rasin]"; mes "\"The harbor is to the south from here. There you can take a ferry to other places."; @@ -301,15 +299,14 @@ L_close: L_Find: mes "[Rasin]"; mes "\"Ah, you found me. I need to find a better place to hide next time.\""; - getexp @Exp, 0; - QL_HIDENSEEK = QL_HIDENSEEK | $@hideandseekNT_found4; + getexp .@Exp, 0; + UpdateHideNSeek($@hideandseekNT_found4); goto L_close; L_Doing: - callfunc "CountHideNSeek"; mes "[Rasin]"; mes "\"Hehe, I'm curious when you'll have found all of us.\""; - mes "\"There are " + @hidden_kid_cnt + " out of 5 found.\""; + mesq l("There are %d out of 5 found.", CountHideNSeek()); goto L_close; L_Done: @@ -319,7 +316,6 @@ L_Done: goto L_close; L_close: - @Exp = 0; close; } @@ -327,11 +323,13 @@ L_close: @child_number = 5; callfunc "XmasList"; - @Exp = 15; + .@Exp = 15; - if (QL_HIDENSEEK > 63) goto L_Done; - if ((QL_HIDENSEEK > 0) && !(QL_HIDENSEEK & $@hideandseekNT_found5)) goto L_Find; - if (QL_HIDENSEEK > 0) goto L_Doing; + .@q=getq(CandorQuest_HideNSeek); + .@q2=getq2(CandorQuest_HideNSeek); + if (.@q2 > 63) goto L_Done; + if (.@q && !(.@q2 & $@hideandseekNT_found5)) goto L_Find; + if (.@q) goto L_Doing; mes "You see a girl standing behind the wheat. She has a look of intense concentration on her face."; menu @@ -347,15 +345,14 @@ L_Find: mes "[Ghada]"; mes "\"Oh no! You found me! You must be very clever."; mes "My friend Sandra is clever too, but she said it's a waste of time to play hide and seek.\""; - getexp @Exp, 0; - QL_HIDENSEEK = QL_HIDENSEEK | $@hideandseekNT_found5; + getexp .@Exp, 0; + UpdateHideNSeek($@hideandseekNT_found5); goto L_close; L_Doing: - callfunc "CountHideNSeek"; mes "[Ghada]"; mes "\"Are you still searching for the others? I'm sure you'll find them soon.\""; - mes "\"You found " + @hidden_kid_cnt + " out of 5 us.\""; + mesq l("You found %d out of 5 us.", CountHideNSeek()); goto L_close; L_Done: @@ -364,6 +361,5 @@ L_Done: goto L_close; L_close: - @Exp = 0; close; } diff --git a/npc/functions/clear_vars.txt b/npc/functions/clear_vars.txt index 8f2729b0..a93d59ad 100644 --- a/npc/functions/clear_vars.txt +++ b/npc/functions/clear_vars.txt @@ -6,6 +6,9 @@ function script ClearVariables { setq CandorQuest_Valon, QL_VALON; QL_VALON=0; } + if (QL_HIDENSEEK) { + setq CandorQuest_HideNSeek, (QL_HIDENSEEK >= 64 ? 2 : 1), (QL_HIDENSEEK-1); + } // Don't ask me what code below does // ---------------------------------- -- cgit v1.2.3-60-g2f50