diff options
Diffstat (limited to 'world/map/npc/052-2')
-rw-r--r-- | world/map/npc/052-2/_import.txt | 6 | ||||
-rw-r--r-- | world/map/npc/052-2/chest.txt | 177 | ||||
-rw-r--r-- | world/map/npc/052-2/janitor.txt | 35 | ||||
-rw-r--r-- | world/map/npc/052-2/lobby.txt | 335 | ||||
-rw-r--r-- | world/map/npc/052-2/mapflags.txt | 1 | ||||
-rw-r--r-- | world/map/npc/052-2/partyroom.txt | 270 | ||||
-rw-r--r-- | world/map/npc/052-2/storage.txt | 188 |
7 files changed, 1012 insertions, 0 deletions
diff --git a/world/map/npc/052-2/_import.txt b/world/map/npc/052-2/_import.txt index 9926e305..be3e2044 100644 --- a/world/map/npc/052-2/_import.txt +++ b/world/map/npc/052-2/_import.txt @@ -3,3 +3,9 @@ map: 052-2.gat npc: npc/052-2/_mobs.txt npc: npc/052-2/_warps.txt +npc: npc/052-2/chest.txt +npc: npc/052-2/janitor.txt +npc: npc/052-2/lobby.txt +npc: npc/052-2/mapflags.txt +npc: npc/052-2/partyroom.txt +npc: npc/052-2/storage.txt diff --git a/world/map/npc/052-2/chest.txt b/world/map/npc/052-2/chest.txt new file mode 100644 index 00000000..41366e4d --- /dev/null +++ b/world/map/npc/052-2/chest.txt @@ -0,0 +1,177 @@ +//----------------------------------------------------------------------------- +// Illia Forsaken Inn - Chest room +// $@illia_progress = 8 +// +// Level progress: +// No progress: Players pick the rewards, then leave, +// with the Hero forced to leave last. +// @illia_got_rewards value: +// 0: player did not pick his reward yet +// 1: player picked his common rewards +// 2: player picked his unique rewards +// 3: player choosed to leave the room +//----------------------------------------------------------------------------- + +052-2.gat,136,73,0|script|Chest|111,{ + + set @step, 8; + if ($@illia_progress < @step) goto L_ShouldNotBeHere; + if (@illia_got_rewards > 2) end; + if (@illia_got_rewards == 2) goto L_AlreadyGotReward; + if (@illia_current_num_rewards > 0) goto L_ResumePick; + set @illia_current_num_rewards, 0; + mes "You find an opened chest which seems full of equipments."; + next; + mes "You realize again you were not the first one to visit this place. But where the others failed, you succeeded."; + goto L_Pick; + +L_ShouldNotBeHere: + percentheal -100, 0; + end; + +onInit: + setarray $@illia_item_common_rewards, 601, 636, 637, 638, 639, 625, 626, 658, 571, 579, 876, 782, 545, 758, 4028, 602, 536, 720, 532, 570, 642; + setarray $@illia_item_unique_rewards, 877, 878, 879, 880; + end; + +L_ResumePick: + mes "Ok. I should continue to dig in this chest..."; + menu + "... and quickly.", L_GetReward, + "... or maybe not. I am out of time.", L_AskLeaving, + "... but I can't carry more stuff.", L_AskLeaving, + "... no, wait a minute.", -; + close; + +L_Pick: + menu + "Let's take what I deserve for all this.", L_GetReward, + "Wait.", -; + close; + +L_GetReward: + if (@illia_got_rewards == 0) + goto L_GetCommonReward; + if (@illia_got_rewards == 1) + goto L_GetUniqueReward; + close; + +L_GetCommonReward: + if (@illia_current_num_rewards == $@illia_num_common_reward_items) + goto L_RewardDone; + getinventorylist; + set @reward, $@illia_item_common_rewards[rand(getarraysize($@illia_item_common_rewards))]; + if ((checkweight(@reward, 1) == 0) || (@inventorylist_count == 100)) + goto L_InventoryNoSpace; + set @illia_current_num_rewards, @illia_current_num_rewards + 1; + getitem @reward, 1; + mes "You found a " + getitemname(@reward) + "!"; + set @reward, 0; + goto L_GetCommonReward; + +L_GetUniqueReward: + if (@illia_current_num_rewards == $@illia_num_unique_reward_items) + goto L_RewardDone; + if (Illia_Uniques_Count >= 2) + goto L_GetUniqueReward2; + getinventorylist; + set @reward, $@illia_item_unique_rewards[rand(getarraysize($@illia_item_unique_rewards))]; + if ((checkweight(@reward, 1) == 0) || (@inventorylist_count == 100)) + goto L_InventoryNoSpace; + next; + mes "You notice an interesting shape hidden under a cover..."; + next; + set @illia_current_num_rewards, @illia_current_num_rewards + 1; + getitem @reward, 1; + mes "You found a " + getitemname(@reward) + "!"; + set Illia_Uniques_Count, Illia_Uniques_Count + 1; + set @reward, 0; + goto L_GetUniqueReward; + +L_GetUniqueReward2: + next; + mes "You find a bunch of gold pieces!"; + next; + set Zeny, Zeny + 150000*($@illia_num_unique_reward_items - @illia_current_num_rewards); + getexp 200000*($@illia_num_unique_reward_items - @illia_current_num_rewards), 0; + set @illia_current_num_rewards, $@illia_num_unique_reward_items; + goto L_GetUniqueReward; + +L_AlreadyGotReward: + mes "I already took my part."; + next; + goto L_AskLeaving; + +L_RewardDone: + set @illia_got_rewards, @illia_got_rewards + 1; + set @illia_current_num_rewards, 0; + next; + if (@illia_got_rewards == 1) + goto L_GetUniqueReward; + goto L_AskLeaving; // @illia_got_rewards == 2 + +L_InventoryNoSpace: + mes "You cannot carry more stuff. Make some room first."; + close; + +L_AskLeaving: + mes "It's time to leave this place now."; + next; + // Force the hero to leave last, as this event triggers the end of the quest + // as well as some dialogs from Valia, when the hero returns. + if (strcharinfo(0) == $@ILLIA_HERO$ && getareausers("052-2.gat", 19, 8, 137, 88) > 1) + goto L_WaitHelpersLeave; + goto L_PrepareLeaving; + +L_WaitHelpersLeave: + mes "However, I'd better wait my friends leave before I do."; + next; + mes "I prefer to know they left safely this place."; + close; + +L_PrepareLeaving: + mes "Use Valia's ring to teleport now?"; + menu + "Yes. Time to make her pay for her trick!", L_Leave, + "No, I still need to see things here.", -; + close; + +L_Leave: + set @illia_got_rewards, 3; + set @illia_current_num_rewards, 0; + addtimer 1000, "Chest::onMsg1"; + addtimer 4000, "Chest::onMsg2"; + addtimer 7000, "Chest::onMsg3"; + addtimer 9000, "Chest::onFx"; + addtimer 10000, "Chest::onRing"; + close; + +onMsg1: + message strcharinfo(0), "At the moment you are wearing the ring, you start to feel dizzy..."; + end; + +onMsg2: + message strcharinfo(0), "Who is Luvia? Something isn't alright... It looks like your memory is rewritten."; + end; + +onMsg3: + message strcharinfo(0), "Damn, this ring! That Valia! Someone..."; + end; + +onFx: + misceffect FX_MAGIC_BLUE_TELEPORT, strcharinfo(0); + end; + +onRing: + warp "007-1.gat", 85 + rand(0,2), 75 + rand(0,2); + if (strcharinfo(0) == $@ILLIA_HERO$) + goto L_ScheduleEnd; + end; + +L_ScheduleEnd: + set $@ILLIA_STATUS, 253; + startnpctimer "Valia"; + cmdothernpc "#IlliaDaemon", "Toggle"; + end; + +} diff --git a/world/map/npc/052-2/janitor.txt b/world/map/npc/052-2/janitor.txt new file mode 100644 index 00000000..9c78d638 --- /dev/null +++ b/world/map/npc/052-2/janitor.txt @@ -0,0 +1,35 @@ +// Lobby janitor +052-2.gat,1,1,0|script|#IlliaJanitor5|127,{ +end; + +OnCommandClean: + // For security, kill all. + killmonster "052-2.gat", "All"; + npcwarp 1, 1, "Luvia?"; + end; + +} + +// Storage janitor +052-2.gat,1,1,0|script|#IlliaJanitor6|127,{ +end; + +OnCommandClean: + killmonster "052-2.gat", "#ItemsInvoker::onDeath"; + npcwarp 1, 1, "#ItemsInvoker"; + end; + +} + +// Final boss janitor +052-2.gat,1,1,0|script|#IlliaJanitor7|127,{ +end; + +OnCommandClean: + killmonster "052-2.gat", "#LuviaDaemon::onDeath"; + killmonster "052-2.gat", "#LuviaDaemon::onWGD"; + npcwarp 83, 28, "#LuviaDaemon"; + npcwarp 88, 15, "Luvia"; + end; + +} diff --git a/world/map/npc/052-2/lobby.txt b/world/map/npc/052-2/lobby.txt new file mode 100644 index 00000000..69953ce9 --- /dev/null +++ b/world/map/npc/052-2/lobby.txt @@ -0,0 +1,335 @@ +//----------------------------------------------------------------------------- +// Illia Forsaken Inn - Lobby +// $@illia_progress = 5 +// +// Level progress: +// 0: Initial state +// 1: Mysterious voice is talking +// 2: Luvia is appearing +// 3: Luvia is waiting for a talk, to trigger the fight +// 4: Hero talked to Luvia. Initiating a talk and demonic spirit waves +// 5: All Demonic spirits waves are spawned +// 6: Demonic spirit waves beaten. Talk while preparing the witch guards +// 7: Luvia is escaping, Witch guards appear +// 8: Witch guards defeated. Door is open. +//----------------------------------------------------------------------------- + +052-2.gat,40,19,0|script|#InnDoorTrigger|32767,2,2,{ + set @step, 5; + if ($@illia_progress < @step) goto L_ShouldNotBeHere; + if ($@illia_level_5_progress == 8) goto L_Warp; + message strcharinfo(0), "A magical field prevents you from going further..."; + end; + +L_Warp: + warp "052-2.gat", 23, 71; + message strcharinfo(0), "This place is full of dust... *coughs*"; + end; + +L_ShouldNotBeHere: + percentheal -100, 0; + end; + +} + +052-2.gat,33,40,0|script|#EntranceTrigger|32767,4,2,{ + set @step, 5; + if ($@illia_progress < @step) goto L_ShouldNotBeHere; + if ($@illia_level_5_progress == 0 && strcharinfo(0) == $@ILLIA_HERO$) goto L_StartVoices; + end; + +L_StartVoices: + set $@illia_level_5_progress, 1; + cmdothernpc "#MysteriousVoice", "Start"; + end; + +L_ShouldNotBeHere: + percentheal -100, 0; + end; +} + +052-2.gat,1,1,0|script|#LuviaShadow|127,{ +end; + +// Escape sequence +OnCommandEscape: + initnpctimer; + end; + +OnTimer100: + if ($@illia_level_5_progress != 7) + end; + npcwarp 39, 35, "#LuviaShadow"; + misceffect FX_DARK_TELEPORT; + npcwarp 1, 1, "Luvia?"; + end; + +OnTimer750: + if ($@illia_level_5_progress != 7) + end; + npcwarp 1, 1, "#LuviaShadow"; + stopnpctimer; + setnpctimer 0; + end; + +// Invoke sequence +OnCommandInvoke: + initnpctimer; + end; + +OnTimer650: + if ($@illia_level_5_progress != 2) + end; + npcwarp 39, 35, "#LuviaShadow"; + misceffect FX_EVIL_SUMMON; + end; + +OnTimer1500: + if ($@illia_level_5_progress != 2) + end; + npcwarp 1, 1, "#LuviaShadow"; + npcwarp 39, 35, "Luvia?"; + set $@illia_level_5_progress, 3; + stopnpctimer; + setnpctimer 0; + end; + +OnNN: + message strcharinfo(0), "The last guard is down. Let's go after Luvia now!"; + end; + +} + +052-2.gat,1,1,0|script|#MysteriousVoice|127,{ +end; + +onInit: + setarray $@illia_lobby_voices$, "Finally.", "I was...", "Waiting...", "For you!"; + end; + +OnCommandStart: + set $@illia_lobby_voices_index, 0; + initnpctimer; + end; + +// Voices loop +OnTimer2000: + if ($@illia_level_5_progress != 1) + end; + npcwarp rand(30,42), rand(32,38), "?"; + cmdothernpc "?", "Talk"; + end; + +OnTimer3000: + if ($@illia_level_5_progress != 1) + end; + npcwarp 1, 1, "?"; + set $@illia_lobby_voices_index, $@illia_lobby_voices_index + 1; + // FIXME Uncomment next line, comment the next next, when getarraysize is repaired. + //if ($@illia_lobby_voices_index < getarraysize($@illia_lobby_voices$)) goto L_Continue; + if ($@illia_lobby_voices_index < 4) + goto L_Continue; + // End the process + stopnpctimer; + setnpctimer 0; + set $@illia_lobby_voices_index, 0; + set $@illia_level_5_progress, 2; + cmdothernpc "#LuviaShadow", "Invoke"; + end; + +L_Continue: + setnpctimer 0; + end; + +} + +// Dummy npc to display the mysterious voice, +// as a workaround to fakenpcname causing problems +052-2.gat,1,1,0|script|?|127,{ +end; + +OnCommandTalk: + npctalk $@illia_lobby_voices$[$@illia_lobby_voices_index]; + end; + +} + +052-2.gat,1,1,0|script|Luvia?|371,2,2{ + if ($@illia_level_5_progress != 3) end; + if (isin("052-2.gat", 37,36, 41,39)) goto L_HandleTalk; + // Notify too far + mes "You see a strange and frightening, yet beautiful woman."; + if (strcharinfo(0) == $@ILLIA_HERO$) + mes "Maybe she knows something about this place."; + close; + +L_HandleTalk: + if (strcharinfo(0) == $@ILLIA_HERO$) + goto L_TalkToHero; + goto L_TalkToHelper; + end; + +L_TalkToHelper: + mes "She gives you a quick look then gives her attention to " + $@ILLIA_HERO$ + "."; + close; + +L_TalkToHero: + set $@illia_level_5_progress, 4; + menu + "Are you Luvia? Your sister Valia sent me to save you! Where is Ismuth?", -; + initnpctimer; + close; + +// Talk sequence timers +OnTimer1500: + if ($@illia_level_5_progress != 4) + end; + npctalk "Yes " + $@ILLIA_HERO$ + ", I am Luvia."; + end; + +OnTimer4500: + if ($@illia_level_5_progress != 4) + end; + npctalk "How nice of all of you to have come to save me!"; + end; + +OnTimer7500: + if ($@illia_level_5_progress != 4) + end; + npctalk "But I fear..."; + end; + +OnTimer10500: + if ($@illia_level_5_progress != 4) + end; + npctalk "... that you are mistaken about who has to be saved!"; + end; + +OnTimer13500: + if ($@illia_level_5_progress != 4) + end; + npctalk "Don't make these faces..."; + end; + +OnTimer16500: + if ($@illia_level_5_progress != 4) + end; + npctalk "Valia is just helping me by sending new soldiers for my personal army!"; + end; + +OnTimer21500: + if ($@illia_level_5_progress != 4) + end; + npctalk "So, if I may... Let's see what you are made of!"; + end; + +// Monster invokes timers +OnTimer24500: + if ($@illia_level_5_progress != 4) + end; + npctalk "Demonotis!"; + misceffect FX_EVIL_SUMMON; + areamonster "052-2.gat", 20, 23, 47, 41, "", 1101, 20 + 16 - 480/(30+$Illia_Luvia_Harvest), "Luvia?::onDSDeath"; + end; + +OnTimer44000: + if ($@illia_level_5_progress != 4) + end; + npctalk "Demonotis!"; + misceffect FX_EVIL_SUMMON; + areamonster "052-2.gat", 20, 23, 47, 41, "", 1101, 28 + 16 - 480/(30+$Illia_Luvia_Harvest), "Luvia?::onDSDeath"; + end; + +OnTimer77000: + if ($@illia_level_5_progress != 4) + end; + npctalk "Demonotis!"; + misceffect FX_EVIL_SUMMON; + areamonster "052-2.gat", 20, 23, 47, 41, "", 1101, 42 + 16 - 480/(30+$Illia_Luvia_Harvest), "Luvia?::onDSDeath"; + // That was the last spawn: reset the timer to start the CheckInvoke loop. + set $@illia_level_5_progress, 5; + setnpctimer 0; + end; + +// Talk and Witch guard invokes timers +OnTimer6500: + if ($@illia_level_5_progress != 6) + end; + npctalk "Okay. You have some skill."; + end; + +OnTimer10000: + if ($@illia_level_5_progress != 6) + end; + npctalk "But that was only the beginning!"; + end; + +OnTimer13000: + if ($@illia_level_5_progress != 6) + end; + npctalk "I'll leave you in the good hands of your predecessors. Farewell!"; + end; + +OnTimer18500: + if ($@illia_level_5_progress != 6) + end; + npctalk "Demonotis Major!"; + misceffect FX_EVIL_SUMMON; + misceffect FX_MAGIC_DARK_EXPLOSION; + areamonster "052-2.gat", 20, 23, 47, 41, "", 1103, 8 + (16 - 480/(30+$Illia_Luvia_Harvest))/3, "Luvia?::onWGDeath"; + end; + +OnTimer20000: + if ($@illia_level_5_progress != 6) + end; + set $@illia_level_5_progress, 7; + cmdothernpc "#LuviaShadow", "Escape"; + setnpctimer 0; + end; + +// Monsters checks timer loop +OnTimer2000: + if ($@illia_progress != 5) + goto L_Clear; + if ($@illia_level_5_progress != 5 && $@illia_level_5_progress != 7) + end; + setnpctimer 0; + // Mock players randomly (more or less once every 40 secs) and if still enough mobs running after them + if ($@illia_level_5_progress == 5 && rand(20) == 0 && (mobcount("052-2.gat", "Luvia?::onDSDeath") > 20)) + npctalk "Ahaha! Run... Run!"; + if ($@illia_level_5_progress == 5 && (mobcount("052-2.gat", "Luvia?::onDSDeath") < 0)) + goto L_AllWavesClear; + if ($@illia_level_5_progress == 7 && (mobcount("052-2.gat", "Luvia?::onWGDeath") < 0)) + goto L_AllWavesClear; + end; + +L_Clear: + stopnpctimer; + setnpctimer 0; + killmonster "052-2.gat", "Luvia?::onDSDeath"; + killmonster "052-2.gat", "Luvia?::onWGDeath"; + end; + +L_AllWavesClear: + set $@illia_level_5_progress, $@illia_level_5_progress + 1; + stopnpctimer; + setnpctimer 0; + if ($@illia_level_5_progress == 6) + startnpctimer; + if ($@illia_level_5_progress == 8) + goto L_ChaseLuvia; + end; + +L_ChaseLuvia: + set $@illia_progress, 6; + set $@illia_max_time, $@illia_max_time + 600; + areatimer "052-2.gat", 19, 18, 48, 43, 2000, "#LuviaShadow::OnNN"; + end; + +onDSDeath: + end; + +onWGDeath: + end; + +} diff --git a/world/map/npc/052-2/mapflags.txt b/world/map/npc/052-2/mapflags.txt new file mode 100644 index 00000000..9c7c1d1c --- /dev/null +++ b/world/map/npc/052-2/mapflags.txt @@ -0,0 +1 @@ +052-2.gat mapflag nosave 007-1,86,76; diff --git a/world/map/npc/052-2/partyroom.txt b/world/map/npc/052-2/partyroom.txt new file mode 100644 index 00000000..f5173c0a --- /dev/null +++ b/world/map/npc/052-2/partyroom.txt @@ -0,0 +1,270 @@ +//----------------------------------------------------------------------------- +// Illia Forsaken Inn - Party room +// $@illia_progress = 6 +// +// Level progress: +// 0: Initial state +// 1: Luvia is talking, then spawns after a teleport +// 2: Luvia spawned, and witch guards may spawn to help +// 3: Luvia is defeated +//----------------------------------------------------------------------------- + +052-2.gat,88,19,0|script|#TriggerDialog|32767,3,2,{ + set @step, 7; + if ($@illia_progress < @step) goto L_ShouldNotBeHere; + if ($@illia_level_7_progress == 0 && strcharinfo(0) == $@ILLIA_HERO$) goto L_SpawnLuvia; + end; + +L_SpawnLuvia: + set $@illia_level_7_progress, 1; + cmdothernpc "Luvia", "Start"; + end; + +L_ShouldNotBeHere: + percentheal -100, 0; + end; + +} + +// A trigger whose only purpose is to place Luvia npcs back in place. +// (even though the Janitor 7 will have done this job) +052-2.gat,77,48,0|script|#TriggerPlaceLuvia|32767,1,1,{ + if (strcharinfo(0) != $@ILLIA_HERO$) end; + if ($@illia_progress == 7 && $@illia_level_7_progress == 0) goto L_PlaceLuvia; + end; + +L_PlaceLuvia: + npcwarp 88, 15, "#LuviaDaemon"; + npcwarp 88, 15, "Luvia"; + end; + +} + +052-2.gat,88,15,0|script|Luvia|371,{ + set @step, 7; + if ($@illia_progress < @step) goto L_ShouldNotBeHere; + if ($@illia_level_7_progress == 0 && strcharinfo(0) == $@ILLIA_HERO$) goto L_Start; + end; + +OnCommandStart: + goto L_Start; + +L_Start: + setnpctimer 0; + if ($@illia_level_7_progress == 1) + startnpctimer; + end; + +L_ShouldNotBeHere: + percentheal -100, 0; + end; + +OnTimer1000: + npctalk "Oh well, who thought you would survive so far?"; + end; + +OnTimer5000: + npctalk "All this way, for nothing, only to die from my hands..."; + end; + +OnTimer10000: + npctalk "Don't worry, you will continue to live, for my sake."; + end; + +OnTimer15000: + npctalk "One piece of advice: get prepared!"; + stopnpctimer; + setnpctimer 0; + cmdothernpc "#LuviaDaemon", "Invoke"; + end; + +} + +052-2.gat,88,15,0|script|#LuviaDaemon|127,{ +end; + +OnCommandInvoke: + setnpctimer 0; + if ($@illia_level_7_progress == 1) + startnpctimer; + end; + +OnTimer2000: + if ($@illia_level_7_progress != 1) end; + misceffect FX_DARK_TELEPORT; + // Kill any mob existing on the map + // That's to terminate any attempt at players mass-summoning mobs + // and hide in a corner of the map. + killmonster "052-2.gat", "All"; + npcwarp 1, 1, "Luvia"; + end; + +OnTimer100: + if ($@illia_progress != 7) + goto L_Clear; + if ($@illia_level_7_progress != 3) + end; + // Trance mode + callsub S_SpawnWitchGuard; + end; + +OnTimer2600: + if ($@illia_level_7_progress != 3) + end; + npcwarp 1, 1, "#LuviaDaemon"; + setnpctimer 0; + end; + +OnTimer5000: + if ($@illia_level_7_progress != 1) + end; + // Warp to the place to spawn luvia once the teleport sequence is finished + if (isloggedin($@ILLIA_HERO_ID) == 0) + end; + attachrid($@ILLIA_HERO_ID); + set $@illia_luvia_x, getx(); + set $@illia_luvia_y, gety(); + npcwarp $@illia_luvia_x, $@illia_luvia_y, "#LuviaDaemon"; + + detachrid; + // This is a fix to force the official mana client to display a npc after a warp. + // Note: the manaplus client do not need this. + disablenpc "#LuviaDaemon"; + end; + +OnTimer5500: + if ($@illia_level_7_progress != 1) end; + // See the note above. + enablenpc "#LuviaDaemon"; + misceffect FX_EVIL_SUMMON; + misceffect FX_CHANNELLING_CAST; + monster "052-2.gat", $@illia_luvia_x, $@illia_luvia_y, "", 1102, 1, "#LuviaDaemon::onDeath"; + set $@illia_luvia_x, 0; + set $@illia_luvia_y, 0; + end; + +OnTimer9000: + if ($@illia_level_7_progress != 1) end; + set $@illia_luvia_trance_delay, 900; // 15 minutes before turning in trance mode + set $@illia_witch_guard_threshold, 30 + ($Illia_Luvia_Harvest*3)/5; + if ($@illia_witch_guard_threshold > 100) + set $@illia_witch_guard_threshold, 100; + set $@illia_level_7_progress, 2; + npcwarp 1, 1, "#LuviaDaemon"; + setnpctimer 0; + end; + +// Extra monster spawn +OnTimer26000: + if ($@illia_progress != 7) + goto L_Clear; + if ($@illia_level_7_progress != 2) + end; + // The more players Luvia "harvested", the stronger she is. + if (rand(100) >= $@illia_witch_guard_threshold) + end; + // Decrease her power over time. + set $@illia_witch_guard_threshold, $@illia_witch_guard_threshold - 7; + // Keep always a small probability when it reached the minimum + if ($@illia_witch_guard_threshold <= 0) + set $@illia_witch_guard_threshold, 6 + $Illia_Luvia_Harvest/5; + callsub S_SpawnWitchGuard; + end; + +S_SpawnWitchGuard: + if (isloggedin($@ILLIA_HERO_ID) == 0) + end; + attachrid($@ILLIA_HERO_ID); + npcwarp getx(), gety(), "#LuviaDaemon"; + misceffect FX_EVIL_SUMMON; + misceffect FX_GROUND_SPAWN; + monster "052-2.gat", getx(), gety(), "", 1103, 1, "#LuviaDaemon::onWGD"; + detachrid; + areatimer "052-2.gat", 73, 11, 115, 49, 0, "#LuviaDaemon::onWGS"; + return; + +OnTimer30000: + if ($@illia_level_7_progress != 2) + end; + npcwarp 1, 1, "#LuviaDaemon"; + set $@illia_luvia_trance_delay, $@illia_luvia_trance_delay - 30; + if ($@illia_luvia_trance_delay <= 0) + goto L_TriggerTrance; + setnpctimer 0; + end; + +L_TriggerTrance: + set $@illia_level_7_progress, 3; + set $@illia_luvia_trance_delay, 0; + areatimer "052-2.gat", 73, 11, 115, 49, 0, "#LuviaDaemon::onTT"; + setnpctimer 0; + end; + +L_Clear: + stopnpctimer; + setnpctimer 0; + end; + +onDeath: + stopnpctimer; + setnpctimer 0; + if ($@illia_progress != 7) + end; + set $@illia_level_7_progress, 4; + killmonster "052-2.gat", "#LuviaDaemon::onWGD"; + mapannounce "052-2.gat", "Luvia: How? By mere humans! But we will see again! Enjoy your victory while it lasts, " + $@ILLIA_HERO$ + "!!", 0; + areatimer "052-2.gat", 73, 11, 115, 49, 2000, "#LuviaDaemon::onW00t"; + + set $@illia_progress, 8; + // Set the number of common rewards rewards + if ($Illia_Luvia_Harvest < 15) + set $@illia_num_common_reward_items, 3; + if ($Illia_Luvia_Harvest >= 15 && $Illia_Luvia_Harvest < 35) + set $@illia_num_common_reward_items, 5; + if ($Illia_Luvia_Harvest >= 35) + set $@illia_num_common_reward_items, 8; + + // Set the number of unique rewards + if ($Illia_Luvia_Harvest < 40) + set $@illia_num_unique_reward_items, 1; + if ($Illia_Luvia_Harvest >= 40) + set $@illia_num_unique_reward_items, 2; + set $Illia_Luvia_Harvest, 0; + + // Extend the time limit of +7 mins to leave enough time to pick + // the rewards even if close to the time limit + set $@illia_max_time, $@illia_max_time + 420; + + // Record teams who win, for future analysis + set $Illia_Win_Records$[$Illia_Win_Counter], $@ILLIA_HERO$ + " (Hero) | " + $@ILLIA_HELPER1$ + " | " + $@ILLIA_HELPER2$ + " | " + $@ILLIA_HELPER3$; + set $Illia_Win_Counter, $Illia_Win_Counter + 1; + + end; + +onWGD: + end; + +onWGS: + if ($@illia_level_7_progress == 2) + message strcharinfo(0), "One of Luvia's guard spawned from the depths to assist her!"; + end; + +onTT: + if ($@illia_level_7_progress == 3) + message strcharinfo(0), "Luvia seems to become in trance!"; + end; + +onW00t: + message strcharinfo(0), "You defeated this evil sorceress... But what about her sister now?"; + end; + +} + +// Warp from the party room, to the chest room +052-2.gat,88,12,0|script|#ToLuviaRoomDoor|32767,1,2,{ + set @step, 7; + if ($@illia_progress < @step) goto L_ShouldNotBeHere; + if ($@illia_level_7_progress < 4) end; + warp "052-2.gat", 133, 84; + end; +} diff --git a/world/map/npc/052-2/storage.txt b/world/map/npc/052-2/storage.txt new file mode 100644 index 00000000..e914635b --- /dev/null +++ b/world/map/npc/052-2/storage.txt @@ -0,0 +1,188 @@ +//----------------------------------------------------------------------------- +// Illia Forsaken Inn - Storage +// $@illia_progress = 6 +// +// Level progress: +// 0: Initial state +// 1: Items and/or mobs are spawned +// 2: All spawns are done and the players killed all mobs +//----------------------------------------------------------------------------- + +052-2.gat,23,69,0|script|#TriggerItemsInvoker|32767,1,0,{ + set @step, 6; + if ($@illia_progress < @step) goto L_ShouldNotBeHere; + if (strcharinfo(0) != $@ILLIA_HERO$) end; + if ($@illia_level_6_progress == 0) goto L_StartItemInvoker; + end; + +L_ShouldNotBeHere: + percentheal -100, 0; + end; + +L_StartItemInvoker: + set $@illia_level_6_progress, 1; + cmdothernpc "#ItemsInvoker", "Start"; + end; + +} + +052-2.gat,1,1,0|script|#ItemsInvoker|127,{ +end; + +onInit: + setarray $@illia_storage_items, 541, 567, 568, 562; + setarray $@illia_storage_special_items, 687, 827, 1229; + // Map coords : x1,y1, x2,y2, ... + setarray $@illia_storage_item_points, 20,67, 22,75, 27,71, 30,73, 34,76, 30,64, 34,65, 34,62, 21,61, 22,64; + end; + +OnCommandStart: + set $@illia_storage_max_items, 20; + set $@illia_storage_deviation, (8 + ($Illia_Luvia_Harvest*70)/100)*3; + initnpctimer; + areatimer "052-2.gat", 19, 60, 35, 78, 10, "#ItemsInvoker::onStart"; + end; + +onStart: + message strcharinfo(0), "You feel a strange atmosphere in this room... You sense a strong magic rising from the depth!"; + end; + +OnTimer1000: + if ($@illia_storage_max_items == 0) + goto L_CheckMobs; + set $@item_invoke_index, rand(getarraysize($@illia_storage_item_points)/2); + set $@item_invoke_x, $@illia_storage_item_points[$@item_invoke_index*2]; + set $@item_invoke_y, $@illia_storage_item_points[($@item_invoke_index*2)+1]; + npcwarp $@item_invoke_x, $@item_invoke_y, "#ItemsInvoker"; + // This is a fix to force the official mana client to display a npc after a warp. + // Note: the manaplus client do not need this. + disablenpc "#ItemsInvoker"; + end; + +OnTimer1500: + // See the note above. + enablenpc "#ItemsInvoker"; + areatimer "052-2.gat", 19, 60, 35, 78, 10, "#ItemsInvoker::onItem"; + misceffect FX_GROUND_SPAWN; + end; + +OnTimer3750: + setnpctimer 0; + set $@item_invoke_x, 0; + set $@item_invoke_y, 0; + set $@item_invoke_index, 0; + end; + +onItem: + if (strcharinfo(0) == $@ILLIA_HERO$) + goto L_ItemSpawn; + end; + +L_ItemSpawn: + // This section will decide what to spawn: special monster, monster, item, special item + // Calculation uses a decreasing variable which introduces a deviation. + // Its initial value is based on $@Illia_Luvia_Harvest + // * first decide (50% / 50%) if the deviation will be positive or negative + // * Apply the deviation to a random number between 0, 100. (note the final value can be < 0 or > 100) + // The purpose is that, when the initial deviation is high, there are high chances to get either + // a special monster, or a special item. + set @m, rand(100); + if (@m < 50) + set @r, rand(100) - $@illia_storage_deviation; + if (@m >= 50) + set @r, rand(100) + $@illia_storage_deviation; + // Reduce the deviation + set $@illia_storage_deviation, $@illia_storage_deviation*83/100; + if (@r < 5) + goto L_MakeSpecialMonster; + if (@r < 50) + goto L_MakeMonster; + if (@r > 98) + goto L_MakeSpecialItem; + // Normal item + makeitem $@illia_storage_items[rand(getarraysize($@illia_storage_items))], rand(2, 8), "052-2.gat", $@item_invoke_x, $@item_invoke_y; + set $@illia_storage_max_items, $@illia_storage_max_items - 1; + set @r, 0; + end; + +L_MakeSpecialMonster: + monster "052-2.gat", $@item_invoke_x, $@item_invoke_y, "", 1103, 1, "#ItemsInvoker::onDeath"; + areatimer "052-2.gat", 19, 60, 35, 78, 10, "#ItemsInvoker::onWtf"; + set $@illia_storage_max_items, $@illia_storage_max_items - 1; + end; + +L_MakeMonster: + monster "052-2.gat", $@item_invoke_x, $@item_invoke_y, "", 1101, rand(1, 3), "#ItemsInvoker::onDeath"; + set $@illia_storage_max_items, $@illia_storage_max_items - 1; + set @r, 0; + end; + +L_MakeSpecialItem: + makeitem $@illia_storage_special_items[rand(getarraysize($@illia_storage_special_items))], rand(2, 4), "052-2.gat", $@item_invoke_x, $@item_invoke_y; + areatimer "052-2.gat", 19, 60, 35, 78, 10, "#ItemsInvoker::onWow"; + set $@illia_storage_max_items, $@illia_storage_max_items - 1; + set @r, 0; + end; + +L_CheckMobs: + if ($@illia_progress != 6) + goto L_Clear; + if (mobcount("052-2.gat", "#ItemsInvoker::onDeath") < 0) + goto L_Stop; + setnpctimer 0; + end; + +L_Clear: + stopnpctimer; + setnpctimer 0; + set $@illia_storage_deviation, 0; + set $@illia_storage_max_items, 0; + killmonster "052-2.gat", "#ItemsInvoker::onDeath"; + end; + +L_Stop: + stopnpctimer; + setnpctimer 0; + npcwarp 1, 1, "#ItemsInvoker"; + set $@illia_storage_deviation, 0; + set $@illia_storage_max_items, 0; + set $@illia_level_6_progress, 2; + set $@illia_progress, 7; + set $@illia_max_time, $@illia_max_time + 1200; + areatimer "052-2.gat", 19, 60, 35, 78, 10, "#ItemsInvoker::onStop"; + end; + +onDeath: + end; + +onStop: + message strcharinfo(0), "The magic seems to quickly dissipate."; + end; + +onWtf: + message strcharinfo(0), "Look out!"; + end; + +onWow: + message strcharinfo(0), "Wow, see what appeared!"; + end; + +} + +052-2.gat,35,68,0|script|#ToPartyRoom|32767,1,1,{ + set @step, 6; + if ($@illia_progress < @step) goto L_ShouldNotBeHere; + if ($@illia_level_6_progress == 2) goto L_Warp; + message strcharinfo(0), "The strong magic inside this room prevents you from going further."; + end; + +L_Warp: + warp "052-2.gat", 73, 48; + end; + +L_ShouldNotBeHere: + percentheal -100, 0; + end; + +} + |