From 79eb59f7569fb5aece07046e4d27835de47aaeb9 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Mon, 20 Jun 2022 12:24:58 -0300 Subject: Copper Key can now be used in Saulc's Palace. Gives from 1.5% to 3% bonus compared to normal treasure chest --- npc/001-3/ctrl.txt | 10 ++++++++++ npc/functions/treasure.txt | 9 +++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/npc/001-3/ctrl.txt b/npc/001-3/ctrl.txt index cbe473276..99c6d1ff8 100644 --- a/npc/001-3/ctrl.txt +++ b/npc/001-3/ctrl.txt @@ -11,3 +11,13 @@ OnTouch: end; } +001-3,103,69,0 script Copper Chest#Saulc NPC_CHEST,{ + // Like common chest but up to +3% bonus + TreasureBox(rand2(150, 300), CopperKey); + specialeffect(.dir == 0 ? 24 : 25, AREA, getnpcid()); // closed ? opening : closing + close; +OnInit: + .distance=2; + end; +} + diff --git a/npc/functions/treasure.txt b/npc/functions/treasure.txt index 086978178..d55caedc8 100644 --- a/npc/functions/treasure.txt +++ b/npc/functions/treasure.txt @@ -4,7 +4,7 @@ // Description: // Random Treasure Box Utils -// TreasureBox ( { bonus chance } ) +// TreasureBox ( { bonus chance{, TreasureKey} } ) function script TreasureBox { .@id=getnpcid(); if (RNGTREASURE_DATE[.@id] > gettimetick(2)) { @@ -12,15 +12,16 @@ function script TreasureBox { close; } + .@key=getarg(1, TreasureKey); mesc l("Open the chest?"); - mesc l("Cost: 1 @@", getitemlink(TreasureKey)), 1; - if (!countitem(TreasureKey)) + mesc l("Cost: 1 @@", getitemlink(.@key)), 1; + if (!countitem(.@key)) close; next; if (askyesno() == ASK_NO) close; - delitem TreasureKey, 1; + delitem .@key, 1; mesc l("You open the chest!"); RNGTREASURE_DATE[.@id]=gettimetick(2)+CHEST_WAITTIME; // Minimum 15 minutes -- cgit v1.2.3-60-g2f50