diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-05-08 12:47:02 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-05-08 12:47:02 -0300 |
commit | 0bcd9c80f32fb46d0c6b4409b9c9e9e691fcbef8 (patch) | |
tree | 9c0c5fceeb18e5275279c043de56f5ddef9bf00a | |
parent | 22e4bc1892235d29eedb59fafee4c4397ecb3189 (diff) | |
download | serverdata-0bcd9c80f32fb46d0c6b4409b9c9e9e691fcbef8.tar.gz serverdata-0bcd9c80f32fb46d0c6b4409b9c9e9e691fcbef8.tar.bz2 serverdata-0bcd9c80f32fb46d0c6b4409b9c9e9e691fcbef8.tar.xz serverdata-0bcd9c80f32fb46d0c6b4409b9c9e9e691fcbef8.zip |
Improve how arresting script works so it can be fixed more easily later.
Rewrite the thief gates and wheels so I don't duplicate this messy code
-rw-r--r-- | npc/001-1/sophialla.txt | 1 | ||||
-rw-r--r-- | npc/001-2-8/doors.txt | 4 | ||||
-rw-r--r-- | npc/001-3-0/gates.txt | 100 | ||||
-rw-r--r-- | npc/001-3-2/henry.txt | 8 | ||||
-rw-r--r-- | npc/functions/lockpicks.txt | 24 | ||||
-rw-r--r-- | npc/functions/quest-debug/035_ThiefQuests_Artis.txt | 7 |
6 files changed, 116 insertions, 28 deletions
diff --git a/npc/001-1/sophialla.txt b/npc/001-1/sophialla.txt index ad0755ec..d2bb6760 100644 --- a/npc/001-1/sophialla.txt +++ b/npc/001-1/sophialla.txt @@ -25,6 +25,7 @@ mes ""; if (@menu == 2) { + // TODO: Tell to look for Henry TODO: Change curious eye conditional speech l("If you visit the sewers again... You'll find secret passages..."), l("Look for the hideout, but tell no one about this. Then, say the password again."); diff --git a/npc/001-2-8/doors.txt b/npc/001-2-8/doors.txt index 9d9de958..9867ffd3 100644 --- a/npc/001-2-8/doors.txt +++ b/npc/001-2-8/doors.txt @@ -31,8 +31,8 @@ function breakIn { } else { if (ArrestedChances()) { mesc l("Arrested!"); - // TODO: Arrest player, preferably without GM commands D: - atcommand("@jailfor 5mn "+strcharinfo(0)); + mesc l("You'll now spend a few minutes on the jail to reflect on your actions."); + ArrestPlayer(5); } else { mesc l("You're almost found out, but manage to make a quick escape!"); warp "001-1", 90, 55; diff --git a/npc/001-3-0/gates.txt b/npc/001-3-0/gates.txt index 8eaca1b0..c9ec388a 100644 --- a/npc/001-3-0/gates.txt +++ b/npc/001-3-0/gates.txt @@ -4,48 +4,98 @@ // Description: // The Sewer Gates, and Wheels. -001-3-0,90,62,0 script #Gate1 NPC_SEWER_GATE,2,2,{ +001-3-0,90,62,0 script #ArtisThiefGate_1 NPC_SEWER_GATE,2,2,{ + // Extract the quest ID from name (or fail trying) + explode(.@ni$, .name$, "_"); + .@id=atoi(.@ni[1]); + .@q=getq(ThiefQuests_Artis); - mes l("This gate is closed."); + .@q2=getq2(ThiefQuests_Artis); + + // Check what you can do with the gate + if (.@q != .@id) { + mes l("This gate is closed."); + mesc l("No need to go through here, so lets not bother with it now."); + } else if (.@q2 != 2) { + mes l("This gate is closed."); + mesc l("It seems that it can be open using the mechanism on the side."); + } else { + mes l("This gate is open."); + mesc l("I should still be careful to don't get caught."); + } close; OnTouch: updateSpotlight(true); end; -OnInit: - .distance = 1; +// Open +OnTimer2200: + .dir=4; end; -} - -001-3-0,56,44,0 script #Gate2 NPC_SEWER_GATE,2,2,{ - .@q=getq(ThiefQuests_Artis); - mes l("This gate is closed."); - close; -OnTouch: - updateSpotlight(true); +// Closing +OnTimer8000: + .dir=6; end; -OnInit: - .distance = 1; +// Closed +OnTimer10400: + .dir=0; end; -} -001-3-0,92,61,0 script #Wheel1 NPC_SEWER_WHEEL,{ - speech - l("You try to move this wheel, but it is stuck. Something seems to be missing."); - close; +// Don't reply immediately, wait a tiny bit +OnTimer11000: + .busy=false; + stopnpctimer; OnInit: + .busy=false; .distance = 1; end; } -001-3-0,58,43,0 script #Wheel2 NPC_SEWER_WHEEL,{ - // TODO Bust instantly if doing at wrong time? Don't let player do so? + + +001-3-0,92,61,0 script #ArtisThiefWheel_1 NPC_SEWER_WHEEL,{ + // Extract the quest ID from name (or fail trying) + explode(.@ni$, .name$, "_"); + .@id=atoi(.@ni[1]); + + .@q=getq(ThiefQuests_Artis); + .@q2=getq2(ThiefQuests_Artis); + + if (.@q != .@id) { + speech + l("This wheel seems to be connected to the locked gate on the side."), + l("Having to reason to tinker with it, you don't."); + close; + } speech l("You try to move this wheel, but it is stuck. Something seems to be missing."); + + // Switch gearwheel status: 1(looted) 2(unlooted) + switch (.@q2) { + case 1: + // Looted but lost? D: + if (!countitem(Gearwheel)) { + mesc l("If we only had a %s.", getitemlink(Gearwheel)); + close; + } + + mesc l("Should we install the %s and move it?", getitemlink(Gearwheel)), 1; + if (askyesno() == ASK_NO) + break; + + delitem Gearwheel, 1; + setq2 ThiefQuests_Artis, 2; + // FALLTHORUGH + case 2: + mesc l("With the %s in place, it only takes a bit more effort to make it budge.", getitemlink(Gearwheel)); + // TODO: Open gate + break; + default: + } close; OnInit: @@ -53,6 +103,13 @@ OnInit: end; } + + +// We're missing a gate! +001-3-0,56,44,0 duplicate(#ArtisThiefGate_1) #ArtisThiefGate_4 NPC_SEWER_GATE,2,2 +001-3-0,58,43,0 duplicate(#ArtisThiefWheel_1) #ArtisThiefWheel_4 NPC_SEWER_WHEEL + + /////////////////////////// // The controlled warps 001-3-0,90,61,0 script #001-3-0_90_61 NPC_HIDDEN,0,0,{ @@ -68,6 +125,7 @@ OnTouch: end; OnTouch: + // TODO Bust instantly if doing at wrong time? Don't let player do so? // FIXME warp "001-2-40", 56, 40; end; diff --git a/npc/001-3-2/henry.txt b/npc/001-3-2/henry.txt index 724a292c..f67c84b6 100644 --- a/npc/001-3-2/henry.txt +++ b/npc/001-3-2/henry.txt @@ -112,6 +112,7 @@ function reportFirstQuest { // TODO: Reward mesc l("Eh? That can't be right."); + //setq2 ThiefQuests_Artis, false; // Restart wheels } } @@ -185,13 +186,14 @@ OnInit: OnGiantMaggot: .@q=getq(ThiefQuests_Artis); - .@q3=getq3(ThiefQuests_Artis); + .@q2=getq2(ThiefQuests_Artis); + .@max=(.@q == 1 ? true : (.@q == 4 ? true : false)); // To drop, or not to drop...? - if (!.@q3 && (.@q == 1 || .@q == 4)) { + if (!.@q2 && .@max) { if (rand2(10000) < 1400) { getitem Gearwheel, 1; - setq3 ThiefQuests_Artis, 1; + setq2 ThiefQuests_Artis, true; } } diff --git a/npc/functions/lockpicks.txt b/npc/functions/lockpicks.txt index f4ebc012..6a3c55f7 100644 --- a/npc/functions/lockpicks.txt +++ b/npc/functions/lockpicks.txt @@ -130,6 +130,30 @@ function script ArrestedChances { return true; } +// Script helper to actually arrest you. TODO: Arrest anyone +// ArrestPlayer ( time-in-minutes ) +function script ArrestPlayer { + .@t=getarg(0); + + // We can't do anything without a player o.o + if (!playerattached()) + return; + + // You're already jailed so we do nothing and fail silently + if (getstatus(SC_JAILED)) { + return; + } + + // Okay, we can arrest you + // TODO: Arrest player, preferably without GM commands D: + // (would then take an extra argument: map) + atcommand("@jailfor "+.@t+"mn "+strcharinfo(0)); + + // Notification + dispbottom l("You were arrested; Use %s for information about how long you will spend here.", b("@jailtime")); + return; +} + /* // Main script from Moubootaur Legends Vaults // LootableVault(tier, level, variable) diff --git a/npc/functions/quest-debug/035_ThiefQuests_Artis.txt b/npc/functions/quest-debug/035_ThiefQuests_Artis.txt index 42f3a645..83f9fb9c 100644 --- a/npc/functions/quest-debug/035_ThiefQuests_Artis.txt +++ b/npc/functions/quest-debug/035_ThiefQuests_Artis.txt @@ -1,8 +1,8 @@ // Artis Thieves quest debug // Author: // Jesusalva -// Field 2: Internal use (gearwheels - permanent) -// Field 3: Internal use (gerwheels - temporary) +// Field 2: Internal use (gearwheels - odd: collected; even: used) +// Field 3: Internal use (Archive where the file is) function script QuestDebug35 { do @@ -12,6 +12,9 @@ function script QuestDebug35 { mes "ThiefQuests_Artis"; mes "---"; mes l("Quest state: @@", getq(ThiefQuests_Artis)); + .@q2=getq2(ThiefQuests_Artis); + mesf ("Gearwheels: %d (%s)", .@q2/2, (.@q2 % 2 ? "found" : "not found")); + mesf ("Henry's file: %d", getq3(ThiefQuests_Artis)); next; GenericQuestDebug ThiefQuests_Artis, |