diff options
author | Vincent Petithory <vincent.petithory@gmail.com> | 2012-09-24 21:11:33 +0200 |
---|---|---|
committer | Vincent Petithory <vincent.petithory@gmail.com> | 2012-12-17 19:55:26 +0100 |
commit | 32cbb82b32d4ccbc3b5090ca517ed74feb5c9b5f (patch) | |
tree | f960e08320c2bfec54a3220c16734befea0f606e /world | |
parent | a6910cd696eccbef6f056fb0f7f4d0f2b72a2ede (diff) | |
download | serverdata-32cbb82b32d4ccbc3b5090ca517ed74feb5c9b5f.tar.gz serverdata-32cbb82b32d4ccbc3b5090ca517ed74feb5c9b5f.tar.bz2 serverdata-32cbb82b32d4ccbc3b5090ca517ed74feb5c9b5f.tar.xz serverdata-32cbb82b32d4ccbc3b5090ca517ed74feb5c9b5f.zip |
Add Illia quest scripts. Update submodule pointer.
Diffstat (limited to 'world')
30 files changed, 3100 insertions, 0 deletions
diff --git a/world/map/conf/magic.conf.template b/world/map/conf/magic.conf.template index 90ba4c7f..cf3094c7 100644 --- a/world/map/conf/magic.conf.template +++ b/world/map/conf/magic.conf.template @@ -1710,3 +1710,11 @@ TELEPORT-ANCHOR snakecave : "##04" = @("011-4.gat", 50, 75) @+ (3, 3); TELEPORT-ANCHOR dimondscove : "##05" = @("010-2.gat", 23, 79) @+ (3, 3); +#-------------------------------------------------------------------------------- +# Illia spell +#-------------------------------------------------------------------------------- + +NONMAGIC SPELL illia0 : "#catalazuli" = REQUIRE ((rdistance(location(caster), location(npc("#Power Circle"))) == 0)) + => EFFECT { + callfunc "StartChannelling"; + }; diff --git a/world/map/npc/007-1/_import.txt b/world/map/npc/007-1/_import.txt index 0e3373a3..887690ae 100644 --- a/world/map/npc/007-1/_import.txt +++ b/world/map/npc/007-1/_import.txt @@ -4,3 +4,4 @@ map: 007-1.gat npc: npc/007-1/_mobs.txt npc: npc/007-1/_warps.txt npc: npc/007-1/voltain.txt +npc: npc/007-1/witch.txt diff --git a/world/map/npc/007-1/witch.txt b/world/map/npc/007-1/witch.txt new file mode 100644 index 00000000..31ffbcee --- /dev/null +++ b/world/map/npc/007-1/witch.txt @@ -0,0 +1,848 @@ +//############################################################################ +//# # +//# Illia Adventure # +//# # +//############################################################################ + +// $@ILLIA_STATUS values: +// 0: None is fighting +// 1: Hero paid the price and is naming his comrades, spell is being prepared +// 2: Waiting for people to ask for the teleport +// 3: People asked to teleport. Procedure is going on. +// 4: Quest started. Leave subsequent progress to $@illia_progress +// 253: Quest is being ended and cleaned: the hero won. +// 254: Quest is being ended and cleaned: the hero logged off. +// 255: Quest is being ended and cleaned: the hero died or he ran out of time + +007-1.gat,77,81,0|script|Valia|370,{ + + set @illia_sapphire_powder, 3; + set @illia_amethyst_powder, 1; + set @illia_iron_powder, 13; + set @illia_yeti_tear, 1; + set @illia_iced_water, 4; + set @illia_min_level, 90; + + if (BaseLevel < @illia_min_level) goto L_Unexperienced; + if ($@ILLIA_STATUS == 0) goto L_Introduce; + if ($@ILLIA_STATUS == 1) goto L_PreparingSpell; + if ($@ILLIA_STATUS == 2) goto L_ReadyToTeleport; + if ($@ILLIA_STATUS == 3) end; + if ($@ILLIA_STATUS >= 4) goto L_AlreadyBegun; + end; + +L_Introduce: + if (@illia_go_find_items) + goto L_AskTeleportSpellItems; + if (@illia_know_witch == 1) + goto L_QuickIntroduce; + mes "[Valia]"; + mes "\"I'm Valia Illia. Is it needed to say I am a witch?\""; + next; + mes "[Valia]"; + mes "\"No I don't think so.\""; + next; + mes "[Valia]"; + mes "\"And you, you seem to be quite an adventurer.\""; + menu + "Well... No.", L_Disappointed, + "No doubt!", -; + + mes "[Valia]"; + mes "\"Maybe you can help then.\""; + mes "\"You see, I have a sister. Yes, a witch too. Very talented.\""; + mes "\"But unfortunately not enough to avoid being captured.\""; + menu + "That's unfortunate...", L_Exit, + "What informations do you have about all this?", -; + + set @illia_know_witch, 1; + mes "[Valia]"; + mes "\"Ismuth, some dark mage we both hate. He is the one holding her jailed for sure.\""; + mes "\"She has knowledge about specific magic sides that no other sorcerer knows about.\""; + next; + mes "[Valia]"; + mes "\"He has been looking for her for a long time because of that...\""; + mes "\"I am worried about her.\""; + mes "\"And I am unable to go help her.\""; + + menu + "Why not? You seem to be quite talented as well.", -; + mes "[Valia]"; + mes "\"Sure. But I know the enemy. My chances are thin. And if I fail, no one will ever find us.\""; + mes "\"And my magic skills aren't suited for this...\""; + menu + "That makes sense...", L_AskHelp, + "For what are they suited then?", L_HideSkills; + +L_HideSkills: + mes "[Valia]"; + mes "\"Please, never ask a witch what she is skilled in.\""; + next; + goto L_AskHelp; + +L_QuickIntroduce: + mes "[Valia]"; + mes "\"My sister is in great danger, and time is running out.\""; + next; + goto L_AskHelp; + +L_AskHelp: + mes "[Valia]"; + mes "\"Will you help me?\""; + menu + "That sounds quite dangerous... I don't feel it.", L_Disappointed, + "Ok, I can do that for you.", -; + + mes "[Valia]"; + mes "\"Good. Now listen carefully. Ismuth owns an island where he makes his researchs.\""; + mes "\"An island where no boat goes, and where no magic could teleport you to...\""; + mes "\"Strong enchantments are protecting the area, however, I know about a mysterious waterfall, which can send you wherever you want, provided you pay the price.\""; + next; + mes "[Valia]"; + mes "\"Of course, it would be a straight way to death if you go alone.\""; + mes "\"You will need three experienced comrades that you would trust enough to leave your life in their's care.\""; + next; + + if (getusers(1) < 4) + goto L_NotEnoughPeopleAvailable; + + mes "[Valia]"; + mes "\"Do you know such people?\""; + menu + "I'm afraid not. I should better look around.", L_Exit, + "Yes I know such people!", -; + + mes "[Valia]"; + mes "\"Good.\""; + mes "\"I can teleport all of you close to that waterfall, but for that, I will need " + @illia_sapphire_powder + " bags of Sapphire Powder, " + @illia_amethyst_powder + " of Amethyst Powder, " + @illia_iron_powder + " Iron Powders," + @illia_yeti_tear + " Frozen Yeti Tear and " + @illia_iced_water + " bottles of Iced Water.\""; + menu + "I have them here.", L_CheckTeleportSpellItems, + "I don't have them, but I'll try to find.", L_NoTeleportSpellItems; + +L_NotEnoughPeopleAvailable: + mes "[Valia]"; + mes "\"But it seems there are not enough people around."; + mes "Come back later.\""; + close; + +L_AskTeleportSpellItems: + mes "[Valia]"; + mes "\"So, did you bring me what I need?\""; + menu + "Hum, I forgot what you asked...", L_RepeatTeleportSpellItems, + "Here they are!", L_CheckTeleportSpellItems; + +L_RepeatTeleportSpellItems: + mes "[Valia]"; + mes "\"I need " + @illia_sapphire_powder + " bags of Sapphire Powder, " + @illia_amethyst_powder + " of Amethyst Powder, " + @illia_iron_powder + " Iron Powders," + @illia_yeti_tear + " Frozen Yeti Tear and " + @illia_iced_water + " bottles of Iced Water.\""; + next; + mes "\"Hurry up.\""; + close; + +L_NoTeleportSpellItems: + set @illia_go_find_items, 1; + close; + +L_MissingTeleportSpellItems: + mes "[Valia]"; + mes "\"Obviously you are missing some of the components.\""; + mes "\"Go find the missing ones, fast. We lack time!\""; + set @illia_go_find_items, 1; + close; + +L_CheckTeleportSpellItems: + if ( + (countitem ("SapphirePowder") < @illia_sapphire_powder) || + (countitem ("AmethystPowder") < @illia_amethyst_powder) || + (countitem ("IronPowder") < @illia_iron_powder) || + (countitem ("FrozenYetiTear") < @illia_yeti_tear) || + (countitem ("IcedWater") < @illia_iced_water) + ) goto L_MissingTeleportSpellItems; + // someone started the quest in the meantime, so we cancel this one. + if ($@ILLIA_STATUS > 0) + goto L_Interrupt; + // Block other players to start the quest, and start a timer to limit + // the time a player will take to gather his team. + // Considering the previous npc dialogs, we assume the player already designated his team mates, + // hence 5 mins should be enough. + set $@ILLIA_STATUS, 1; + initnpctimer; + set @illia_go_find_items, 0; + delitem "SapphirePowder", @illia_sapphire_powder; + delitem "AmethystPowder", @illia_amethyst_powder; + delitem "IronPowder", @illia_iron_powder; + delitem "FrozenYetiTear", @illia_yeti_tear; + delitem "IcedWater", @illia_iced_water; + + mes "[Valia]"; + mes "\"Very well! I can prepare the spell now!\""; + next; + goto L_PrepareTeam; + +L_Interrupt: + mes "[Valia]"; + mes "\"Unfortunately, someone else is already helping me.\""; + close; + +L_PrepareTeam: + // We clear early this variable. + set @illia_know_witch, 0; + mes "[Valia]"; + mes "\"While I focus on preparing the spell, call your three comrades, and make sure they come here within five minutes. We don't have time.\""; + next; + set $@ILLIA_HERO$, strcharinfo(0); + set $@ILLIA_HERO_ID, getcharid(3, $@ILLIA_HERO$); + goto L_ChooseHelper1; + +L_Disappointed: + mes "[Valia]"; + mes "\"What a shame... You have no idea what you are missing, really.\""; + close; + +L_Unexperienced: + mes "You see a charismatic witch."; + next; + mes "But she seems to completely ignore your presence."; + close; + +L_ChooseHelperConfirm1: + mes "[Team Selector]"; + mes "If it happens you cannot elect three players to help you, you can give up now."; + menu + "Continue.", L_ChooseHelper1, + "I give up.", L_PlayerGaveUp; + +L_ChooseHelper1: + mes "[Team Selector]"; + mes "Name the first player to help you:"; + input $@ILLIA_HELPER1$; + + if ($@ILLIA_HELPER1$ == "") + goto L_ChooseHelperConfirm1; + if (getcharid(3, $@ILLIA_HELPER1$) == $@ILLIA_HERO_ID) + goto L_WrongHelper1; + if (isloggedin(getcharid(3, $@ILLIA_HELPER1$)) == 0) + goto L_HelperDoesNotExist1; + attachrid(getcharid(3, $@ILLIA_HELPER1$)); + if (BaseLevel < @illia_min_level) + goto L_HelperTooWeak1; + detachrid; + if (isloggedin($@ILLIA_HERO_ID) == 0) + goto L_Exit; + attachrid($@ILLIA_HERO_ID); + goto L_ChooseHelper2; + +L_HelperTooWeak1: + detachrid; + if (isloggedin($@ILLIA_HERO_ID) == 0) + goto L_Exit; + attachrid($@ILLIA_HERO_ID); + mes "[Team Selector]"; + mes "The player " + $@ILLIA_HELPER1$ + " is too weak to help you."; + next; + goto L_ChooseHelperConfirm1; + +L_HelperDoesNotExist1: + mes "[Team Selector]"; + mes "This player " + $@ILLIA_HELPER1$ + " seems offline or does not exist."; + next; + goto L_ChooseHelperConfirm1; + +L_WrongHelper1: + mes "[Team Selector]"; + mes "You can't name yourself."; + next; + goto L_ChooseHelperConfirm1; + +L_ChooseHelperConfirm2: + mes "[Team Selector]"; + mes "If it happens you cannot elect three players to help you, you can give up now."; + menu + "Continue.", L_ChooseHelper2, + "I give up.", L_PlayerGaveUp; + +L_ChooseHelper2: + mes "[Team Selector]"; + mes "Name the second player to help you:"; + input $@ILLIA_HELPER2$; + if ($@ILLIA_HELPER2$ == "") + goto L_ChooseHelperConfirm2; + if (getcharid(3, $@ILLIA_HELPER2$) == getcharid(3, $@ILLIA_HELPER1$) || + getcharid(3, $@ILLIA_HELPER2$) == $@ILLIA_HERO_ID) + goto L_WrongHelper2; + if (isloggedin(getcharid(3, $@ILLIA_HELPER2$)) == 0) + goto L_HelperDoesNotExist2; + attachrid(getcharid(3, $@ILLIA_HELPER2$)); + if (BaseLevel < @illia_min_level) + goto L_HelperTooWeak2; + detachrid; + if (isloggedin($@ILLIA_HERO_ID) == 0) + goto L_Exit; + attachrid($@ILLIA_HERO_ID); + goto L_ChooseHelper3; + +L_HelperTooWeak2: + detachrid; + if (isloggedin($@ILLIA_HERO_ID) == 0) + goto L_Exit; + attachrid($@ILLIA_HERO_ID); + mes "[Team Selector]"; + mes "The player " + $@ILLIA_HELPER2$ + " is too weak to help you."; + next; + goto L_ChooseHelperConfirm2; + +L_HelperDoesNotExist2: + mes "[Team Selector]"; + mes "This player " + $@ILLIA_HELPER2$ + " seems offline or does not exist."; + next; + goto L_ChooseHelperConfirm2; + +L_WrongHelper2: + mes "[Team Selector]"; + mes "You can't name yourself or someone already chosen."; + next; + goto L_ChooseHelperConfirm2; + +L_ChooseHelperConfirm3: + mes "[Team Selector]"; + mes "If it happens you cannot elect three players to help you, you can give up now."; + menu + "Continue.", L_ChooseHelper3, + "I give up.", L_PlayerGaveUp; + +L_ChooseHelper3: + mes "[Team Selector]"; + mes "Name the third player to help you:"; + input $@ILLIA_HELPER3$; + if ($@ILLIA_HELPER3$ == "") + goto L_ChooseHelperConfirm3; + if (getcharid(3, $@ILLIA_HELPER3$) == getcharid(3, $@ILLIA_HELPER2$) || + getcharid(3, $@ILLIA_HELPER3$) == getcharid(3, $@ILLIA_HELPER1$) || + getcharid(3, $@ILLIA_HELPER3$) == $@ILLIA_HERO_ID) + goto L_WrongHelper3; + if (isloggedin(getcharid(3, $@ILLIA_HELPER3$)) == 0) + goto L_HelperDoesNotExist3; + attachrid(getcharid(3, $@ILLIA_HELPER3$)); + if (BaseLevel < @illia_min_level) + goto L_HelperTooWeak3; + detachrid; + if (isloggedin($@ILLIA_HERO_ID) == 0) + goto L_Exit; + attachrid($@ILLIA_HERO_ID); + mes $@ILLIA_HELPER1$ + ", " + $@ILLIA_HELPER2$ + " and " + $@ILLIA_HELPER3$ + " will be your three comrades."; + close; + +L_HelperTooWeak3: + detachrid; + if (isloggedin($@ILLIA_HERO_ID) == 0) + goto L_Exit; + attachrid($@ILLIA_HERO_ID); + mes "[Team Selector]"; + mes "The player " + $@ILLIA_HELPER3$ + " is too weak to help you."; + next; + goto L_ChooseHelperConfirm3; + + +L_HelperDoesNotExist3: + mes "[Team Selector]"; + mes "This player " + $@ILLIA_HELPER3$ + " seems offline or does not exist."; + next; + goto L_ChooseHelperConfirm3; + +L_WrongHelper3: + mes "[Team Selector]"; + mes "You can't name yourself or someone already chosen."; + next; + goto L_ChooseHelperConfirm3; + +L_PreparingSpell: + mes "The witch looks busy with a spell, giving shape to strange rings,"; + mes "and is not paying any attention to you."; + close; + +L_ReadyToTeleport: + if (strcharinfo(0) == $@ILLIA_HERO$) + goto L_AskToTeleport; + if (strcharinfo(0) == $@ILLIA_HELPER1$ || strcharinfo(0) == $@ILLIA_HELPER2$ || strcharinfo(0) == $@ILLIA_HELPER3$) + goto L_TalkHelper; + mes "[Valia]"; + mes "\"I do not have time for you.\""; + close; + +L_AskToTeleport: + // Check area users just to give a hint if there are players around, + // but do not actually check if the real helpers are here + if (getareausers("007-1.gat", 66, 73, 92, 88) < 4) + goto L_NotEveryoneHere; + mes "[Valia]"; + mes "\"Everyone seems to be here. Make sure to stay close to me.\""; + menu + "I'm ready.", -, + "Wait a minute.", L_Exit; + // Stop the 5mins timer and start it again. + set $@ILLIA_STATUS, 3; + initnpctimer; + close; + +L_NotEveryoneHere: + mes "[Valia]"; + mes "\"I don't see your comrades around.\""; + mes "\"Let's wait a little more.\""; + close; + +L_TalkHelper: + mes "[Valia]"; + mes "\"" + strcharinfo(0) + ", do your best to assist " + $@ILLIA_HERO$ + ".\""; + menu + "What is " + $@ILLIA_HERO$ + " going to do?", -, + "I will, no problem.", L_Exit; + mes "[Valia]"; + mes "\"You weren't told about it? This is about saving my captive sister.\""; + next; + mes "[Valia]"; + mes "\"For the details, you'll have to ask " + $@ILLIA_HERO$ + "...\""; + mes "\"I am not going to repeat myself...\""; + close; + +// Timed Warp logic +OnWarpHero: + if (strcharinfo(0) == $@ILLIA_HERO$) + goto L_Warp; + end; + +OnWarpHelper1: + if (strcharinfo(0) == $@ILLIA_HELPER1$) + goto L_Warp; + end; + +OnWarpHelper2: + if (strcharinfo(0) == $@ILLIA_HELPER2$) + goto L_Warp; + end; + +OnWarpHelper3: + if (strcharinfo(0) == $@ILLIA_HELPER3$) + goto L_Warp; + end; + +L_Warp: + misceffect FX_MAGIC_BLUE_TELEPORT, strcharinfo(0); + set @illia_got_rewards, 0; + set @illia_current_num_rewards, 0; + addtimer 2000, "Valia::OnRealWarp"; + end; + +OnRealWarp: + warp "051-1.gat", 23 + rand(2), 24 + rand(3); + if (strcharinfo(0) == $@ILLIA_HERO$) + goto L_InitVars; + end; + +L_InitVars: + set $@ILLIA_STATUS, 4; + cmdothernpc "#IlliaDaemon", "Toggle"; + // init various variables + set $@illia_progress, 1; + set $@illia_level_1_progress, 0; + set $@illia_level_2_progress, 0; + set $@illia_level_3_progress, 0; + set $@illia_level_4_progress, 0; + set $@illia_level_5_progress, 0; + set $@illia_level_6_progress, 0; + set $@illia_level_7_progress, 0; + set $@illia_players_in_luvia_territory, 0; + + // Save the time at which the quest started + set $@illia_begin_time, gettimetick(2); + + // Clean all levels + cmdothernpc "#IlliaJanitor1", "Clean"; + cmdothernpc "#IlliaJanitor2", "Clean"; + cmdothernpc "#IlliaJanitor3", "Clean"; + cmdothernpc "#IlliaJanitor4", "Clean"; + cmdothernpc "#IlliaJanitor5", "Clean"; + cmdothernpc "#IlliaJanitor6", "Clean"; + cmdothernpc "#IlliaJanitor7", "Clean"; + + stopnpctimer; + setnpctimer 0; + end; + +L_AlreadyBegun: + mes "At the moment you are about to talk to her, she briefly shows a malicious smile and looks away."; + next; + mes "Probably it is best to not annoy her."; + close; + +L_Exit: + close; + +L_ReactToPlayersReturn: + // If players did not enter the Inn's lobby, they arent aware of the trap. + // Otherwise, they are aware of the trap. Whether they died or not, + // the rings will have deleted their memories. + // So the same dialog can apply. + if ($@illia_progress < 8) + goto L_DisappointedByHeroFail; + if ($@illia_progress == 8) + goto L_SurprisedByHeroWin; + end; + +L_SurprisedByHeroWin: + npctalk "(How is it possible... " + $@ILLIA_HERO$ + " survived...)"; + emotion EMOTE_SURPRISE; + goto L_EndQuest; + +L_DisappointedByHeroFail: + npctalk "Oh no... It seems " + $@ILLIA_HERO$ + " did not make it... Who will save my sister now?"; + emotion EMOTE_SAD; + goto L_EndQuest; + +L_PlayerGaveUp: + close2; + npctalk "Well... It seems you can't do it " + $@ILLIA_HERO$ + ". I knew it as soon as I saw you!"; + emotion EMOTE_UPSET; + goto L_EndQuest; + +L_EndQuest: + set $@ILLIA_STATUS, 0; + set $@ILLIA_HERO$, ""; + set $@ILLIA_HERO_ID, 0; + set $@ILLIA_HELPER1$, ""; + set $@ILLIA_HELPER2$, ""; + set $@ILLIA_HELPER3$, ""; + set $@illia_progress, 0; + set $@illia_level_1_progress, 0; + set $@illia_level_2_progress, 0; + set $@illia_level_3_progress, 0; + set $@illia_level_4_progress, 0; + set $@illia_level_5_progress, 0; + set $@illia_level_6_progress, 0; + set $@illia_level_7_progress, 0; + set $@illia_players_in_luvia_territory, 0; + + // Clean all levels + cmdothernpc "#IlliaJanitor1", "Clean"; + cmdothernpc "#IlliaJanitor2", "Clean"; + cmdothernpc "#IlliaJanitor3", "Clean"; + cmdothernpc "#IlliaJanitor4", "Clean"; + cmdothernpc "#IlliaJanitor5", "Clean"; + cmdothernpc "#IlliaJanitor6", "Clean"; + cmdothernpc "#IlliaJanitor7", "Clean"; + + stopnpctimer; + setnpctimer 0; + end; + +// Timer for the witch to react to the players' return +OnTimer3000: + if ($@ILLIA_STATUS >= 253) + goto L_ReactToPlayersReturn; + end; + +// Timer for the witch giving instructions to players about to be teleported +OnTimer2500: + if ($@ILLIA_STATUS != 3) + end; + npctalk "All of you, listen!"; + end; + +OnTimer7500: + if ($@ILLIA_STATUS != 3) + end; + npctalk "I will teleport the 4 of you in a forest that isn't far from the waterfall."; + end; + +OnTimer14000: + if ($@ILLIA_STATUS != 3) + end; + npctalk "Each of you takes one of these rings. They will allow you to come back here when needed."; + end; + +OnTimer24000: + if ($@ILLIA_STATUS != 3) + end; + if ($Illia_Luvia_Harvest < 10) + npctalk "Do your best and save my sister!"; + if ($Illia_Luvia_Harvest >= 10 && $Illia_Luvia_Harvest < 35) + npctalk "This will be quite dangerous, but do your best and save my sister!"; + if ($Illia_Luvia_Harvest >= 35) + npctalk "This will be awfully dangerous, but do your best and save my sister!"; + end; + +OnTimer32000: + if ($@ILLIA_STATUS != 3) + end; + npctalk "Get ready!"; + end; + +OnTimer38000: + if ($@ILLIA_STATUS != 3) + end; + // Trigger 4 areatimers to show the teleport spell + // This is better looking than a basic areawarp + areatimer "007-1.gat", 66, 73, 92, 88, 3000, "Valia::OnWarpHero"; + areatimer "007-1.gat", 66, 73, 92, 88, 3500, "Valia::OnWarpHelper1"; + areatimer "007-1.gat", 66, 73, 92, 88, 4000, "Valia::OnWarpHelper2"; + areatimer "007-1.gat", 66, 73, 92, 88, 4500, "Valia::OnWarpHelper3"; + npctalk "Spiralis Major!"; + misceffect FX_BLUE_MAGIC_CAST; + end; + +OnTimer50000: + // Add a check that the quest started. + // This timer on status 3 should be reached since L_Init_Vars will have + // stopped it before. + // It may happen it didn't if the hero logged off during the warp sequence + // Hence we'll just init what's necessary to trigger the end sequence + if ($@ILLIA_STATUS != 3) + end; + goto L_InitVars; + +// Timers for the witch waiting. +OnTimer150000: + if ($@ILLIA_STATUS != 1) + end; + set $@ILLIA_STATUS, 2; + npctalk $@ILLIA_HERO$ + ", I am ready to cast the teleport spell. You and your comrades should not wait any longer!"; + end; + +OnTimer280000: + if ($@ILLIA_STATUS != 2) + end; + npctalk "Hurry up " + $@ILLIA_HERO$ + ", I am losing patience."; + end; + +OnTimer300000: + if ($@ILLIA_STATUS != 2) + end; + npctalk $@ILLIA_HERO$ + ", you and your missing comrades made me lose a precious time! Out of my sight!"; + emotion EMOTE_UPSET; + goto L_EndQuest; + +} + +007-1.gat,128,100,0|script|#IlliaDaemon|127,{ +end; + +onInit: + set $@illia_max_time, 900; + end; + +OnCommandToggle: + set $@illia_max_time, 900; + if ($@ILLIA_STATUS >= 253) + goto L_Stop; + if ($@ILLIA_STATUS >= 4) + goto L_Start; + end; + +OnTimer1000: + if ($@ILLIA_STATUS < 4 || $@ILLIA_STATUS >= 254) + end; + goto L_Check; + +OnTimer2000: + if ($@ILLIA_STATUS < 4 || $@ILLIA_STATUS >= 254) + end; + // This is executed only when making a double check when we detected + // the hero offline/not in the good map previously. + goto L_Check; + +OnTimer4000: + // Check if we need to force-warp the hero + if (isloggedin($@ILLIA_HERO_ID) == 0) + end; + if ($@ILLIA_STATUS == 255 && attachrid($@ILLIA_HERO_ID) && ( + isin("051-1.gat",1,1,190,80) || + isin("051-3.gat",1,1,115,130) || + isin("052-1.gat",1,1,100,80) || + isin("052-2.gat",1,1,150,100) + ) + ) goto L_WarpHero; + detachrid; + end; + +OnTimer4500: + if ($@ILLIA_STATUS < 254) + end; + // send a message to all the helpers + setarray $@illia_helpers$, $@ILLIA_HELPER1$,$@ILLIA_HELPER2$,$@ILLIA_HELPER3$; + set $@illia_helper_index,0; + goto L_CheckHelperNeedNotification; + +OnTimer6500: + if ($@ILLIA_STATUS < 254) + end; + // Make the first witch to say something happened, when she will see people back + // If no helpers will be warped, it still makes sense: she felt the hero died. + startnpctimer "Valia"; + // $@illia_players_in_luvia_territory is set when players enter the island + set $Illia_Luvia_Harvest, $Illia_Luvia_Harvest + $@illia_players_in_luvia_territory; + // Cap the difficulty to 50. We do not want the quest to really be impossible to finish. + if ($Illia_Luvia_Harvest > 50) + set $Illia_Luvia_Harvest, 50; + set $@illia_players_in_luvia_territory, 0; + end; + +L_CheckHelperNeedNotification: + if ($@illia_helper_index >= 4) + goto L_CleanHelpersNotifications; + set $@illia_helper$, $@illia_helpers$[$@illia_helper_index]; + if (isloggedin(getcharid(3, $@illia_helper$)) == 0) + goto L_NextHelperToNotify; + if ( + $@illia_helper$ != "" && + attachrid(getcharid(3, $@illia_helper$)) && ( + isin("051-1.gat",1,1,190,80) || + isin("051-3.gat",1,1,115,130) || + isin("052-1.gat",1,1,100,80) || + isin("052-2.gat",1,1,150,100) + ) + ) goto L_NotifyHelperFail; + detachrid; + goto L_NextHelperToNotify; + +L_NextHelperToNotify: + set $@illia_helper_index, $@illia_helper_index + 1; + goto L_CheckHelperNeedNotification; + +L_CleanHelpersNotifications: + cleararray $@illia_helpers$, "", 3; + set $@illia_helper$, ""; + set $@illia_helper_index,0; + end; + +L_NotifyHelperFail: + message strcharinfo(0), $@ILLIA_HERO$ + " disappeared. There is no way I continue like this... Let's use the ring Valia gave!"; + // display the warp spell already if needed + misceffect FX_MAGIC_BLUE_TELEPORT, strcharinfo(0); + detachrid; + goto L_NextHelperToNotify; + +OnTimer8000: + if ($@ILLIA_STATUS < 254) + end; + // Warp remaining helpers back to the origin if needed + setarray $@illia_helpers$, $@ILLIA_HELPER1$,$@ILLIA_HELPER2$,$@ILLIA_HELPER3$; + set $@illia_helper_index,0; + goto L_CheckHelperNeedWarp; + +L_CheckHelperNeedWarp: + if ($@illia_helper_index >= 4) + goto L_CleanHelpersWarps; + set $@illia_helper$, $@illia_helpers$[$@illia_helper_index]; + if (isloggedin(getcharid(3, $@illia_helper$)) == 0) + goto L_NextHelperToWarp; + if ($@illia_helper$ != "" && attachrid(getcharid(3, $@illia_helper$))) + goto L_WarpHelper; + detachrid; + goto L_NextHelperToWarp; + +L_NextHelperToWarp: + set $@illia_helper_index, $@illia_helper_index + 1; + goto L_CheckHelperNeedWarp; + +L_CleanHelpersWarps: + cleararray $@illia_helpers$, "", 3; + set $@illia_helper$, ""; + set $@illia_helper_index,0; + end; + +L_WarpHelper: + // Proceed only if the helper is still on one of the quest's maps + if ( + isin("051-1.gat",1,1,190,80 ) || + isin("051-3.gat",1,1,115,130) || + isin("052-1.gat",1,1,100,80 ) || + isin("052-2.gat",1,1,150,100) + ) goto L_DoWarpHelper; + detachrid; + goto L_NextHelperToWarp; + +L_DoWarpHelper: + // At this point, the player has been attached + if ($@illia_progress >= 5) + message strcharinfo(0), "You feel dizzy, and that your memory is being rewritten... Who is Luvia? Something isn't alright."; + warp "007-1.gat",85 + rand(0,2),75 + rand(0,2); + detachrid; + goto L_NextHelperToWarp; + +L_Check: + // We check for the hero to be logged in, alive, and in one of the quest's maps + if (isloggedin($@ILLIA_HERO_ID) == 0) + goto L_HeroLogOff; + if (attachrid($@ILLIA_HERO_ID) && + (isin("051-1.gat",1,1,190,80 ) == 0) && + (isin("051-3.gat",1,1,115,130) == 0) && + (isin("052-1.gat",1,1,100,80 ) == 0) && + (isin("052-2.gat",1,1,150,100) == 0) + ) goto L_HeroEscape; + if (isdead()) + goto L_HeroDead; + // If the quest lasts more than $@illia_max_time seconds, abort it + if (gettimetick(2) - $@illia_begin_time > $@illia_max_time) + goto L_HeroRingActivated; + // Conditions are all met. schedule another check 1s later + setnpctimer 0; + detachrid; + end; + +L_HeroRingActivated: + misceffect FX_MAGIC_BLUE_TELEPORT, strcharinfo(0); + message strcharinfo(0), "The ring Valia gave you seems to activate itself!"; + detachrid; + set $@ILLIA_STATUS, 255; + setnpctimer 0; + end; + +L_HeroLogOff: + if (getnpctimer(0) < 1900) + end; + set $@ILLIA_STATUS, 254; + setnpctimer 0; + end; + +L_HeroEscape: + detachrid; + // because of lags, warps between maps, etc + // let's assume a check can detect the player to not be in any of the map, + // while he is supposed to be in one. + // it does not hurt to make a double check 1sec later + if (getnpctimer(0) < 1900) + end; + set $@ILLIA_STATUS, 254; + setnpctimer 0; + end; + +L_WarpHero: + // At this point, the player has been attached + if ($@illia_progress >= 5) + message strcharinfo(0), "You feel dizzy, and that your memory is being rewritten... Who is Luvia? Something isn't alright."; + warp "007-1.gat",85 + rand(0,2),75 + rand(0,2); + detachrid; + end; + +L_HeroDead: + // we notify the player that his death will add luvia's power. + // her power is increasing once players reach her island, + // but they didn't find out about her yet on the island, + // so we notify the hero only once they met her in the Inn + if ($@illia_progress >= 5 && $@illia_progress < 8) + message strcharinfo(0), "You are in Luvia's hands, and your soul is now meant to serve her dark purposes."; + detachrid; + set $@ILLIA_STATUS, 255; + setnpctimer 0; + end; + +L_Stop: + stopnpctimer; + setnpctimer 0; + end; + +L_Start: + initnpctimer; + end; + +} diff --git a/world/map/npc/051-1/_import.txt b/world/map/npc/051-1/_import.txt index 5c7a5118..85c3d272 100644 --- a/world/map/npc/051-1/_import.txt +++ b/world/map/npc/051-1/_import.txt @@ -3,3 +3,9 @@ map: 051-1.gat npc: npc/051-1/_mobs.txt npc: npc/051-1/_warps.txt +npc: npc/051-1/desert.txt +npc: npc/051-1/desertmonsters.txt +npc: npc/051-1/forest.txt +npc: npc/051-1/forestmonsters.txt +npc: npc/051-1/janitor.txt +npc: npc/051-1/mapflags.txt diff --git a/world/map/npc/051-1/desert.txt b/world/map/npc/051-1/desert.txt new file mode 100644 index 00000000..ba163347 --- /dev/null +++ b/world/map/npc/051-1/desert.txt @@ -0,0 +1,140 @@ +//----------------------------------------------------------------------------- +// Souless Desert +// $@illia_progress = 3 +// +// Level progress: +// 0: Did not start the task yet +// 1: Players are instructed to collect souls +// 2: Players collected enough souls and gave the souls to the waterfall +//----------------------------------------------------------------------------- + +051-1.gat,142,39,0|script|Bones|367,{ + mes "You find a ruined paper next to these bones."; + mes "It says..."; + next; + mes "\"This waterfall is cursed... it feeds on living souls... I could not get past throught it.\""; + mes "\"God, they appeared from nowhere...\""; + mes "\"...\""; + next; + mes "The rest isn't legible."; + close; + +} + +051-1.gat,170,24,0|script|Cursed Waterfall|127,{ + set $@illia_num_sealed_souls, 7; + set @step, 3; + if ($@illia_progress < @step) goto L_ShouldNotBeHere; + if ($@illia_level_3_progress == 0 && strcharinfo(0) == $@ILLIA_HERO$) goto L_GiveTask; + if ($@illia_level_3_progress == 0 && strcharinfo(0) != $@ILLIA_HERO$) goto L_HintToHelpers; + if ($@illia_level_3_progress == 1) goto L_GiveSouls; + mes "Jump in the waterfall?"; + menu + "Yes", L_Warp, + "No", -; + close; + +OnTimer1000: + npctalk "Youuuuuuu... Bring me souls... " + $@illia_num_sealed_souls + " fresh souls... Nooooow. And you shall paaass."; + end; + +OnTimer4750: + mapannounce "051-1.gat", "You hear a loud scream coming from the wind... Something terrifying raised out there.", 0; + end; + +OnTimer6500: + npctalk "Nooooo... Do not let these things take them from youuuuuu!"; + stopnpctimer; + setnpctimer 0; + end; + +L_ShouldNotBeHere: + percentheal -100, 0; + end; + +L_HintToHelpers: + mes "[Cursed Waterfall]"; + mes "\"Who are you?... Bring " + $@ILLIA_HERO$ + " to me!\""; + close; + +L_GiveTask: + set $@illia_level_3_progress, 1; + mes "[Cursed Waterfall]"; + mes "\"Yooouuuuuu...\""; + next; + + mes "You look around and see this ghostly voice comes from the waterfall."; + next; + + // This message will be in the timed messages, + // but display it here anyway to be sure the hero sees it. + mes "\"Youuuuuuu... Bring me souls... " + $@illia_num_sealed_souls + " fresh souls... Nooooow.\""; + mes "\"And you shall paaass.\""; + + // Reset the soul eaters counters. + set $@SoulEaters0_count, 0; + set $@SoulEaters1_count, 0; + set $@SoulEaters2_count, 0; + set $@SoulEaters3_count, 0; + set $@SoulEaters4_count, 0; + // Spawn 7 additional soul snakes in the north building, as a bait. + areamonster "051-1.gat", 125, 14, 143, 18, "", 1096, 7, "IlliaDMobs051-1::On1096"; + // Same with 5, in the island + areamonster "051-1.gat", 138, 34, 145, 41, "", 1096, 5, "IlliaDMobs051-1::On1096"; + // Start timed messages + initnpctimer; + close; + +L_GiveSouls: + if (strcharinfo(0) != $@ILLIA_HERO$) + goto L_GiveSoulsToHero; + mes "[Cursed Waterfall]"; + mes "\"Give me the souuuuuuls... Noooooooow!!\""; + menu + "Please, have a look at these.", L_CheckSouls, + "Sorry, I don't have any.", -; + close; + +L_GiveSoulsToHero: + mes "[Cursed Waterfall]"; + mes "\"Who are you?.... I want the souuuuuuls from " + $@ILLIA_HERO$ + "!\""; + close; + +L_CheckSouls: + if (countitem ("SealedSoul") < $@illia_num_sealed_souls) + goto L_NotEnough; + delitem "SealedSoul", $@illia_num_sealed_souls; + set $@illia_level_3_progress, 2; + set $@illia_progress, 4; + set $@illia_max_time, $@illia_max_time + 1200; + + // Clean all spawned monsters + killmonster "051-1.gat", "IlliaDMobs051-1::On1096"; + killmonster "051-1.gat", "#SoulEaters0::OnSoulEaterDeath"; + killmonster "051-1.gat", "#SoulEaters1::OnSoulEaterDeath"; + killmonster "051-1.gat", "#SoulEaters2::OnSoulEaterDeath"; + killmonster "051-1.gat", "#SoulEaters3::OnSoulEaterDeath"; + killmonster "051-1.gat", "#SoulEaters4::OnSoulEaterDeath"; + + + mes "\"Goooood... Tasty souuuuuls...\""; + mes "You shall pass now... before I change my mind...\""; + next; + mes "A blinding light appears from inside the waterfall."; + + // Display an effect to show the waterfall opens itself / kills remaining monsters + misceffect FX_MEDIUM_BLINDINGLIGHT; + close; + +L_NotEnough: + mes "[Cursed Waterfall]"; + mes "\"Moooooooooore... Give me more...\""; + close; + +L_Warp: + warp "052-1.gat", 23, 52; + // Count the player who reached the island. + set $@illia_players_in_luvia_territory, $@illia_players_in_luvia_territory + 1; + close; + +} diff --git a/world/map/npc/051-1/desertmonsters.txt b/world/map/npc/051-1/desertmonsters.txt new file mode 100644 index 00000000..af33fefd --- /dev/null +++ b/world/map/npc/051-1/desertmonsters.txt @@ -0,0 +1,150 @@ +051-1.gat,134,36,67,49|monster|Soul Snake|1096,12,100000,30000,IlliaDMobs051-1::On1096 + +// The soul snakes release a Sealed Soul at random, once the soul collecting is started +051-1.gat,0,0,0|script|IlliaDMobs051-1|-1,{ + +On1096: + if (rand(4) == 0 && $@illia_progress == 3 && $@illia_level_3_progress == 1) + getitem "SealedSoul", 1; + set @mobID, 1010; + callfunc "MobPoints"; + end; + +} + +// Soul eater spawns. They will eat a Sealed Soul when killed, and when the soul collecting is started. + +// Spawn in the island +051-1.gat,142,38,0|script|#SoulEaters0Trigger|32767,3,3,{ + if ($@illia_progress != 3 || $@illia_level_3_progress != 1) + end; + if ($@SoulEaters0_count > 0) + end; + donpcevent "#SoulEaters0::OnSpawn"; + end; +} + +051-1.gat,142,38,0|script|#SoulEaters0|32767,{ +OnSpawn: + set $@SoulEaters0_count, 5; + areamonster "051-1.gat", 139, 34, 145, 41, "", 1097, $@SoulEaters0_count, "#SoulEaters0::OnSoulEaterDeath"; + end; + +OnSoulEaterDeath: + set $@SoulEaters0_count, $@SoulEaters0_count - 1; + if ($@illia_progress != 3 || $@illia_level_3_progress != 1) + end; + if (countitem("SealedSoul") == 0) + end; + delitem "SealedSoul", countitem("SealedSoul"); + message strcharinfo(0), "The Soul Eater feeds on the Sealed Souls you are carrying."; + end; +} + +// Spawn inside the north building +051-1.gat,134,16,0|script|#SoulEaters1Trigger|32767,9,2,{ + if ($@illia_progress != 3 || $@illia_level_3_progress != 1) + end; + if ($@SoulEaters1_count > 0) + end; + donpcevent "#SoulEaters1::OnSpawn"; + end; +} + +051-1.gat,134,16,0|script|#SoulEaters1|32767,{ +OnSpawn: + set $@SoulEaters1_count, 7; + areamonster "051-1.gat", 125, 14, 143, 18, "", 1097, $@SoulEaters1_count, "#SoulEaters1::OnSoulEaterDeath"; + end; + +OnSoulEaterDeath: + set $@SoulEaters1_count, $@SoulEaters1_count - 1; + if ($@illia_progress != 3 || $@illia_level_3_progress != 1) + end; + if (countitem("SealedSoul") == 0) + end; + delitem "SealedSoul", countitem("SealedSoul"); + message strcharinfo(0), "The Soul Eater feeds on the Sealed Souls you are carrying."; + end; +} + +// Spawn in the south grass area +051-1.gat,137,55,0|script|#SoulEaters2Trigger|32767,5,4,{ + if ($@illia_progress != 3 || $@illia_level_3_progress != 1) + end; + if ($@SoulEaters2_count > 0) + end; + donpcevent "#SoulEaters2::OnSpawn"; + end; +} + +051-1.gat,137,55,0|script|#SoulEaters2|32767,{ +OnSpawn: + set $@SoulEaters2_count, 4; + areamonster "051-1.gat", 134, 54, 139, 58, "", 1097, $@SoulEaters2_count, "#SoulEaters2::OnSoulEaterDeath"; + end; + +OnSoulEaterDeath: + set $@SoulEaters2_count, $@SoulEaters2_count - 1; + if ($@illia_progress != 3 || $@illia_level_3_progress != 1) + end; + if (countitem("SealedSoul") == 0) + end; + delitem "SealedSoul", countitem("SealedSoul"); + message strcharinfo(0), "The Soul Eater feeds on the Sealed Souls you are carrying."; + end; +} + +// Spawn near the eastern cliff +051-1.gat,155,35,0|script|#SoulEaters3Trigger|32767,4,7,{ + if ($@illia_progress != 3 || $@illia_level_3_progress != 1) + end; + if ($@SoulEaters3_count > 0) + end; + donpcevent "#SoulEaters3::OnSpawn"; + end; +} + +051-1.gat,155,35,0|script|#SoulEaters3|32767,{ +OnSpawn: + set $@SoulEaters3_count, 4; + areamonster "051-1.gat", 151, 29, 160, 45, "", 1097, $@SoulEaters3_count, "#SoulEaters3::OnSoulEaterDeath"; + end; + +OnSoulEaterDeath: + set $@SoulEaters3_count, $@SoulEaters3_count - 1; + if ($@illia_progress != 3 || $@illia_level_3_progress != 1) + end; + if (countitem("SealedSoul") == 0) + end; + delitem "SealedSoul", countitem("SealedSoul"); + message strcharinfo(0), "The Soul Eater feeds on the Sealed Souls you are carrying."; + end; +} + +// Spawn near the western cliff +051-1.gat,120,38,0|script|#SoulEaters4Trigger|32767,6,9,{ + if ($@illia_progress != 3 || $@illia_level_3_progress != 1) + end; + if ($@SoulEaters4_count > 0) + end; + donpcevent "#SoulEaters4::OnSpawn"; + end; +} + +051-1.gat,120,38,0|script|#SoulEaters4|32767,{ +OnSpawn: + set $@SoulEaters4_count, 4; + areamonster "051-1.gat", 116, 29, 127, 50, "", 1097, $@SoulEaters4_count, "#SoulEaters4::OnSoulEaterDeath"; + end; + +OnSoulEaterDeath: + set $@SoulEaters4_count, $@SoulEaters4_count - 1; + if ($@illia_progress != 3 || $@illia_level_3_progress != 1) + end; + if (countitem("SealedSoul") == 0) + end; + delitem "SealedSoul", countitem("SealedSoul"); + message strcharinfo(0), "The Soul Eater feeds on the Sealed Souls you are carrying."; + end; +} diff --git a/world/map/npc/051-1/forest.txt b/world/map/npc/051-1/forest.txt new file mode 100644 index 00000000..e21940ce --- /dev/null +++ b/world/map/npc/051-1/forest.txt @@ -0,0 +1,85 @@ +//----------------------------------------------------------------------------- +// Forest +// $@illia_progress = 1 +// +// Level progress: +// 0: Did not start the task yet +// 1: Players are searching for the rock. +// 2: Players found the rock +// 3: Players unlocked the door +//----------------------------------------------------------------------------- + +051-1.gat,64,46,0|script|Strange Stone|127,{ + set @step, 1; + if ($@illia_progress < @step) goto L_ShouldNotBeHere; + if (isin("051-1.gat", 65,45, 67,48) == 0) end; + if (strcharinfo(0) != $@ILLIA_HERO$) goto L_HandleHelper; + if ($@illia_level_1_progress == 0) goto L_GiveTask; + if ($@illia_level_1_progress == 1) goto L_TaskNotComplete; + if ($@illia_level_1_progress == 2) goto L_TaskComplete; + if ($@illia_level_1_progress == 3) goto L_NothingElseToDo; + end; + +L_ShouldNotBeHere: + percentheal -100, 0; + end; + +L_HandleHelper: + mes "This stuff sounds complicated."; + mes "I should ask " + $@ILLIA_HERO$ + " what to do."; + close; + +L_NothingElseToDo: + mes "The door is opened... What am I waiting for?"; + close; + +L_GiveTask: + mes "You look at the rocks with attention."; + mes "You are smart enough to notice that there seems to be a missing rock that could activate a mechanism."; + next; + menu + "This rock must not be far... Let's look around.", -; + set $@illia_level_1_progress, 1; + set $@illia_level_1_num_deaths, 0; + close; + +L_TaskNotComplete: + mes "It's not working. I have to find the rock."; + mes "With all the slimes around here, maybe one absorbed it."; + close; + +L_TaskComplete: + set $@illia_level_1_progress, 3; + set $@illia_progress, 2; + set $@illia_max_time, $@illia_max_time + 900; + mes "You insert the rock in the mechanism, then hear an unlock noise. The rocks move by themselves in a rumbling noise, making an opening in the wall."; + close; + +} + +// Warp from the forest, to the cave +051-1.gat,66,44,0|script|#ToCave|32767,1,1,{ + set @step, 1; + if ($@illia_progress < @step) goto L_ShouldNotBeHere; + if ($@illia_level_1_progress < 2) goto L_Blocked; + if ($@illia_level_1_progress == 2 && strcharinfo(0) == $@ILLIA_HERO$) goto L_SeeStone; + if ($@illia_level_1_progress == 3) goto L_Warp; + end; + +L_ShouldNotBeHere: + percentheal -100, 0; + end; + +L_Blocked: + message strcharinfo(0), "There should be a way to open this... but not with my bare hands."; + end; + +L_SeeStone: + message strcharinfo(0), "I should take a look at the stone."; + end; + +L_Warp: + warp "051-3.gat", 24, 60; + end; +} + diff --git a/world/map/npc/051-1/forestmonsters.txt b/world/map/npc/051-1/forestmonsters.txt new file mode 100644 index 00000000..28d1ac50 --- /dev/null +++ b/world/map/npc/051-1/forestmonsters.txt @@ -0,0 +1,21 @@ +051-1.gat,52,32,10,8|monster|Green Slime|1005,20,100000,30000,IlliaFMobs051-1::On1005 + +051-1.gat,0,0,0|script|IlliaFMobs051-1|-1,{ + +On1005: + if ($@illia_level_1_progress == 1) + goto L_RockFinding; + end; + +L_RockFinding: + set $@illia_level_1_num_deaths, $@illia_level_1_num_deaths + 1; + set @p, 50 - $@illia_level_1_num_deaths; + if (@p < 0) + set @p, 0; + if ($@illia_progress != 1 || $@ILLIA_STATUS != 4 || rand(@p) != 0) + end; + message strcharinfo(0), "This slime released a rock with a weird shape, that seems to fit in the mechanism!"; + set $@illia_level_1_progress, 2; + end; + +} diff --git a/world/map/npc/051-1/janitor.txt b/world/map/npc/051-1/janitor.txt new file mode 100644 index 00000000..333bb791 --- /dev/null +++ b/world/map/npc/051-1/janitor.txt @@ -0,0 +1,25 @@ +// Forest janitor +051-1.gat,1,1,0|script|#IlliaJanitor1|127,{ +end; + +OnCommandClean: + // Nothing to do here. + end; + +} + +// Desert janitor +051-1.gat,1,1,0|script|#IlliaJanitor3|127,{ +end; + +OnCommandClean: + killmonster "051-1.gat", "IlliaDMobs051-1::On1096"; + // Kill the soul eaters that were spawned + killmonster "051-1.gat", "#SoulEaters0::OnSoulEaterDeath"; + killmonster "051-1.gat", "#SoulEaters1::OnSoulEaterDeath"; + killmonster "051-1.gat", "#SoulEaters2::OnSoulEaterDeath"; + killmonster "051-1.gat", "#SoulEaters3::OnSoulEaterDeath"; + killmonster "051-1.gat", "#SoulEaters4::OnSoulEaterDeath"; + end; + +} diff --git a/world/map/npc/051-1/mapflags.txt b/world/map/npc/051-1/mapflags.txt new file mode 100644 index 00000000..83da4b77 --- /dev/null +++ b/world/map/npc/051-1/mapflags.txt @@ -0,0 +1 @@ +051-1.gat mapflag nosave 007-1,86,76; diff --git a/world/map/npc/051-3/_import.txt b/world/map/npc/051-3/_import.txt index f46391fd..3f7c2a21 100644 --- a/world/map/npc/051-3/_import.txt +++ b/world/map/npc/051-3/_import.txt @@ -3,3 +3,9 @@ map: 051-3.gat npc: npc/051-3/_mobs.txt npc: npc/051-3/_warps.txt +npc: npc/051-3/ambush.txt +npc: npc/051-3/jailslimes.txt +npc: npc/051-3/janitor.txt +npc: npc/051-3/locks.txt +npc: npc/051-3/mapflags.txt +npc: npc/051-3/reinforcements.txt diff --git a/world/map/npc/051-3/ambush.txt b/world/map/npc/051-3/ambush.txt new file mode 100644 index 00000000..fa9912b4 --- /dev/null +++ b/world/map/npc/051-3/ambush.txt @@ -0,0 +1,176 @@ +//----------------------------------------------------------------------------- +// Bandit cave +// $@illia_progress = 2 +// +// Level progress: +// 0: Did not start the task yet +// 1: Players are ambushed +// 2: Players escaped their jails +// 3: Reinforcements come when they approach the exit of the cave +// 4: Key of the door found, to leave the cave +//----------------------------------------------------------------------------- + +051-3.gat,40,52,0|script|#WayBlockedTrigger|32767,2,2,{ + message strcharinfo(0), "There is no way I can pass here. Let's find another way."; + end; +} + +051-3.gat,31,70,0|script|#AmbushReadyTrigger|32767,2,2,{ + set @step, 2; + if ($@illia_progress < @step) goto L_ShouldNotBeHere; + if (strcharinfo(0) == $@ILLIA_HERO$ && $@illia_level_2_progress == 0) goto L_PrepareAmbush; + end; + +L_PrepareAmbush: + disablenpc "Sneaky Bandit"; + disablenpc "Another Sneaky Bandit"; + end; + +L_ShouldNotBeHere: + percentheal -100, 0; + end; + +} + +051-3.gat,31,93,0|script|#BanditAmbushTrigger|32767,3,3,{ + set @step, 2; + if ($@illia_progress < @step) goto L_ShouldNotBeHere; + if ($@illia_level_2_progress == 0 && strcharinfo(0) == $@ILLIA_HERO$) goto L_MakeAmbush; + end; + +L_MakeAmbush: + set $@illia_level_2_progress, 1; + cmdothernpc "#BndtTl", "Ambush"; + end; + +L_ShouldNotBeHere: + percentheal -100, 0; + message strcharinfo(0), "Your throat got cut by a sneaky bandit!"; + end; +} + +051-3.gat,1,1,0|script|#BndtTl|127,{ + end; + +OnCommandAmbush: + initnpctimer; + end; + +OnTimer1000: + enablenpc "Sneaky Bandit"; + cmdothernpc "Sneaky Bandit", "Talk"; + enablenpc "Another Sneaky Bandit"; + cmdothernpc "Another Sneaky Bandit", "Talk"; + end; + +OnTimer9000: + areawarp "051-3.gat", 22, 45, 42, 97, "051-3.gat", 101, 13; + end; + +OnTimer9750: + areatimer "051-3.gat", 100, 12, 102, 15, 500, "#BndtTl::onOuch"; + areatimer "051-3.gat", 100, 12, 102, 15, 3000, "#BndtTl::onA"; + stopnpctimer; + setnpctimer 0; + end; + +onOuch: + message strcharinfo(0), "Ouch my head..."; + end; + +onA: + if (strcharinfo(0) == $@ILLIA_HERO$) + goto L_CaptureHero; + if (strcharinfo(0) == $@ILLIA_HELPER1$) + goto L_CaptureHelper1; + if (strcharinfo(0) == $@ILLIA_HELPER2$) + goto L_CaptureHelper2; + if (strcharinfo(0) == $@ILLIA_HELPER3$) + goto L_CaptureHelper3; + // kill that player otherwise, since not part of the quest. + percentheal -100,0; + end; + +L_CaptureHero: + // Simulate the capture of the player. + // Unequip all equipments + nude; + // put the health at 40%. + percentheal 100, 0; + percentheal -60, 0; + warp "051-3.gat", 69, 109; + message strcharinfo(0), "Meh... Where am I?"; + end; + +L_CaptureHelper1: + // Simulate the capture of the player. + // Unequip all equipments + nude; + // put the health at 40%. + percentheal 100, 0; + percentheal -60, 0; + warp "051-3.gat", 64, 102; + message strcharinfo(0), "Meh... Where am I?"; + end; + +L_CaptureHelper2: + // Simulate the capture of the player. + // Unequip all equipments + nude; + // put the health at 40%. + percentheal 100, 0; + percentheal -60, 0; + warp "051-3.gat", 62, 102; + message strcharinfo(0), "Meh... Where am I?"; + end; + +L_CaptureHelper3: + // Simulate the capture of the player. + // Unequip all equipments + nude; + // put the health at 40%. + percentheal 100, 0; + percentheal -60, 0; + warp "051-3.gat", 58, 102; + message strcharinfo(0), "Meh... Where am I?"; + end; + +} + +051-3.gat,29,94,0|script|Sneaky Bandit|127,{ + end; + +OnCommandTalk: + initnpctimer; + end; + +OnTimer100: + npctalk "Did you think you could sneak in our den without a problem?"; + end; + +OnTimer3600: + npctalk "Drop your weapons, and come with us!"; + stopnpctimer; + setnpctimer 0; + end; + +} + +051-3.gat,33,95,0|script|Another Sneaky Bandit|127,{ + end; + +OnCommandTalk: + initnpctimer; + end; + +OnTimer1500: + npctalk "W00t! More slaves!"; + end; + +OnTimer5500: + npctalk "Ahaha, that was easy!"; + stopnpctimer; + setnpctimer 0; + end; + +} diff --git a/world/map/npc/051-3/jailslimes.txt b/world/map/npc/051-3/jailslimes.txt new file mode 100644 index 00000000..a008a8fd --- /dev/null +++ b/world/map/npc/051-3/jailslimes.txt @@ -0,0 +1,29 @@ +// Separate spawns for the copper slimes in the 4 jails +051-3.gat,57,104,1,1|monster|Copper Slime|1098,1,60000,30000,IlliaCMobs051-3::On1098 +051-3.gat,62,104,1,1|monster|Copper Slime|1098,1,60000,30000,IlliaCMobs051-3::On1098 +051-3.gat,63,104,1,1|monster|Copper Slime|1098,1,60000,30000,IlliaCMobs051-3::On1098 +051-3.gat,70,111,1,1|monster|Copper Slime|1098,1,60000,30000,IlliaCMobs051-3::On1098 + +051-3.gat,0,0,0|script|IlliaCMobs051-3|-1,{ + +On1098: + if (rand(100) < 80 && $@illia_progress == 2 && ($@illia_level_2_progress == 1 || $@illia_level_2_progress == 2)) + goto L_LockPicks; + goto L_End; + +L_LockPicks: + if (countitem ("LockPicks") == 0) + goto L_GiveLockPicks; + goto L_End; + +L_GiveLockPicks: + message strcharinfo(0), "Hey nice, someone left behind these rusty lock picks."; + getitem "LockPicks", 1; + goto L_End; + +L_End: + set @mobID, 1098; + callfunc "MobPoints"; + end; + +} diff --git a/world/map/npc/051-3/janitor.txt b/world/map/npc/051-3/janitor.txt new file mode 100644 index 00000000..5dfb1c30 --- /dev/null +++ b/world/map/npc/051-3/janitor.txt @@ -0,0 +1,10 @@ +// Bandit cave janitor +051-3.gat,1,1,0|script|#IlliaJanitor2|127,{ +end; + +OnCommandClean: + // Kill all remaining bandits spawned during the "reinforcements" event + killmonster "051-1.gat", "Door::onB"; + end; + +} diff --git a/world/map/npc/051-3/locks.txt b/world/map/npc/051-3/locks.txt new file mode 100644 index 00000000..242532ae --- /dev/null +++ b/world/map/npc/051-3/locks.txt @@ -0,0 +1,69 @@ +051-3.gat,69,107,0|script|Jail Lock 1|127,{ + + if (isin("051-3.gat", 69, 108, 73, 111)) goto L_Do_Lock_Picking; + end; + +L_Do_Lock_Picking: + callfunc "LockPicking"; + if (@lock_picking_success > 0) + goto L_OpenDoor; + close; + +L_OpenDoor: + set @lock_picking_success, 0; + warp "051-3.gat", 69, 104; + message strcharinfo(0), "Ok, let's get out of here now."; + set $@illia_level_2_progress, 2; + close; +} + +051-3.gat,64,100,0|script|Jail Lock 2|127,{ + + if (isin("051-3.gat", 64, 101, 66, 104)) goto L_Do_Lock_Picking; + end; + +L_Do_Lock_Picking: + callfunc "LockPicking"; + if (@lock_picking_success > 0) + goto L_OpenDoor; + close; + +L_OpenDoor: + set @lock_picking_success, 0; + warp "051-3.gat", 64, 97; + close; +} + +051-3.gat,62,100,0|script|Jail Lock 3|127,{ + + if (isin("051-3.gat", 61, 101, 62, 104)) goto L_Do_Lock_Picking; + end; + +L_Do_Lock_Picking: + callfunc "LockPicking"; + if (@lock_picking_success > 0) + goto L_OpenDoor; + close; + +L_OpenDoor: + set @lock_picking_success, 0; + warp "051-3.gat", 62, 97; + close; +} + +051-3.gat,58,100,0|script|Jail Lock 4|127,{ + + if (isin("051-3.gat", 57, 101, 58, 104)) goto L_Do_Lock_Picking; + end; + +L_Do_Lock_Picking: + callfunc "LockPicking"; + if (@lock_picking_success > 0) + goto L_OpenDoor; + close; + +L_OpenDoor: + set @lock_picking_success, 0; + warp "051-3.gat", 58, 97; + close; +} diff --git a/world/map/npc/051-3/mapflags.txt b/world/map/npc/051-3/mapflags.txt new file mode 100644 index 00000000..450ee23b --- /dev/null +++ b/world/map/npc/051-3/mapflags.txt @@ -0,0 +1 @@ +051-3.gat mapflag nosave 007-1,86,76; diff --git a/world/map/npc/051-3/reinforcements.txt b/world/map/npc/051-3/reinforcements.txt new file mode 100644 index 00000000..91cfaf37 --- /dev/null +++ b/world/map/npc/051-3/reinforcements.txt @@ -0,0 +1,85 @@ +051-3.gat,47,30,0|script|#BndtRnfrcmtsTrigger|32767,2,3,{ + + set @step, 2; + if ($@illia_progress < @step) goto L_ShouldNotBeHere; + if ($@illia_level_2_progress == 2) goto L_CallReinforcements; + end; + +L_CallReinforcements: + donpcevent "Door::OnRnfrcmts"; + end; + +L_ShouldNotBeHere: + percentheal -100, 0; + end; +} + +051-3.gat,37,24,0|script|Door|127,{ + + set @step, 2; + if ($@illia_progress < @step) goto L_ShouldNotBeHere; + mes "Try open the door?"; + menu + "Yes", L_TryOpen, + "Do nothing", -; + close; + +L_ShouldNotBeHere: + percentheal -100, 0; + end; + +L_TryOpen: + if ($@illia_level_2_progress < 4) + goto L_KeyNotFound; + goto L_Warp; + end; + +L_KeyNotFound: + mes "You do not see a way to open this door."; + close; + +L_Warp: + mes "You place the key in the door and open the lock."; + warp "051-1.gat", 118, 55; + close; + +OnRnfrcmts: + set $@illia_level_2_progress, 3; + // Spawn 20 bandits + areamonster "051-3.gat", 29, 25, 48, 39, "", 1064, 18, "Door::onB"; + // Spawn 4 bandit lords + areamonster "051-3.gat", 29, 25, 48, 39, "", 1065, 3, "Door::onB"; + initnpctimer; + mapannounce "051-3.gat", "Bandit Lords: Do not let them escape!!" , 0; + areatimer "051-3.gat", 25, 20, 80, 85, 10, "Door::onDRnfrcmts"; + end; + +onB: + end; + +onDRnfrcmts: + message strcharinfo(0), "Oh no, reinforcements! We must kill them all!"; + end; + +OnTimer2000: + setnpctimer 0; + if ($@illia_level_2_progress != 3 || $@illia_progress != 2) + end; + if (mobcount("051-3.gat", "Door::onB") < 0) + goto L_OpenDoor; + end; + +L_OpenDoor: + set $@illia_level_2_progress, 4; + set $@illia_progress, 3; + set $@illia_max_time, $@illia_max_time + 900; + areatimer "051-3.gat", 25, 20, 80, 85, 10, "Door::onKeyFound"; + stopnpctimer; + setnpctimer 0; + end; + +onKeyFound: + message strcharinfo(0), "One of the defeated bandit lords had a door key attached to his belt."; + end; + +} diff --git a/world/map/npc/052-1/_import.txt b/world/map/npc/052-1/_import.txt index 29240d1c..96b46ee0 100644 --- a/world/map/npc/052-1/_import.txt +++ b/world/map/npc/052-1/_import.txt @@ -3,3 +3,6 @@ map: 052-1.gat npc: npc/052-1/_mobs.txt npc: npc/052-1/_warps.txt +npc: npc/052-1/channelling.txt +npc: npc/052-1/janitor.txt +npc: npc/052-1/mapflags.txt diff --git a/world/map/npc/052-1/channelling.txt b/world/map/npc/052-1/channelling.txt new file mode 100644 index 00000000..9c6ffe88 --- /dev/null +++ b/world/map/npc/052-1/channelling.txt @@ -0,0 +1,311 @@ +//----------------------------------------------------------------------------- +// Illia Island +// $@illia_progress = 4 +// +// Level progress: +// 0: Did not start the channelling, or previous channelling failed +// 1: Channelling started +// 2: Channelling completed +//----------------------------------------------------------------------------- + +052-1.gat,25,44,0|script|#EnchantDoorTrigger|32767,3,4,{ + set @step, 4; + if ($@illia_progress < @step) goto L_ShouldNotBeHere; + if (strcharinfo(0) == $@ILLIA_HERO$ && + $@illia_level_4_progress == 0) goto L_EnchantDoor; + end; + +L_EnchantDoor: + enablenpc "#Enchanted Door"; + end; + +L_ShouldNotBeHere: + percentheal -100, 0; + end; + +} + +052-1.gat,57,29,0|script|#Enchanted Door|369,1,1{ + if ($@illia_level_4_progress != 2) goto L_PushBack; + end; + +L_PushBack: + warp "052-1.gat", 57, 34; + percentheal -20, 0; + message strcharinfo(0), "You are pushed back violently. There is probably some way to break this barrier."; + mes "You are pushed back violently."; + mes "There is probably some way to break this barrier."; + close; + +OnCommandDS: + areamonster "052-1.gat", 56, 30, 60, 31, "", 1101, 2 + rand(3), "#Enchanted Door::onSpawn"; + misceffect FX_EVIL_SUMMON; + end; + +onSpawn: + end; + +} + +052-1.gat,57,29,0|script|#Enchanted Door2|127,1,1{ + if ($@illia_level_4_progress == 2) goto L_Warp; + end; + +L_Warp: + warp "052-2.gat", 33, 40; + end; + +OnCommandDestroy: + misceffect FX_ENCHANTED_DOOR_BROKEN; + end; + +} + +052-1.gat,51,38,0|script|Engravings|127,{ + mes "You can read some words engraved inside this rock, but some are erased by wind and time:"; + next; + mes "\".. can use this .. power..´. . .´. . . amplify a spell ..´."; + mes " . ´´. Don't let .. spell power .´..´ . .. fade away ..."; + mes "´ .Use lazurite stones ´..´. they will appear. ..´ .. drop them inside .. this circle."; + mes ". ´ power.. drains .. life..´. .´ focus . .not move at all´. .\""; + next; + mes "Below this strange writing, you notice a word still deeply engraved in the stone:"; + next; + mes "\"#catalazuli\""; + next; + mes "... that looks like an incantation or something."; + if ($@illia_level_4_progress == 0) + goto L_SuggestChannelling; + close; + +L_SuggestChannelling: + next; + mes "I think this blue circle right here can be helpful to break the enchantment that blocks the door of the Inn."; + next; + mes "Let's see how I can activate it..."; + mes "But I should probably get inside it, first."; + close; + +} + +function|script|StartChannelling|{ + if (isat("052-1.gat",53,38) == 0) + end; + if ($@illia_level_4_progress > 0) + end; + set $@illia_level_4_progress, 1; + set $@illia_char_channelling$, strcharinfo(0); + + set @bonus, (readparam(bInt)+1) / 25; + // Lazurite Stones power, will also depend on the Int of the channelling character + setarray $@illia_lazurites_power, + 12 + @bonus, // small + 32 + @bonus, // regular + 65 + @bonus; // large + + // coordinates where stones will appear + setarray $@illia_small_lazurites, 50,41, 44,33, 61,42; + setarray $@illia_regular_lazurites, 68,29, 47,25, 38,45, 70,40; + setarray $@illia_large_lazurites, 21,40, 34,25; + + // amount of initial magic power + set $@illia_magic_power, 1811 + readparam(bInt)*2; + // Channelling required power depends on the base Int of the character + set $@illia_magic_power_required, 5707 - 2*readparam(bInt); + // magic power loss depends also on Int + set $@illia_magic_power_loss, 53 - ((readparam(bInt)+1)*2)/10; + + // register the power status to display hints to the players + // Statuses: 0=critical(below 300), 1=neutral, 2=almost there (max-300) + set $@illia_magic_power_status, 1; + + message strcharinfo(0), "Ok, let's stay focused now!"; + cmdothernpc "#Power Circle", "St"; + close; + +} + +052-1.gat,53,38,0|script|#Power Circle|368,{ + set @step, 4; + if ($@illia_progress < @step) + goto L_ShouldNotBeHere; + if (isat("052-1.gat",53,38) == 0) + goto L_Hint; + end; + +OnCommandSt: + initnpctimer; + end; + +L_Hint: + mes "Magic seems to be flowing from this place. I should find out what it is."; + close; + +OnTimer2000: + callsub S_CheckChannelling; + end; + +OnTimer4000: + callsub S_CheckChannelling; + end; + +OnTimer6000: + // Spawn items at specific place + callsub S_ItemSpawn; + callsub S_CheckChannelling; + end; + +OnTimer8000: + callsub S_CheckChannelling; + end; + +OnTimer10000: + // Spawn items at specific place + callsub S_ItemSpawn; + callsub S_CheckChannelling; + end; + +OnTimer11000: + setnpctimer 0; + // Spawn monsters (demonic spirits) near the enchanted door + cmdothernpc "#Enchanted Door", "DS"; + end; + +S_ItemSpawn: + if (isloggedin(getcharid(3, $@illia_char_channelling$)) == 0) + return; + attachrid(getcharid(3, $@illia_char_channelling$)); + // spawn items at random + set $@illia_item_spawn_i, rand(getarraysize($@illia_small_lazurites)/2); + set $@illia_item_spawn_x, $@illia_small_lazurites[$@illia_item_spawn_i*2]; + set $@illia_item_spawn_y, $@illia_small_lazurites[($@illia_item_spawn_i*2)+1]; + if (rand(10) > 0) + makeitem 873, rand(4,7), "052-1.gat", $@illia_item_spawn_x, $@illia_item_spawn_y; + + set $@illia_item_spawn_i, rand(getarraysize($@illia_regular_lazurites)/2); + set $@illia_item_spawn_x, $@illia_regular_lazurites[$@illia_item_spawn_i*2]; + set $@illia_item_spawn_y, $@illia_regular_lazurites[($@illia_item_spawn_i*2)+1]; + if (rand(8) > 0) + makeitem 874, rand(3,4), "052-1.gat", $@illia_item_spawn_x, $@illia_item_spawn_y; + + set $@illia_item_spawn_i, rand(getarraysize($@illia_large_lazurites)/2); + set $@illia_item_spawn_x, $@illia_large_lazurites[$@illia_item_spawn_i*2]; + set $@illia_item_spawn_y, $@illia_large_lazurites[($@illia_item_spawn_i*2)+1]; + if (rand(4) > 0) + makeitem 875, rand(1,2), "052-1.gat", $@illia_item_spawn_x, $@illia_item_spawn_y; + + set $@illia_item_spawn_i, 0; + set $@illia_item_spawn_x, 0; + set $@illia_item_spawn_y, 0; + + detachrid; + return; + +S_CheckChannelling: + // Remove stones inside the circle + set $@illia_magic_power, $@illia_magic_power + + getareadropitem("052-1.gat", 52, 37, 54, 39, 873, 1)*$@illia_lazurites_power[0] + + getareadropitem("052-1.gat", 52, 37, 54, 39, 874, 1)*$@illia_lazurites_power[1] + + getareadropitem("052-1.gat", 52, 37, 54, 39, 875, 1)*$@illia_lazurites_power[2]; + + // magic power fades over time + set $@illia_magic_power, $@illia_magic_power - $@illia_magic_power_loss; + + set $@illia_magic_power_last_status, $@illia_magic_power_status; + set $@illia_magic_power_status, 1; + if ($@illia_magic_power < 300) + set $@illia_magic_power_status, 0; + if ($@illia_magic_power > $@illia_magic_power_required - 300) + set $@illia_magic_power_status, 2; + + // Player loses a part of his health while channelling + if (isloggedin(getcharid(3, $@illia_char_channelling$)) == 0) + goto L_ChannellingFail; + attachrid(getcharid(3, $@illia_char_channelling$)); + // Display an effect showing the drain + misceffect FX_CHANNELLING_RAISE; + percentheal -4, 0; + + if (isdead()) + goto L_ChannellingDead; + if (isat("052-1.gat",53,38) == 0) + goto L_ChannellingMoved; + // check the magic power + if ($@illia_magic_power <= 0) + goto L_ChannellingPowerVanished; + if ($@illia_magic_power >= $@illia_magic_power_required) + goto L_ChannellingComplete; + + detachrid; + + if ($@illia_magic_power_last_status == 0 && $@illia_magic_power_status == 1) + mapannounce "052-1.gat", $@illia_char_channelling$ + ": I think I'm controlling the spell again now. Keep up!", 0; + if ($@illia_magic_power_last_status == 1 && $@illia_magic_power_status == 0) + mapannounce "052-1.gat", $@illia_char_channelling$ + ": Guys I'm loosing it! Hurry up!", 0; + if ($@illia_magic_power_last_status == 1 && $@illia_magic_power_status == 2) + mapannounce "052-1.gat", $@illia_char_channelling$ + ": I almost have the power to cast it! One last effort!", 0; + if ($@illia_magic_power_last_status == 2 && $@illia_magic_power_status == 1) + mapannounce "052-1.gat", $@illia_char_channelling$ + ": Damn! It faded a little.", 0; + + return; + +L_ChannellingComplete: + message strcharinfo(0), "You successfully cast the spell and broke the door's enchantment!"; + detachrid; + stopnpctimer; + setnpctimer 0; + set $@illia_magic_power, 0; + set $@illia_magic_power_required, 0; + set $@illia_magic_power_last_status, 0; + set $@illia_magic_power_status, 0; + set $@illia_magic_power_loss, 0; + set $@illia_char_channelling$, ""; + set $@illia_level_4_progress, 2; + set $@illia_progress, 5; + set $@illia_max_time, $@illia_max_time + 900; + // Effect to display the disenchant is cast + misceffect FX_CHANNELLING_CAST; + // move away the enchanted door + cmdothernpc "#Enchanted Door2", "Destroy"; + disablenpc "#Enchanted Door"; + end; + +L_ChannellingDead: + misceffect FX_MAGIC_DARK_EXPLOSION, strcharinfo(0); + goto L_ChannellingFail; + +L_ChannellingMoved: + // kill the player as part of the process: the magic process drained his life. + // But only if he is still in the island (otherwise, he probably got warped + // and does not need being killed) + if (isin("052-1.gat",1,1,100,80) == 0) + goto L_ChannellingFail; + percentheal -100, 0; + misceffect FX_MAGIC_DARK_EXPLOSION, strcharinfo(0); + message strcharinfo(0), "You moved out of the power circle. The magic power you accumulated backfires at you!"; + goto L_ChannellingFail; + +L_ChannellingPowerVanished: + // kill the player as part of the process: the magic process drained his life. + percentheal -100, 0; + misceffect FX_MAGIC_DARK_EXPLOSION, strcharinfo(0); + message strcharinfo(0), "The magic power vanished, and your spell backfires at you!"; + goto L_ChannellingFail; + +L_ChannellingFail: + detachrid; + stopnpctimer; + setnpctimer 0; + set $@illia_magic_power, 0; + set $@illia_magic_power_required, 0; + set $@illia_magic_power_last_status, 0; + set $@illia_magic_power_status, 0; + set $@illia_magic_power_loss, 0; + set $@illia_char_channelling$, ""; + set $@illia_level_4_progress, 0; + end; + +L_ShouldNotBeHere: + percentheal -100, 0; + end; +} diff --git a/world/map/npc/052-1/janitor.txt b/world/map/npc/052-1/janitor.txt new file mode 100644 index 00000000..e2ca8c4f --- /dev/null +++ b/world/map/npc/052-1/janitor.txt @@ -0,0 +1,18 @@ +// Illia Island janitor + +052-1.gat,1,1,0|script|#IlliaJanitor4|127,{ +end; + +OnCommandClean: + // Kill all monsters (that includes the spawned Demonic Spirits and Azul Slimes) + // Note that the loot the slimes may have picked will be deleted at the same time. + killmonsterall "052-1.gat"; + // Delete the magic stones that are still laying around. + // FIXME Syntax error happens if not setting a variable... + set $@dummy_var, getareadropitem("052-1.gat", 1, 1, 98, 78, 873, 1) + + getareadropitem("052-1.gat", 1, 1, 98, 78, 874, 1) + + getareadropitem("052-1.gat", 1, 1, 98, 78, 875, 1); + set $@dummy_var, 0; + end; + +} diff --git a/world/map/npc/052-1/mapflags.txt b/world/map/npc/052-1/mapflags.txt new file mode 100644 index 00000000..1490f5c0 --- /dev/null +++ b/world/map/npc/052-1/mapflags.txt @@ -0,0 +1 @@ +052-1.gat mapflag nosave 007-1,86,76; 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; + +} + diff --git a/world/map/npc/functions/lockpicking.txt b/world/map/npc/functions/lockpicking.txt new file mode 100644 index 00000000..1605431d --- /dev/null +++ b/world/map/npc/functions/lockpicking.txt @@ -0,0 +1,93 @@ +//----------------------------------------------------------------------------- +// Lock picking. +// 3 pins per lock. +// The player has to find the good number of times to hit a pin +//----------------------------------------------------------------------------- + +function|script|LockPicking|{ + + set @lock_picking_success, 0; + setarray @pins, rand(1,3), rand(1,3), rand(1,3); + goto L_StartLockPicking; + +L_NeedLockPickSet: + menu + "Unfortunately, I don't have these tools... Let's look around.", -; + return; + +L_StartLockPicking: + mes "You inspect the lock and notice it isn't sophisticated."; + mes "With regular stuff, you should be able to lock pick it."; + next; + if (countitem ("LockPicks") < 1) + goto L_NeedLockPickSet; + menu + "I can try with these lock picks I just found.", -, + "Maybe later.", L_Return; + delitem "LockPicks", 1; + mes "You insert the hook pick inside the lock, and, without applying any tension, you discover there are only 3 pins to set."; + next; + mes "You will need to set the 3 pins to align them and turn the lock's cylinder."; + mes "A wrong move will make you start over. Remember how you had set the pins!"; + next; + set @pin, 0; + goto L_HandlePin; + +L_NextPinOrEnd: + if (@pin >= 2) + goto L_OpenDoor; + set @pin, @pin + 1; + mes "Click! This pin is set!"; + next; + goto L_HandlePin; + +L_HandlePin: + if (@pin == 0) + mes "What to do with the first pin?"; + if (@pin == 1) + mes "What to do with the second pin?"; + if (@pin == 2) + mes "What to do with the last pin?"; + menu + "Apply a soft pressure.", L_PinSoft, + "Apply a normal pressure.", L_PinNormal, + "Apply a strong pressure.", L_PinHard, + "Give up. I'm in a rush!", L_GiveUp; + return; + +L_GiveUp: + set @lock_picking_success, 0; + set @pin, 0; + cleararray @pins, 0, 3; + set @pin_pressure, 0; + return; + +L_PinSoft: + set @pin_pressure, 1; + goto L_TestPin; + +L_PinNormal: + set @pin_pressure, 2; + goto L_TestPin; + +L_PinHard: + set @pin_pressure, 3; + goto L_TestPin; + +L_TestPin: + if (@pin_pressure == @pins[@pin]) + goto L_NextPinOrEnd; + mes "Nope, that did not work. And the pins are unset now..."; + next; + set @pin, 0; + goto L_HandlePin; + +L_Return: + return; + +L_OpenDoor: + set @lock_picking_success, 1; + mes "The two sets of pins separate. You can now turn the cylinder to open the door!"; + return; + +} diff --git a/world/map/npc/scripts.conf b/world/map/npc/scripts.conf index 6c744136..77e74333 100644 --- a/world/map/npc/scripts.conf +++ b/world/map/npc/scripts.conf @@ -18,6 +18,7 @@ npc: npc/functions/time.txt npc: npc/functions/water_bottle.txt npc: npc/functions/evil_obelisk.txt npc: npc/functions/debug.txt +npc: npc/functions/lockpicking.txt // Item Functions npc: npc/items/purification_potion.txt |