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/012-5/nicholas.txt | 2 +- npc/025-1/salohcin.txt | 31 +++++++++++++++++++++++++++++++ npc/craft/tweak.txt | 39 +++++++++++++++++++++++++++++---------- 3 files changed, 61 insertions(+), 11 deletions(-) create mode 100644 npc/025-1/salohcin.txt diff --git a/npc/012-5/nicholas.txt b/npc/012-5/nicholas.txt index a5455dee4..d92c7724e 100644 --- a/npc/012-5/nicholas.txt +++ b/npc/012-5/nicholas.txt @@ -2,7 +2,7 @@ // Author: // Jesusalva // Description: -// Nicholas is Hurnscald's blakcsmith. He forges some stuff, and sell other stuff. +// Nicholas is Hurnscald's blacksmith. He forges some stuff, and sell other stuff. // Perhaps he should not forge armor? Remember he cannot forge EVERYTHING... // // PS. diff --git a/npc/025-1/salohcin.txt b/npc/025-1/salohcin.txt new file mode 100644 index 000000000..2a331aaf4 --- /dev/null +++ b/npc/025-1/salohcin.txt @@ -0,0 +1,31 @@ +// TMW-2 Script +// Author: +// Jesusalva +// Description: +// Nicholas the Blacksmith, spelled backwards + +025-1,108,67,0 script Salohnic NPC_NICHOLAS,{ + mesn; + mesq l("Hello there, I am %s and I change item options, can I help you today?", .name$); + mes ""; + mesn; + mesq l("You'll be charged even if you fail, be warned. You can re-roll the same item once, free of charge, but it may break and there will be no refunds!"); + next; + if (!SmithTweakSystem(60000, true)) { + mes ""; + mesn; + mesq l("You can always try again another day!"); + } + close; + + + + + + + +OnInit: + .sex = G_MALE; + .distance = 5; + end; +} 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-70-g09d2