From 2e92487a835c2fdf0d499abdd31f2e74b342db02 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Fri, 8 Jan 2021 16:05:54 -0300 Subject: Salohcin initial version --- npc/craft/tweak.txt | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'npc/craft') diff --git a/npc/craft/tweak.txt b/npc/craft/tweak.txt index 56f0874e8..9419e9462 100644 --- a/npc/craft/tweak.txt +++ b/npc/craft/tweak.txt @@ -25,10 +25,11 @@ function script SmithTweakReset { return; } -// Usage: SmithTweakSystem ({price}) +// Usage: SmithTweakSystem ({price=600, retry=False}) // Returns true on success, false on failure function script SmithTweakSystem { .@price=getarg(0, 600); + .@retry=getarg(1, false); // Adjust price .@price=POL_AdjustPrice(.@price); @@ -95,13 +96,31 @@ function script SmithTweakSystem { POL_PlayerMoney(.@price); SMITH_TWEAKS+=1; - // Check if you fail - if (!csys_Check(.@id)) { - mesc l("YOU FAIL! It is a simple item now."), 1; - return false; - } - - csys_Apply(.@id); - mesc l("SUCCESS! Congratulations, the item was improved!"), 3; - return true; + // Apply the bonuses. This will only loop if `continue;` is cast. + // `continue` will only be cast if .@retry is set + do + { + // Check if you fail + if (!csys_Check(.@id)) { + mesc l("YOU FAIL! It is a simple item now."), 1; + if (.@retry) { + .@retry=false; + mesc l("...Automatically retrying..."); + continue; + } + return false; + } + + csys_Apply(.@id); + mesc l("SUCCESS! Congratulations, the item was improved!"), 3; + if (.@retry) { + next; + mesc l("Do you want to re-roll?"), 1; + if (askyesno() == ASK_YES) { + .@retry=false; + continue; + } + } + return true; + } while (true); } -- cgit v1.2.3-60-g2f50