From d9dc1eb686e50845300cf42484fe0b1ee0b368e3 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Wed, 18 Sep 2019 11:06:21 -0300 Subject: Rewrite lockpicks minigame failsafe system. Max Fail is now based on Thief Rank + Number of Pins. You may be informed about running out of time (need rework). NOTE: Max Fail is capped, it will NEVER give you 100% success rate! --- npc/functions/lockpicks.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'npc') diff --git a/npc/functions/lockpicks.txt b/npc/functions/lockpicks.txt index c8271ba3a..3394dc7f8 100644 --- a/npc/functions/lockpicks.txt +++ b/npc/functions/lockpicks.txt @@ -51,6 +51,7 @@ function script LockPicking { // Setup your attempt delitem Lockpicks, 1; @pos=0; + @chance=min(.@d*.@m-1, THIEF_RANK+.@d); mesc l("You insert the hook pick inside the lock, and, without applying any tension, you discover there are only @@ pins to set.", .@d); // You have as many attempts as pins and appliable strenghts. @@ -59,7 +60,7 @@ function script LockPicking { // It's not multiplied, so 3 pins with 3 positions: 6 chances, 9 possibilities. // There's no penalty, but the attempt is counted working or not! // Remember if you fail, all previous pins will be cleared (@pos) - for (.@i=0; .@i < (.@d+.@m+THIEF_RANK) ; .@i++) { + do { mesc l("You are trying to open the @@th pin. What will to do?", @pos+1); menuint @@ -86,11 +87,17 @@ function script LockPicking { } else { mesc l("This didn't work. All pins are now unset!"); @pos=0; + @chance-=1; // We don't need to clear console, each successful attempt IS counted. // Therefore, unsetting 3 pins means you must do 3 new attempts!! // The biggie is that you're running against time, here!!! + if (@chance < THIEF_RANK) + mesc l("Your thief instincts suggest you to hurry."), 1; } + if (@chance <= 0) + break; + if (@pos >= .@d) { // 20% chance to save the lockpick if (rand2(1,5) == 3) @@ -102,8 +109,9 @@ function script LockPicking { THIEF_EXP += .@d*.@m-THIEF_RANK; return 1; } - } + } while (true); + // Failed THIEF_EXP += 1; return 0; } -- cgit v1.2.3-60-g2f50