summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--npc/017-3/vault.txt26
-rw-r--r--npc/018-2-4/vault.txt26
-rw-r--r--npc/functions/lockpicks.txt35
3 files changed, 37 insertions, 50 deletions
diff --git a/npc/017-3/vault.txt b/npc/017-3/vault.txt
index 35434eae9..090900bc0 100644
--- a/npc/017-3/vault.txt
+++ b/npc/017-3/vault.txt
@@ -5,31 +5,7 @@
// Based on BenB idea.
017-3,80,39,0 script Vault NPC_NO_SPRITE,{
- mesn;
- mesq l("There's a shiny safe here. How much money is inside? Nobody is looking at you, great!");
- // 2*3 = 6 possibilities, 5 attempts
- if (LockPicking(2, 3)) {
- Zeny=Zeny+$VAULT_01738039;
- $VAULT_01738039=40;
- mesn;
- mesq l("Booty!");
- } else {
- mesn;
- .@inch=(Zeny/100);
- Zeny-=.@inch;
- $VAULT_01738039+=.@inch;
- if (ArrestedChances()) {
- mesc l("Arrested!");
- atcommand("@jailfor 5mn "+strcharinfo(0));
- } else {
- if (is_night())
- .@p$=l("The darkness of night gives you cover.");
- else
- .@p$=l("Your agile legs and sheer luck allows you to outrun the cops.");
- mesc l("You run as far as you could. %s", .@p$);
- warp "000-1", 22, 22;
- }
- }
+ LootableVault(1, 3, "01738039");
close;
OnInit:
diff --git a/npc/018-2-4/vault.txt b/npc/018-2-4/vault.txt
index 043504829..9f33ea64c 100644
--- a/npc/018-2-4/vault.txt
+++ b/npc/018-2-4/vault.txt
@@ -5,31 +5,7 @@
// Based on BenB idea.
018-2-4,23,24,0 script Vault#01824a NPC_NO_SPRITE,{
- mesn;
- mesq l("There's a shiny safe here. How much money is inside? Nobody is looking at you, great!");
- // 3*3 = 9 possibilities, 6~8 attempts
- if (LockPicking(3, 3)) {
- Zeny=Zeny+$VAULT_01824;
- $VAULT_01824=60;
- mesn;
- mesq l("Booty!");
- } else {
- mesn;
- .@inch=(Zeny/100);
- Zeny-=.@inch;
- $VAULT_01824+=.@inch;
- if (ArrestedChances()) {
- mesc l("Arrested!");
- atcommand("@jailfor 5mn "+strcharinfo(0));
- } else {
- if (is_night())
- .@p$=l("The darkness of night gives you cover.");
- else
- .@p$=l("Your agile legs and sheer luck allows you to outrun the cops.");
- mesc l("You run as far as you could. %s", .@p$);
- warp "000-1", 22, 22;
- }
- }
+ LootableVault(2, 3, "01824");
close;
OnInit:
diff --git a/npc/functions/lockpicks.txt b/npc/functions/lockpicks.txt
index 9e7ef4981..33ee1ea4f 100644
--- a/npc/functions/lockpicks.txt
+++ b/npc/functions/lockpicks.txt
@@ -127,3 +127,38 @@ function script ArrestedChances {
return true;
}
+// Main script
+// LootableVault(tier, level, variable)
+function script LootableVault {
+ .@tier=getarg(0)+1;
+ .@level=getarg(1);
+ .@var$=getarg(2);
+ mesn;
+ mesq l("There's a shiny safe here. How much money is inside? Nobody is looking at you, great!");
+ // 2*3 = 6 possibilities, 5 attempts
+ if (LockPicking(.@tier, .@level)) {
+ Zeny=Zeny+getd("$VAULT_"+.@var$);
+ setd("$VAULT_"+.@var$, 40);
+ mesn;
+ mesq l("Booty!");
+ } else {
+ mesn;
+ .@inch=(Zeny/100);
+ Zeny-=.@inch;
+ setd("$VAULT_"+.@var$, getd("$VAULT_"+.@var$)+.@inch);
+ if (ArrestedChances()) {
+ mesc l("Arrested!");
+ atcommand("@jailfor 5mn "+strcharinfo(0));
+ } else {
+ if (is_night())
+ .@p$=l("The darkness of night gives you cover.");
+ else
+ .@p$=l("Your agile legs and sheer luck allows you to outrun the cops.");
+ mesc l("You run as far as you could. %s", .@p$);
+ warp "000-1", 22, 22;
+ }
+ }
+ return;
+}
+
+