From 293be6e1a929e0d9447087160556b84b6b10ca2f Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Thu, 7 Jun 2018 23:49:36 -0300 Subject: Nurse() --- npc/004-1/elanore.txt | 53 +++--------------------------- npc/005-7/nurse.txt | 58 ++------------------------------- npc/012-6/nurse.txt | 84 +---------------------------------------------- npc/functions/nurse.txt | 86 +++++++++++++++++++++++++++++++++++++++++++++++++ npc/scripts.conf | 1 + 5 files changed, 95 insertions(+), 187 deletions(-) create mode 100644 npc/functions/nurse.txt diff --git a/npc/004-1/elanore.txt b/npc/004-1/elanore.txt index 1ca855e52..b6d67e6a9 100644 --- a/npc/004-1/elanore.txt +++ b/npc/004-1/elanore.txt @@ -3,61 +3,18 @@ // Jesusalva 004-1,75,62,0 script Elanore the Healer NPC_FEMALE,{ - - //if (sc_check(SC_POISON)) goto L_CurePoison; - - mesn; - @temp = rand(4); - if(@temp == 1) goto L_Heal2; - if(@temp == 2) goto L_Heal3; - if(@temp == 3) goto L_Heal4; - goto L_Heal1; - -L_Heal1: - mesq l("You don't look too well; let me treat your wounds."); - mes ""; - goto L_Menu; - -L_Heal2: - mesq l("I will make quick work of your wounds."); - mes ""; - goto L_Menu; - -L_Heal3: - mesq l("Need a healing?"); - mes ""; - goto L_Menu; - -L_Heal4: - mesq l("Sometimes you just need to run from battle."); - mes ""; - goto L_Menu; - -L_Menu: - .@price=(MaxHp-Hp)/5; - .@price=.@price+10; - if (BaseLevel <= 15) .@price=(.@price/10); + .@price=Nurse(.name$, 10, 5, 1); mesq l("For you, it'll be @@ GP.", .@price); mes ""; menu - rif(Zeny >= .@price, l("Please heal me!")), L_Heal_L, + rif(Zeny >= .@price, l("Please heal me!")), L_Healing, l("Do you make Lifestones?"), L_Lifestones, l("Another time, maybe."), L_Close; -L_Heal_L: - mes ""; - set Zeny, Zeny - .@price; - sc_end(SC_POISON); - sc_end(SC_SLOWPOISON); - percentheal 100,100; // We can also use "recovery()" - mesn; - @temp = rand(1,4); - if(@temp == 1) mesq l("Here you go!"); - if(@temp == 2) mesq l("Painless, wasn't it?"); - if(@temp == 3) mesq l("You should be more careful."); - if(@temp == 4) mesq l("Much better, right?!"); - goto L_Close; +L_Healing: + Nurse(.name$, 10, 5, 2); + close; L_Lifestones: mes ""; diff --git a/npc/005-7/nurse.txt b/npc/005-7/nurse.txt index 78b42c29f..c6c7c1401 100644 --- a/npc/005-7/nurse.txt +++ b/npc/005-7/nurse.txt @@ -70,62 +70,8 @@ L_Help: close; L_Heal: - mes ""; - mesn; - .@temp = rand(4); - if(.@temp == 1) goto L_Heal2; - if(.@temp == 2) goto L_Heal3; - if(.@temp == 3) goto L_Heal4; - goto L_Heal1; - - -L_Heal1: - mesq l("You don't look too well; let me treat your wounds."); - mes ""; - goto L_Menu; - -L_Heal2: - mesq l("I will make quick work of your wounds."); - mes ""; - goto L_Menu; - -L_Heal3: - mesq l("Need a healing?"); - mes ""; - goto L_Menu; - -L_Heal4: - mesq l("Sometimes you just need to run from battle."); - mes ""; - goto L_Menu; - -L_Menu: - .@price=(MaxHp-Hp)/5; - .@price=.@price+10; - if (BaseLevel <= 15) .@price=(.@price/10); - else if (BaseLevel <= 20) .@price=(.@price/5); - else .@price=(.@price/2); - mesq l("For you, it'll be @@ GP.", .@price); - mes ""; - menu - rif(Zeny >= .@price, l("Please heal me!")), L_Heal_L, - l("Another time, maybe."), L_Close; - - -L_Heal_L: - mes ""; - set Zeny, Zeny - .@price; - sc_end(SC_POISON); - sc_end(SC_SLOWPOISON); - percentheal 100,100; // We can also use "recovery()" - mesn; - @temp = rand(1,4); - if(@temp == 1) mesq l("Here you go!"); - if(@temp == 2) mesq l("Painless, wasn't it?"); - if(@temp == 3) mesq l("You should be more careful."); - if(@temp == 4) mesq l("Much better, right?!"); - goto L_Close; - + Nurse(.name$, 10, 5); + close; L_Close: close; diff --git a/npc/012-6/nurse.txt b/npc/012-6/nurse.txt index a6d8b4616..689e40479 100644 --- a/npc/012-6/nurse.txt +++ b/npc/012-6/nurse.txt @@ -4,89 +4,7 @@ // Crazyfefe 012-6,56,67,6 script Hurnscald's Nurse NPC_FEMALE,{ - - //if (sc_check(SC_POISON)) goto L_CurePoison; - if (Hp < (MaxHp/100*90)) goto L_Heal; - - mesn; - mesq l("Ah! Welcome. I can cure you, if you need."); - - do - { - select - rif(Hp < MaxHp, l("Please heal me!")), - l("I'm fine, no worries..."); - - switch (@menu) { - case 1: - goto L_Menu; - break; - case 2: - goto L_Close; - break; - } - } while (@menu != 2); - close; - -L_Heal: - mes ""; - mesn; - .@temp = rand(4); - if(.@temp == 1) goto L_Heal2; - if(.@temp == 2) goto L_Heal3; - if(.@temp == 3) goto L_Heal4; - goto L_Heal1; - - -L_Heal1: - mesq l("You don't look too well; let me treat your wounds."); - mes ""; - goto L_Menu; - -L_Heal2: - mesq l("I will make quick work of your wounds."); - mes ""; - goto L_Menu; - -L_Heal3: - mesq l("Need a healing?"); - mes ""; - goto L_Menu; - -L_Heal4: - mesq l("Sometimes you just need to run from battle."); - mes ""; - goto L_Menu; - -L_Menu: - .@price=(MaxHp-Hp)/6; - .@price=.@price+10; - if (BaseLevel <= 15) .@price=(.@price/10); - else if (BaseLevel <= 20) .@price=(.@price/5); - else .@price=(.@price/2); - mesq l("For you, it'll be @@ GP.", .@price); - mes ""; - menu - rif(Zeny >= .@price, l("Please heal me!")), L_Heal_L, - l("Another time, maybe."), L_Close; - - -L_Heal_L: - mes ""; - set Zeny, Zeny - .@price; - sc_end(SC_POISON); - sc_end(SC_SLOWPOISON); - percentheal 100,100; // We can also use "recovery()" - mesn; - @temp = rand(1,4); - if(@temp == 1) mesq l("Here you go!"); - if(@temp == 2) mesq l("Painless, wasn't it?"); - if(@temp == 3) mesq l("You should be more careful."); - if(@temp == 4) mesq l("Much better, right?!"); - goto L_Close; - - -L_Close: + Nurse(.name$, 10, 6); close; OnInit: diff --git a/npc/functions/nurse.txt b/npc/functions/nurse.txt new file mode 100644 index 000000000..4f95d68b4 --- /dev/null +++ b/npc/functions/nurse.txt @@ -0,0 +1,86 @@ +// TMW-2 Script +// Author: +// Jesusalva +// Description: +// Nurse for all hurt players + +// Name, Base Price, Price Multiplier +// getarg(3) switches functions: +// 0 - everything (default) +// 1 - Only healing dialog (returns price) +// 2 - Only core healing +function script Nurse { + // Handle redirects + .@d=getarg(3, 0); + if(.@d == 0) + goto L_HealMenu; + if(.@d == 1) + goto L_HealMenu; + if(.@d == 2) + goto L_Heal_L; + mes col("Script error, bad Nurse value. Please report.", 1); + close; + +L_HealMenu: + mes ""; + mesn getarg(0); + .@temp = rand(4); + if(.@temp == 1) goto L_Heal2; + if(.@temp == 2) goto L_Heal3; + if(.@temp == 3) goto L_Heal4; + goto L_Heal1; + + +L_Heal1: + mesq l("You don't look too well; let me treat your wounds."); + mes ""; + goto L_Menu; + +L_Heal2: + mesq l("I will make quick work of your wounds."); + mes ""; + goto L_Menu; + +L_Heal3: + mesq l("Need a healing?"); + mes ""; + goto L_Menu; + +L_Heal4: + mesq l("Sometimes you just need to run from battle."); + mes ""; + goto L_Menu; + +L_Menu: + .@price=(MaxHp-Hp)/getarg(1,5); + .@price=.@price+getarg(2, 10); + if (BaseLevel <= 15) .@price=(.@price/10); + else if (BaseLevel <= 20) .@price=(.@price/5); + else .@price=(.@price/2); + + // Skip menu flag + if(.@d == 1) + return .@price; + + mesq l("For you, it'll be @@ GP.", .@price); + mes ""; + menu + rif(Zeny >= .@price, l("Please heal me!")), L_Heal_L, + l("Another time, maybe."), L_Close; + + +L_Heal_L: + mes ""; + set Zeny, Zeny - .@price; + sc_end(SC_POISON); + sc_end(SC_SLOWPOISON); + percentheal 100,100; // We can also use "recovery()" + mesn getarg(0); + @temp = rand(1,4); + if(@temp == 1) mesq l("Here you go!"); + if(@temp == 2) mesq l("Painless, wasn't it?"); + if(@temp == 3) mesq l("You should be more careful."); + if(@temp == 4) mesq l("Much better, right?!"); + close; + +} diff --git a/npc/scripts.conf b/npc/scripts.conf index dacf8029d..16aaad71c 100644 --- a/npc/scripts.conf +++ b/npc/scripts.conf @@ -41,6 +41,7 @@ "npc/functions/news.txt", "npc/functions/npcmove.txt", "npc/functions/npcmovegraph.txt", +"npc/functions/nurse.txt", "npc/functions/questgen.txt", "npc/functions/riddle.txt", "npc/functions/savepoint.txt", -- cgit v1.2.3-60-g2f50