From e7421cf568272149d0b47b9c7da51b35550d55c1 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Thu, 28 Feb 2019 15:44:29 +0000 Subject: The four sewer mouths in Artis. They all behave differently. The first one is still TODO to prevent conflicts with Mundane Quest --- npc/001-1/manhole.txt | 56 +++++++++++++++++++++++++++++++----- npc/functions/manhole.txt | 73 +++++++++++++++++++++++++++++++++++++++++++++++ npc/scripts.conf | 3 ++ 3 files changed, 125 insertions(+), 7 deletions(-) create mode 100644 npc/functions/manhole.txt diff --git a/npc/001-1/manhole.txt b/npc/001-1/manhole.txt index 6637819d..856689a3 100644 --- a/npc/001-1/manhole.txt +++ b/npc/001-1/manhole.txt @@ -46,17 +46,37 @@ OnInit: 001-1,196,35,0 script #manhole2-001-1 NPC_NO_SPRITE,{ - if (getq(ArtisQuests_MonaDad) < 1) { - end; + .@i=manhole_interact("001-3-0"); + closeclientdialog(); + if (.@i == -1) { + slide_or_warp("001-3-0", 196, 36); + } else if (.@i == TrainingArrow || .@i == WoodenBow) { + npctalk3 l("Mundane: Hey! Is someone there? Please, help, it's so dark down here!"); } + close; - narrator(S_LAST_BLANK_LINE | S_LAST_NEXT, - l("You hear some creeping and crawling sounds from the murkiness below."), - l("..."), - l("Do you want to enter in sewer?")); +OnInit: + .sex = G_OTHER; + .distance = 1; + end; +} + +001-1,146,123,0 script #manhole3-001-1 NPC_NO_SPRITE,{ + .@i=manhole_interact("001-3-0"); closeclientdialog(); - if (askyesno() == 1) slide_or_warp("001-3-0", 196, 36); + if (.@i == -1) { + // Not a fan of calling strong players as weak, so take STR in account + // If you have enough STR, you get an Easter Egg about the engine :) + if (readparam(bStr) < 50) { + mesc l("The lid is sealed shut, and you are too weak to open it."); + } else { + mesc l("Even with your Hercules strength, this lid is hopelessly struck."); + } + } else if (.@i == TrainingArrow || .@i == WoodenBow) { + // This is the wrong lid for Mundane Quest + npctalk3 l("..."); + } close; OnInit: @@ -64,3 +84,25 @@ OnInit: .distance = 1; end; } + +// This lid can only be used to leave +001-1,86,131,0 script #manhole4-001-1 NPC_NO_SPRITE,{ + + .@i=manhole_interact("001-3-0"); + closeclientdialog(); + if (.@i == -1) { + mesc l("Strangely enough, this lid can only be open from inside."); + } else if (.@i == TrainingArrow || .@i == WoodenBow) { + // This is the wrong lid for Mundane Quest + npctalk3 l("..."); + } + close; + +OnInit: + .sex = G_OTHER; + .distance = 1; + end; +} + +// To quickly create more sewer mouths we can use: +//001-1,86,131,0 duplicate(#manhole3-001-1) #manhole4-001-1 NPC_NO_SPRITE diff --git a/npc/functions/manhole.txt b/npc/functions/manhole.txt new file mode 100644 index 00000000..a56b6542 --- /dev/null +++ b/npc/functions/manhole.txt @@ -0,0 +1,73 @@ +// TMW2 Script +// Authors: +// Jesusalva +// +// Description: +// Handles Artis manholes +// Relies on getmap, be sure coords are enough compatible +// ie. Leave a 2x2 area free of collision in the target coordinates +// Heights weren't checked + +// manhole_interact( dest_map ) +// Carries over getmapxy() for NPC +// This is for Artis and thus, hackish. +// Return Codes: +// -1 : Tried to enter Sewers +// >0 : ID of dropped item (in case it must be caught) + +function script manhole_interact { + .@dest_map$=getarg(0); + getmapxy(.@m$, .@x, .@y, UNITTYPE_NPC); + + narrator(S_LAST_BLANK_LINE | S_LAST_NEXT, + l("You hear some creeping and crawling sounds from the murkiness below."), + l("...")); + + select + l("Do you want to leave it alone?"), + rif(getq(ArtisQuests_MonaDad), l("Do you want to enter in sewer?")), + l("Do you want to throw something inside?"); + + switch (@menu) { + case 1: + close; break; + case 2: + return -1; break; + case 3: + mes "##B" + l("Drag and drop an item from your inventory.") + "##b"; + + .@id = requestitem(); + + // If ID is invalid + if (.@id < 1) { + mesc l("You give up."); + close; + } + + // If there's not enough items, it is bound, it cannot be traded/dropped/sold, etc. + if (countitem(.@id) < 1 || checkbound(.@id) || getiteminfo(.@id, ITEMINFO_TRADE)) { + mesc l("You cannot drop this item!"); + close; + } + + // Delete item and spawn it on the equivalent map + delitem .@id, 1; + makeitem .@id, 1, .@dest_map$, .@x+rand(-2, 2), .@y+rand(-2, 2); + + // May spawn a monster if it is food (33% odds) + if (getiteminfo(.@id, ITEMINFO_TYPE) == IT_HEALING && rand(1,3) == 3) { + // Would be nice to customize but not needed atm + // 1 mob for every 30 levels (level 99 players spawn 4 mobs) + // Note that food type is currently disregarded (and it accepts any healing item) + .@monsterId=any(slime, Croc, LittleBlub, CaveMaggot); + .@mobGID = monster(.@m$, .@x, .@y, strmobinfo(1, .@monsterId), .@monsterId, (BaseLevel/30)+1); + unitattack(.@mobGID, getcharid(CHAR_ID_ACCOUNT)); // "It's not aggressive"? We don't care. + } + + return .@id; break; + } + + + +} + diff --git a/npc/scripts.conf b/npc/scripts.conf index 91d5b218..fd8f6ea9 100644 --- a/npc/scripts.conf +++ b/npc/scripts.conf @@ -47,6 +47,9 @@ "npc/functions/confused-tree-dict.txt", "npc/functions/util.txt", +// May rely on custom functions and thus must be handled by last +"npc/functions/manhole.txt", + // quest debug "npc/functions/quest-debug/functions.txt", "npc/functions/quest-debug/000-ShipQuests_Julia.txt", -- cgit v1.2.3-60-g2f50