From d451a097f3ddc03c2552a8962fe86316440884ec Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Thu, 28 Apr 2022 16:11:01 -0300 Subject: Note: instance_attach() can't deal with instance variables --- npc/014-2-2/_import.txt | 1 + npc/014-2-2/gemini.txt | 93 +++++++++++++++++++++++++++++++++++++++++++++++++ npc/014-2-2/valia.txt | 85 +++++--------------------------------------- npc/034-2/gemini.txt | 2 +- npc/034-3/_import.txt | 1 + npc/034-3/gemini.txt | 7 ++++ npc/functions/timer.txt | 2 +- 7 files changed, 112 insertions(+), 79 deletions(-) create mode 100644 npc/014-2-2/gemini.txt create mode 100644 npc/034-3/gemini.txt diff --git a/npc/014-2-2/_import.txt b/npc/014-2-2/_import.txt index 4db8f66f6..152644507 100644 --- a/npc/014-2-2/_import.txt +++ b/npc/014-2-2/_import.txt @@ -1,4 +1,5 @@ // Map 014-2-2: Forsaken Inn // This file is generated automatically. All manually added changes will be removed when running the Converter. "npc/014-2-2/_warps.txt", +"npc/014-2-2/gemini.txt", "npc/014-2-2/valia.txt", diff --git a/npc/014-2-2/gemini.txt b/npc/014-2-2/gemini.txt new file mode 100644 index 000000000..898d12e9e --- /dev/null +++ b/npc/014-2-2/gemini.txt @@ -0,0 +1,93 @@ +// TMW2 scripts. +// Authors: +// Jesusalva +// Description: +// Gemini Sisters Quest - Central Core + +034-1,0,0,0 script #Gemini NPC_HIDDEN,{ + end; + +OnCoreInit: + debugmes "CORE INIT, Inst = %d", instance_id(); + .@p = getcharid(1); + instance_attach($@VALIA_INST[.@p]); + debugmes "Attached to %d", $@VALIA_INST[.@p]; + debugmes "New Inst = %d", instance_id(); + @mystatus = 0; + sleep2(200); + if (!'STATUS) + 'STATUS = 1; + // FALLTHROUGH +OnCore: + if (!compare(getmap(), "val")) end; + .@p = getcharid(1); + instance_attach($@VALIA_INST[.@p]); + // Always true on first interaction + // This handles new stages for person + if (@mystatus != 'STATUS) { + switch ('STATUS) { + case 1: // Quest initiated + @mystatus = 1; + // Spawn monsters + areamonster("val1@"+.@p, 20, 20, 60, 60, strmobinfo(1, GreenSlime), GreenSlime, (BaseLevel/15), "Valia::OnGSlime"); + areamonster("val1@"+.@p, 20, 20, 70, 60, strmobinfo(1, LogHead), LogHead, (BaseLevel/15), "Valia::OnLHead"); + areamonster("val1@"+.@p, 20, 20, 70, 60, strmobinfo(1, ForestMushroom), ForestMushroom, (BaseLevel/12), "Valia::OnFShroom"); + areamonster("val1@"+.@p, 20, 20, 70, 60, strmobinfo(1, RedMushroom), RedMushroom, 1+(BaseLevel/30), "Valia::OnRShroom"); + break; + case 2: // Looking for a runestone + break; + case 3: // Runestone was found + getexp 8132, 657; + break; + case 4: // Desert unlocked, but no clue on what to do + dispbottom l("You hear a noise from distance."); + // Spawn monsters + areamonster("val1@"+.@p, 100, 20, 170, 60, strmobinfo(1, CaveSnake), CaveSnake, 2, "Valia::OnCSnake"); + areamonster(getmap(), 100, 20, 170, 60, strmobinfo(1, MagicGoblin), MagicGoblin, 1, "Valia::OnMGoblin"); + // These refuse to respawn but are numerous + // Thus far, the quest is still easy. But soon it won't be. + areamonster(getmap(), 100, 20, 170, 60, strmobinfo(1, MountainSnake), MountainSnake, 1+(BaseLevel/24)); + areamonster(getmap(), 100, 20, 170, 60, strmobinfo(1, DarkLizard), DarkLizard, 1+(BaseLevel/20)); + areamonster(getmap(), 100, 20, 170, 60, strmobinfo(1, WickedMushroom), WickedMushroom, 1+(BaseLevel/32)); + areamonster(getmap(), 100, 20, 170, 60, strmobinfo(1, EliteDuck), EliteDuck, 1); + break; + case 6: // Passage Open + if (countitem(SealedSoul)) + delitem SealedSoul, countitem(SealedSoul); + dispbottom l("You hear waterfall opening in distance."); + // FALLTHROUGH + case 5: // JackO shows up + getexp 32000, 1400; + break; + case 7: // Ambushed & Captured + @lockpicks=false; + // Prision Area + .@m=any(Bandit, RobinBandit, SleepingBandit); + areamonster("val2@"+.@p, 52, 93, 70, 98, strmobinfo(1, .@m), .@m, 1); + .@m=any(Bandit, RobinBandit, SleepingBandit); + areamonster("val2@"+.@p, 52, 93, 70, 98, strmobinfo(1, .@m), .@m, 1); + // Ante-chamber + areamonster("val2@"+.@p, 69, 96, 85, 107, strmobinfo(1, Bandit), Bandit, 1); + .@m=any(Bandit, RobinBandit, SleepingBandit, RobinBandit); + areamonster("val2@"+.@p, 69, 96, 85, 107, strmobinfo(1, .@m), .@m, 1); + // Reception & Lord Desk + areamonster("val2@"+.@p, 50, 30, 80, 75, strmobinfo(1, Bandit), Bandit, (BaseLevel/15)); + areamonster("val2@"+.@p, 50, 30, 80, 75, strmobinfo(1, RobinBandit), RobinBandit, (BaseLevel/25)); + // Whole Map + areamonster("val2@"+.@p, 20, 24, 78, 72, strmobinfo(1, Archant), Archant, (BaseLevel/8)); + // Great Hall + areamonster("val2@"+.@p, 25, 24, 50, 45, strmobinfo(1, RobinBandit), RobinBandit, (BaseLevel/22)); + areamonster("val2@"+.@p, 25, 24, 50, 45, strmobinfo(1, Assassin), Assassin, (BaseLevel/20)); + areamonster("val2@"+.@p, 25, 24, 50, 45, strmobinfo(1, Bandit), Bandit, (BaseLevel/18)); + areamonster("val2@"+.@p, 25, 24, 50, 45, strmobinfo(1, HoodedNinja), HoodedNinja, 1); + break; + case 8: // Key retrieved + getexp 128000, 2000; + break; + } + } + addtimer(5000, "#Gemini::OnCore"); + end; +} + + diff --git a/npc/014-2-2/valia.txt b/npc/014-2-2/valia.txt index 892f5641f..5d02af384 100644 --- a/npc/014-2-2/valia.txt +++ b/npc/014-2-2/valia.txt @@ -18,6 +18,7 @@ function script GeminiCheck { die(); end; } + return; } // You killed a mob @@ -117,7 +118,7 @@ function script GeminiFail { mesq l("Good. I hope you have stocked everything. The time limit is 4 hours."); // Only first attempt is free - all others are charged - if (getq(HurnscaldQuest_Gemini)) { + if (getq(HurnscaldQuest_Gemini) && !is_gm()) { next; mesn; mesq l("Actually, I need help with reagents this time. Bring me a %s and a %s and I'll gladly warp you... again.", getitemlink(GemPowder), getitemlink(EverburnPowder)); @@ -135,11 +136,12 @@ function script GeminiFail { } // Handle first attempt + clear; mesn; mesq l("Good. Here, take this key and hide it. I will quickly brief you:"); mes ""; mesc l(".:: GEMINI ASSASSINS QUEST ::."), 3; - mesc ("Recommended Level: %d+", 85); + mesc l("Recommended Level: %d+", 85); mes ""; mes l("- The goal is to rescue Luvia from Isabamuth. She has been ##Bbrainwashed##b."); mes l("- Luvia is a powerful mage and Isbamuth is watching, so teleporting directly would be risky."); @@ -149,6 +151,8 @@ function script GeminiFail { mesc l("- If you fail, you'll need to pay me ingredients to try again!"), 1; mes ""; mesc l("Good luck!"); + next; + closeclientdialog; compareandsetq HurnscaldQuest_Gemini, 0, 1; @@ -176,85 +180,12 @@ function script GeminiFail { instance_init(.@inst); // Warp everyone and add timers - partytimer("014-2-2", 1000, "Valia::OnCoreInit", getcharid(1)); + partytimer("014-2-2", 10, "#Gemini::OnCoreInit", getcharid(1)); + sleep2(100); warpparty("val1@"+.@p, 24, 24, getcharid(1), "014-2-2", true); close; // Macros -OnCoreInit: - @mystatus = 0; - if (!'STATUS) - 'STATUS = 1; -OnCore: - if (!compare(getmap(), "val")) end; - .@p = getcharid(1); - // Always true on first interaction - // This handles new stages for person - if (@mystatus != 'STATUS) { - switch ('STATUS) { - case 1: // Quest initiated - @mystatus = 1; - // Spawn monsters - areamonster("val1@"+.@p, 20, 20, 60, 60, strmobinfo(1, GreenSlime), GreenSlime, (BaseLevel/15), "Valia::OnGSlime"); - areamonster("val1@"+.@p, 20, 20, 70, 60, strmobinfo(1, LogHead), LogHead, (BaseLevel/15), "Valia::OnLHead"); - areamonster("val1@"+.@p, 20, 20, 70, 60, strmobinfo(1, ForestMushroom), ForestMushroom, (BaseLevel/12), "Valia::OnFShroom"); - areamonster("val1@"+.@p, 20, 20, 70, 60, strmobinfo(1, RedMushroom), RedMushroom, 1+(BaseLevel/30), "Valia::OnRShroom"); - break; - case 2: // Looking for a runestone - break; - case 3: // Runestone was found - getexp 8132, 657; - break; - case 4: // Desert unlocked, but no clue on what to do - dispbottom l("You hear a noise from distance."); - // Spawn monsters - areamonster("val1@"+.@p, 100, 20, 170, 60, strmobinfo(1, CaveSnake), CaveSnake, 2, "Valia::OnCSnake"); - areamonster(getmap(), 100, 20, 170, 60, strmobinfo(1, MagicGoblin), MagicGoblin, 1, "Valia::OnMGoblin"); - // These refuse to respawn but are numerous - // Thus far, the quest is still easy. But soon it won't be. - areamonster(getmap(), 100, 20, 170, 60, strmobinfo(1, MountainSnake), MountainSnake, 1+(BaseLevel/24)); - areamonster(getmap(), 100, 20, 170, 60, strmobinfo(1, DarkLizard), DarkLizard, 1+(BaseLevel/20)); - areamonster(getmap(), 100, 20, 170, 60, strmobinfo(1, WickedMushroom), WickedMushroom, 1+(BaseLevel/32)); - areamonster(getmap(), 100, 20, 170, 60, strmobinfo(1, EliteDuck), EliteDuck, 1); - break; - case 6: // Passage Open - if (countitem(SealedSoul)) - delitem SealedSoul, countitem(SealedSoul); - dispbottom l("You hear waterfall opening in distance."); - // FALLTHROUGH - case 5: // JackO shows up - getexp 32000, 1400; - break; - case 7: // Ambushed & Captured - @lockpicks=false; - // Prision Area - .@m=any(Bandit, RobinBandit, SleepingBandit); - areamonster("val2@"+.@p, 52, 93, 70, 98, strmobinfo(1, .@m), .@m, 1); - .@m=any(Bandit, RobinBandit, SleepingBandit); - areamonster("val2@"+.@p, 52, 93, 70, 98, strmobinfo(1, .@m), .@m, 1); - // Ante-chamber - areamonster("val2@"+.@p, 69, 96, 85, 107, strmobinfo(1, Bandit), Bandit, 1); - .@m=any(Bandit, RobinBandit, SleepingBandit, RobinBandit); - areamonster("val2@"+.@p, 69, 96, 85, 107, strmobinfo(1, .@m), .@m, 1); - // Reception & Lord Desk - areamonster("val2@"+.@p, 50, 30, 80, 75, strmobinfo(1, Bandit), Bandit, (BaseLevel/15)); - areamonster("val2@"+.@p, 50, 30, 80, 75, strmobinfo(1, RobinBandit), RobinBandit, (BaseLevel/25)); - // Whole Map - areamonster("val2@"+.@p, 20, 24, 78, 72, strmobinfo(1, Archant), Archant, (BaseLevel/8)); - // Great Hall - areamonster("val2@"+.@p, 25, 24, 50, 45, strmobinfo(1, RobinBandit), RobinBandit, (BaseLevel/22)); - areamonster("val2@"+.@p, 25, 24, 50, 45, strmobinfo(1, Assassin), Assassin, (BaseLevel/20)); - areamonster("val2@"+.@p, 25, 24, 50, 45, strmobinfo(1, Bandit), Bandit, (BaseLevel/18)); - areamonster("val2@"+.@p, 25, 24, 50, 45, strmobinfo(1, HoodedNinja), HoodedNinja, 1); - break; - case 8: // Key retrieved - getexp 128000, 2000; - break; - } - } - addtimer(5000, "Valia::OnCoreInit"); - end; - OnGSlime: fix_mobkill(GreenSlime); .@p = getcharid(1); diff --git a/npc/034-2/gemini.txt b/npc/034-2/gemini.txt index dff5c7668..c19cc5558 100644 --- a/npc/034-2/gemini.txt +++ b/npc/034-2/gemini.txt @@ -135,7 +135,7 @@ OnInstanceInit: end; } -034-2,64,100,0 script Cell Door#G01 NPC_NO_SPRITE,{ +034-2,64,100,0 script Cell Door#G03 NPC_NO_SPRITE,{ if (instance_id() < 0 || getcharid(1) < 1) end; GeminiCheck(7); mes l("A complex lock seems to be posing a threat to you."); diff --git a/npc/034-3/_import.txt b/npc/034-3/_import.txt index 7368b6519..d9fef7bd6 100644 --- a/npc/034-3/_import.txt +++ b/npc/034-3/_import.txt @@ -1,3 +1,4 @@ // Map 034-3: Archipelago // This file is generated automatically. All manually added changes will be removed when running the Converter. "npc/034-3/_mobs.txt", +"npc/034-3/gemini.txt", diff --git a/npc/034-3/gemini.txt b/npc/034-3/gemini.txt new file mode 100644 index 000000000..a41733a39 --- /dev/null +++ b/npc/034-3/gemini.txt @@ -0,0 +1,7 @@ +// TMW2 scripts. +// Authors: +// Jesusalva +// Description: +// Gemini Sisters Quest - Outside the Building + + diff --git a/npc/functions/timer.txt b/npc/functions/timer.txt index ac7d130bd..ee96b2191 100644 --- a/npc/functions/timer.txt +++ b/npc/functions/timer.txt @@ -70,7 +70,7 @@ function script mapdeltimer { function script partytimer { .@c = getunits(BL_PC, .@players, false, getarg(0)); for (.@i = 0; .@i < .@c; .@i++) { - if (getcharid(2, strcharinfo(0,"",.@players[.@i]) ) == getarg(3)) + if (getcharid(1, strcharinfo(0,"",.@players[.@i]) ) == getarg(3)) addtimer(getarg(1), getarg(2), .@players[.@i]); } return .@i; -- cgit v1.2.3-60-g2f50