summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--world/map/npc/001-1/stat_reset.txt2
-rw-r--r--world/map/npc/002-1/traveler.txt2
-rw-r--r--world/map/npc/002-3/traveler.txt2
-rw-r--r--world/map/npc/004-5/chest.txt7
-rw-r--r--world/map/npc/006-1/miriam.txt4
-rw-r--r--world/map/npc/006-1/pachua.txt3
-rw-r--r--world/map/npc/006-1/traveler.txt2
-rw-r--r--world/map/npc/008-1/diryn.txt2
-rw-r--r--world/map/npc/009-2/wyara.txt2
-rw-r--r--world/map/npc/012-3/traveler.txt2
-rw-r--r--world/map/npc/013-1/traveler.txt2
-rw-r--r--world/map/npc/020-1/traveler.txt2
-rw-r--r--world/map/npc/027-1/traveler.txt2
-rw-r--r--world/map/npc/029-1/aahna.txt8
-rw-r--r--world/map/npc/029-1/hasan.txt6
-rw-r--r--world/map/npc/029-1/kaan.txt7
-rw-r--r--world/map/npc/029-1/liana.txt7
-rw-r--r--world/map/npc/029-1/traveler.txt2
-rw-r--r--world/map/npc/029-1/valon.txt3
-rw-r--r--world/map/npc/029-1/zegas.txt10
-rw-r--r--world/map/npc/029-2/barrels.txt8
-rw-r--r--world/map/npc/029-2/barrels_config.txt13
-rw-r--r--world/map/npc/029-2/cynric.txt1
-rw-r--r--world/map/npc/029-2/morgan.txt4
-rw-r--r--world/map/npc/029-2/sorfina.txt7
-rw-r--r--world/map/npc/029-2/stat_reset.txt3
-rw-r--r--world/map/npc/029-2/tanisha.txt3
-rw-r--r--world/map/npc/033-1/traveler.txt2
-rw-r--r--world/map/npc/048-2/traveler.txt2
-rw-r--r--world/map/npc/055-1/traveler.txt2
-rw-r--r--world/map/npc/functions/banker.txt2
-rw-r--r--world/map/npc/functions/default_npc_checks.txt24
-rw-r--r--world/map/npc/functions/inn.txt12
-rw-r--r--world/map/npc/functions/stat_reset.txt8
-rw-r--r--world/map/npc/functions/travelers.txt22
35 files changed, 74 insertions, 116 deletions
diff --git a/world/map/npc/001-1/stat_reset.txt b/world/map/npc/001-1/stat_reset.txt
index 1ad2bc4e..e8c61ca3 100644
--- a/world/map/npc/001-1/stat_reset.txt
+++ b/world/map/npc/001-1/stat_reset.txt
@@ -2,7 +2,7 @@
001-1,117,105,0|script|Malivox|103
{
- set @NpcName$, "Malivox";
+ set @npcname$, "Malivox";
callfunc "StatReset";
close;
}
diff --git a/world/map/npc/002-1/traveler.txt b/world/map/npc/002-1/traveler.txt
index 0645cce2..975786ae 100644
--- a/world/map/npc/002-1/traveler.txt
+++ b/world/map/npc/002-1/traveler.txt
@@ -4,7 +4,7 @@
002-1,60,41,0|script|Nina the Traveler|103
{
- set @NpcName$, "Nina";
+ set @npcname$, "Nina";
set @NpcTravelBit, $@tulimshar_bit;
callfunc "Traveler";
end;
diff --git a/world/map/npc/002-3/traveler.txt b/world/map/npc/002-3/traveler.txt
index a1fd4f6f..48175be8 100644
--- a/world/map/npc/002-3/traveler.txt
+++ b/world/map/npc/002-3/traveler.txt
@@ -4,7 +4,7 @@
002-3,25,28,0|script|Jena the Traveler|103
{
- set @NpcName$, "Jena";
+ set @npcname$, "Jena";
set @NpcTravelBit, $@tul_mine_bit;
callfunc "Traveler";
end;
diff --git a/world/map/npc/004-5/chest.txt b/world/map/npc/004-5/chest.txt
index a54739fc..2b815aa3 100644
--- a/world/map/npc/004-5/chest.txt
+++ b/world/map/npc/004-5/chest.txt
@@ -1,8 +1,7 @@
004-5,89,67,0|script|Old Chest#crastur|111
{
- setarray @npc_loc, 89, 67, 1;
+ set @npc_distance, 1;
callfunc "PCtoNPCRange";
- if(@npc_check == 1) goto L_Closer;
set @spants_state, ((QUEST_WG_state & NIBBLE_2_MASK) >> NIBBLE_2_SHIFT);
if(@spants_state > 5) goto L_Looted;
if(@spants_state != 5) goto L_Unknown;
@@ -22,10 +21,6 @@ L_Unknown:
mes "You have no idea how to open this chest.";
goto L_Close;
-L_Closer:
- mes "You need to move closer to open the chest.";
- goto L_Close;
-
L_Close:
close;
}
diff --git a/world/map/npc/006-1/miriam.txt b/world/map/npc/006-1/miriam.txt
index 7ebf41c6..ca317181 100644
--- a/world/map/npc/006-1/miriam.txt
+++ b/world/map/npc/006-1/miriam.txt
@@ -20,10 +20,8 @@
006-1,115,111,0|script|Miriam|175
{
- setarray @npc_loc, 115, 111, 2;
+ set @npc_distance, 2;
callfunc "PCtoNPCRange";
- if (@npc_check)
- goto L_Close;
if (getskilllv(SKILL_SPEED)) goto L_fast;
if (getequipid(equip_torso) < 0) goto L_naked;
diff --git a/world/map/npc/006-1/pachua.txt b/world/map/npc/006-1/pachua.txt
index 7b39dce7..905ffcb4 100644
--- a/world/map/npc/006-1/pachua.txt
+++ b/world/map/npc/006-1/pachua.txt
@@ -1,9 +1,6 @@
006-1,24,113,0|script|Pachua|143
{
- setarray @npc_loc, 24, 113, 4;
callfunc "PCtoNPCRange";
- if (@npc_check)
- goto L_Close;
set @halloween_npc_id, $@halloween_npc_pachua;
callfunc "TrickOrTreat";
diff --git a/world/map/npc/006-1/traveler.txt b/world/map/npc/006-1/traveler.txt
index f87cf083..7c84e040 100644
--- a/world/map/npc/006-1/traveler.txt
+++ b/world/map/npc/006-1/traveler.txt
@@ -4,7 +4,7 @@
006-1,25,95,0|script|Rhutan the Traveler|103
{
- set @NpcName$, "Rhutan";
+ set @npcname$, "Rhutan";
set @NpcTravelBit, $@pachua_bit;
callfunc "Traveler";
end;
diff --git a/world/map/npc/008-1/diryn.txt b/world/map/npc/008-1/diryn.txt
index dae18c13..6570f1d8 100644
--- a/world/map/npc/008-1/diryn.txt
+++ b/world/map/npc/008-1/diryn.txt
@@ -4,7 +4,7 @@
008-1,81,82,0|script|Diryn the Traveler|103
{
- set @NpcName$, "Diryn";
+ set @npcname$, "Diryn";
set @NpcTravelBit, $@hurnscald_bit;
callfunc "Traveler";
end;
diff --git a/world/map/npc/009-2/wyara.txt b/world/map/npc/009-2/wyara.txt
index 3b14a178..17f6bc61 100644
--- a/world/map/npc/009-2/wyara.txt
+++ b/world/map/npc/009-2/wyara.txt
@@ -63,7 +63,7 @@ L_Shop:
close;
L_StatReset:
- set @NpcName$, "Wyara";
+ set @npcname$, "Wyara";
callfunc "StatReset";
goto L_Close;
diff --git a/world/map/npc/012-3/traveler.txt b/world/map/npc/012-3/traveler.txt
index aa173080..b3c158ea 100644
--- a/world/map/npc/012-3/traveler.txt
+++ b/world/map/npc/012-3/traveler.txt
@@ -4,7 +4,7 @@
012-3,439,62,0|script|Meridith the Traveler|103
{
- set @NpcName$, "Meridith";
+ set @npcname$, "Meridith";
set @NpcTravelBit, $@terranite_cave_bit;
callfunc "Traveler";
end;
diff --git a/world/map/npc/013-1/traveler.txt b/world/map/npc/013-1/traveler.txt
index efa6c53a..7439b8d8 100644
--- a/world/map/npc/013-1/traveler.txt
+++ b/world/map/npc/013-1/traveler.txt
@@ -1,6 +1,6 @@
013-1,120,90,0|script|Faris the Traveler|103
{
- set @NpcName$, "Faris";
+ set @npcname$, "Faris";
set @NpcTravelBit, $@magic_house_bit;
callfunc "Traveler";
end;
diff --git a/world/map/npc/020-1/traveler.txt b/world/map/npc/020-1/traveler.txt
index d873a57f..421ed0e7 100644
--- a/world/map/npc/020-1/traveler.txt
+++ b/world/map/npc/020-1/traveler.txt
@@ -1,6 +1,6 @@
020-1,57,123,0|script|Knox the Traveler|103
{
- set @NpcName$, "Knox";
+ set @npcname$, "Knox";
set @NpcTravelBit, $@nivalis_bit;
callfunc "Traveler";
end;
diff --git a/world/map/npc/027-1/traveler.txt b/world/map/npc/027-1/traveler.txt
index ca8d8f47..0c8bb753 100644
--- a/world/map/npc/027-1/traveler.txt
+++ b/world/map/npc/027-1/traveler.txt
@@ -4,7 +4,7 @@
027-1,83,84,0|script|Styx the Traveler|103
{
- set @NpcName$, "Styx";
+ set @npcname$, "Styx";
set @NpcTravelBit, $@graveyard_bit;
callfunc "Traveler";
end;
diff --git a/world/map/npc/029-1/aahna.txt b/world/map/npc/029-1/aahna.txt
index e9da0d20..92f7ff6b 100644
--- a/world/map/npc/029-1/aahna.txt
+++ b/world/map/npc/029-1/aahna.txt
@@ -3,10 +3,8 @@
// Npc
029-1,71,52,0|script|Aahna|404
{
- setarray @npc_loc, 71, 52, 3;
+ set @npc_distance, 3;
callfunc "PCtoNPCRange";
- if (@npc_check)
- goto L_Range;
goto L_Meet;
L_Meet:
@@ -14,10 +12,6 @@ L_Meet:
mes "\"Hello, What a lovely day for a stroll.\"";
goto L_Close;
-L_Range:
- message strcharinfo(0), "Whats that? Come closer I can't hear you.";
- goto L_Close;
-
L_Close:
close;
}
diff --git a/world/map/npc/029-1/hasan.txt b/world/map/npc/029-1/hasan.txt
index 99e5ea1e..8d35da8b 100644
--- a/world/map/npc/029-1/hasan.txt
+++ b/world/map/npc/029-1/hasan.txt
@@ -8,10 +8,7 @@
029-1,35,33,0|script|Scared Man|160
{
- setarray @npc_loc, 35, 33, 4;
callfunc "PCtoNPCRange";
- if (@npc_check)
- goto L_End;
if (QL_BEGIN >= 13)
goto L_TutDone;
message strcharinfo(0), "He looks too afraid to say anything.";
@@ -26,10 +23,7 @@ L_End:
}
029-1,33,33,0|script|Hasan|189,3,3
{
- setarray @npc_loc, 33, 33, 4;
callfunc "PCtoNPCRange";
- if (@npc_check)
- goto L_Close;
goto L_Main;
L_Main:
diff --git a/world/map/npc/029-1/kaan.txt b/world/map/npc/029-1/kaan.txt
index 57ab1d4c..297849fa 100644
--- a/world/map/npc/029-1/kaan.txt
+++ b/world/map/npc/029-1/kaan.txt
@@ -3,10 +3,7 @@
029-1,46,95,0|script|Kaan|160
{
- setarray @npc_loc, 46, 97, 4;
callfunc "PCtoNPCRange";
- if (@npc_check)
- goto L_OutOfRange;
set @kaan_talked, (STARTAREA & $@SpokeToKaan);
if (!(@kaan_talked)) goto L_Tanisha;
@@ -17,10 +14,6 @@
if (QL_BEGIN == 9) goto L_Hasan;
goto L_Out;
-L_OutOfRange:
- message strcharinfo(0), "Come closer!";
- goto L_Close;
-
L_Tanisha:
set STARTAREA, STARTAREA | $@SpokeToKaan;
mes "[Young Man]";
diff --git a/world/map/npc/029-1/liana.txt b/world/map/npc/029-1/liana.txt
index 4e4a78a6..0aa37749 100644
--- a/world/map/npc/029-1/liana.txt
+++ b/world/map/npc/029-1/liana.txt
@@ -2,10 +2,7 @@
029-1,62,96,0|script|Liana|205
{
- setarray @npc_loc, 62, 96, 4;
callfunc "PCtoNPCRange";
- if (@npc_check)
- goto L_End;
goto L_Talk;
L_Talk:
@@ -38,10 +35,6 @@ L_Next:
callfunc "SetTutorialMask";
goto L_Close;
-L_End:
- mes "You'll have to move closer";
- goto L_Close;
-
L_Close:
close;
}
diff --git a/world/map/npc/029-1/traveler.txt b/world/map/npc/029-1/traveler.txt
index 1d7f354a..befa8eef 100644
--- a/world/map/npc/029-1/traveler.txt
+++ b/world/map/npc/029-1/traveler.txt
@@ -4,7 +4,7 @@
029-1,69,68,0|script|Knitra the Traveler|103
{
- set @NpcName$, "Knitra";
+ set @npcname$, "Knitra";
set @NpcTravelBit, $@candor_bit;
callfunc "Traveler";
end;
diff --git a/world/map/npc/029-1/valon.txt b/world/map/npc/029-1/valon.txt
index 89398635..f4034ec9 100644
--- a/world/map/npc/029-1/valon.txt
+++ b/world/map/npc/029-1/valon.txt
@@ -64,10 +64,7 @@ OnInit:
}
029-1,72,86,0|script|Valon|156
{
- setarray @npc_loc, 72, 86, 4;
callfunc "PCtoNPCRange";
- if (@npc_check)
- goto L_Close;
callfunc "ValonCount";
if (QL_VALON >= 6)
goto L_QuestComplete;
diff --git a/world/map/npc/029-1/zegas.txt b/world/map/npc/029-1/zegas.txt
index 49b9a5c5..a350447d 100644
--- a/world/map/npc/029-1/zegas.txt
+++ b/world/map/npc/029-1/zegas.txt
@@ -3,10 +3,8 @@
// Npc
029-1,45,85,0|script|Zegas|165
{
- setarray @npc_loc, 45, 85, 2;
+ set @npc_distance, 2;
callfunc "PCtoNPCRange";
- if (@npc_check)
- goto L_Range;
if (QL_ZEGAS == 1)
goto L_Find;
@@ -18,10 +16,6 @@
goto L_Thanks;
goto L_Meet;
-L_Range:
- message strcharinfo(0), "Whats that? Come closer I can't hear you.";
- goto L_Close;
-
L_Meet:
mes "[Zegas]";
mes "\"Hey do you have a second?\"";
@@ -59,7 +53,7 @@ L_Looking:
L_QuestEnd:
mes "[Zegas]";
mes "\"From the smell I can see you found the bug bomb!\"";
- mes "\"Thanks once again, I know it's not much but here is 50 GP for your troubles.\"";
+ mes "\"Thanks once again, I know it's not much but here is 50 GP for your troubles.\"";
getexp 50, 0;
set Zeny, (Zeny + 50);
set QL_ZEGAS, 4;
diff --git a/world/map/npc/029-2/barrels.txt b/world/map/npc/029-2/barrels.txt
index 4ff3e6de..39bd0ad3 100644
--- a/world/map/npc/029-2/barrels.txt
+++ b/world/map/npc/029-2/barrels.txt
@@ -2,7 +2,6 @@
// Author: Wushin
029-2,23,86,0|script|Barrel#0|400
{
- setarray @npc_loc, 23, 86, 2;
set @barrel, 0;
callfunc "CheckBarrel";
end;
@@ -14,49 +13,42 @@ OnMaggotDeath:
}
029-2,28,86,0|script|Barrel#1|400
{
- setarray @npc_loc, 28, 86, 2;
set @barrel, 1;
callfunc "CheckBarrel";
end;
}
029-2,31,91,0|script|Barrel#2|400
{
- setarray @npc_loc, 31, 91, 2;
set @barrel, 2;
callfunc "CheckBarrel";
end;
}
029-2,36,85,0|script|Barrel#3|400
{
- setarray @npc_loc, 36, 85, 2;
set @barrel, 3;
callfunc "CheckBarrel";
end;
}
029-2,40,89,0|script|Barrel#4|400
{
- setarray @npc_loc, 40, 89, 2;
set @barrel, 4;
callfunc "CheckBarrel";
end;
}
029-2,38,91,0|script|Barrel#5|400
{
- setarray @npc_loc, 38, 91, 2;
set @barrel, 5;
callfunc "CheckBarrel";
end;
}
029-2,29,92,0|script|Barrel#6|400
{
- setarray @npc_loc, 29, 92, 2;
set @barrel, 6;
callfunc "CheckBarrel";
end;
}
029-2,24,91,0|script|Barrel#7|400
{
- setarray @npc_loc, 24, 91, 2;
set @barrel, 7;
callfunc "CheckBarrel";
end;
diff --git a/world/map/npc/029-2/barrels_config.txt b/world/map/npc/029-2/barrels_config.txt
index 1b83d25b..1d356a08 100644
--- a/world/map/npc/029-2/barrels_config.txt
+++ b/world/map/npc/029-2/barrels_config.txt
@@ -20,7 +20,7 @@ function|script|CountBarrels
set @count_tmp, 0;
goto L_Loop;
-L_Loop:
+L_Loop:
if (STARTAREA & $@BarrelBits[@barrel_count])
goto L_AddOne;
goto L_LoopAgain;
@@ -40,9 +40,8 @@ L_BarrelTally:
}
function|script|CheckBarrel
{
+ set @npc_distance, 2;
callfunc "PCtoNPCRange";
- if (@npc_check)
- goto L_Range;
if (!(QL_ZEGAS == 2))
goto L_NoI;
if (STARTAREA & $@BarrelBits[@barrel])
@@ -58,10 +57,6 @@ function|script|CheckBarrel
goto L_Spawn;
goto L_Reward;
-L_Range:
- message strcharinfo(0), "You'll need to get closer.";
- goto L_Return;
-
L_NoI:
message strcharinfo(0), "Nothing interesting here.";
goto L_Return;
@@ -79,7 +74,9 @@ L_QuestReward:
L_Spawn:
message strcharinfo(0), "Uck, More Maggots!";
- areamonster getmap() + "", @npc_loc[0], @npc_loc[1], (@npc_loc[0] + 1), (@npc_loc[1] + 1), $@BarrelSpawnName$, $@BarrelSpawnId, $@BarrelSpawnCnt, "Barrel#0::OnMaggotDeath";
+ setarray @npc_loc, getnpcx(), getnpcy();
+ areamonster getmap(), @npc_loc[0], @npc_loc[1], (@npc_loc[0] + 1), (@npc_loc[1] + 1), $@BarrelSpawnName$, $@BarrelSpawnId, $@BarrelSpawnCnt, "Barrel#0::OnMaggotDeath";
+ cleararray @npc_loc, 0, 2;
goto L_Return;
L_Reward:
diff --git a/world/map/npc/029-2/cynric.txt b/world/map/npc/029-2/cynric.txt
index d9f46d85..2a133e41 100644
--- a/world/map/npc/029-2/cynric.txt
+++ b/world/map/npc/029-2/cynric.txt
@@ -2,7 +2,6 @@
029-2,30,118,0|script|Cynric|161
{
- callfunc "ClearVariables";
set @npcname$, "Cynric";
callfunc "Banker";
close;
diff --git a/world/map/npc/029-2/morgan.txt b/world/map/npc/029-2/morgan.txt
index cb3608d4..085542ce 100644
--- a/world/map/npc/029-2/morgan.txt
+++ b/world/map/npc/029-2/morgan.txt
@@ -25,11 +25,7 @@ OnInit:
}
029-2,101,57,0|script|Morgan#_M|355
{
- callfunc "ClearVariables";
- setarray @npc_loc, 101, 57, 4;
callfunc "PCtoNPCRange";
- if (@npc_check)
- goto L_Close;
callfunc "MorganState";
if (Int >= 5)
goto L_Learn;
diff --git a/world/map/npc/029-2/sorfina.txt b/world/map/npc/029-2/sorfina.txt
index a7da1b31..984312cf 100644
--- a/world/map/npc/029-2/sorfina.txt
+++ b/world/map/npc/029-2/sorfina.txt
@@ -2,10 +2,8 @@
// Author: Jenalya
029-2,27,27,0|script|Sorfina|154,0,1
{
- setarray @npc_loc, 27, 27, 2;
+ set @npc_distance, 2;
callfunc "PCtoNPCRange";
- if (@npc_check)
- goto L_Close;
goto L_Main;
L_Main:
@@ -273,7 +271,8 @@ OnTouch:
029-2,29,23,0|script|Dresser#tutorial|400
{
- setarray @npc_loc, 29, 23, 2;
+ set @npc_distance, 2;
+ set @distance_handler, 1;
callfunc "PCtoNPCRange";
if (@npc_check)
goto L_CloseDis;
diff --git a/world/map/npc/029-2/stat_reset.txt b/world/map/npc/029-2/stat_reset.txt
index 896bbf6b..c1dafd7b 100644
--- a/world/map/npc/029-2/stat_reset.txt
+++ b/world/map/npc/029-2/stat_reset.txt
@@ -2,10 +2,7 @@
029-2,98,92,0|script|Jessie|159
{
- setarray @npc_loc, 98, 91, 4;
callfunc "PCtoNPCRange";
- if (@npc_check)
- goto L_Close;
if (BaseLevel >= 10)
goto L_Sorry;
diff --git a/world/map/npc/029-2/tanisha.txt b/world/map/npc/029-2/tanisha.txt
index eadb2164..9a7ee081 100644
--- a/world/map/npc/029-2/tanisha.txt
+++ b/world/map/npc/029-2/tanisha.txt
@@ -4,10 +4,7 @@
029-2,110,88,0|script|Tanisha|114
{
- setarray @npc_loc, 110, 88, 4;
callfunc "PCtoNPCRange";
- if (@npc_check)
- goto L_Close;
if (isin("029-2", 98, 84, 106, 89))
goto L_Fighting;
diff --git a/world/map/npc/033-1/traveler.txt b/world/map/npc/033-1/traveler.txt
index 681a4100..462e2586 100644
--- a/world/map/npc/033-1/traveler.txt
+++ b/world/map/npc/033-1/traveler.txt
@@ -4,7 +4,7 @@
033-1,63,30,0|script|Khoenan the Traveler|103
{
- set @NpcName$, "Khoenan";
+ set @npcname$, "Khoenan";
set @NpcTravelBit, $@barbarians_bit;
callfunc "Traveler";
end;
diff --git a/world/map/npc/048-2/traveler.txt b/world/map/npc/048-2/traveler.txt
index 4d8af7fe..7b654d85 100644
--- a/world/map/npc/048-2/traveler.txt
+++ b/world/map/npc/048-2/traveler.txt
@@ -4,7 +4,7 @@
048-2,23,46,0|script|Drake the Traveler|103
{
- set @NpcName$, "Drake";
+ set @npcname$, "Drake";
set @NpcTravelBit, $@blue_sage_bit;
callfunc "Traveler";
end;
diff --git a/world/map/npc/055-1/traveler.txt b/world/map/npc/055-1/traveler.txt
index 0277fbd4..1f36de77 100644
--- a/world/map/npc/055-1/traveler.txt
+++ b/world/map/npc/055-1/traveler.txt
@@ -4,7 +4,7 @@
055-1,135,60,0|script|Sherman the Traveler|103
{
- set @NpcName$, "Sherman";
+ set @npcname$, "Sherman";
set @NpcTravelBit, $@hurns_farms_bit;
callfunc "Traveler";
end;
diff --git a/world/map/npc/functions/banker.txt b/world/map/npc/functions/banker.txt
index ea5dfa22..9492f0f5 100644
--- a/world/map/npc/functions/banker.txt
+++ b/world/map/npc/functions/banker.txt
@@ -8,6 +8,7 @@ function|script|Banker
goto L_Start;
L_Start:
+ if(@npcname$ == "") set @npcname$, strnpcinfo(1);
mes "[" + @npcname$ + "]";
mes "\"Welcome to the bank!";
mes "How can I help you?\"";
@@ -248,5 +249,6 @@ L_Change_Bank:
goto L_Start;
L_Return:
+ set @npcname$, "";
return;
}
diff --git a/world/map/npc/functions/default_npc_checks.txt b/world/map/npc/functions/default_npc_checks.txt
index deb3ba64..d20ed187 100644
--- a/world/map/npc/functions/default_npc_checks.txt
+++ b/world/map/npc/functions/default_npc_checks.txt
@@ -1,13 +1,16 @@
// Default NPC Checks
-// Author: Wushin
+// Author: Wushin, mekolat
// Range
-// Map, X, Y, Distance in Tiles
-// setarray @npc_loc, 24, 113, 4;
+// Distance in Tiles
+// set @npc_distance, 4;
function|script|PCtoNPCRange
{
set @npc_check, 0;
- set @Nmap$, getmap() + "";
+ set @Nmap$, strnpcinfo(3);
+ if(!@npc_distance) set @npc_distance, 4; // <== default distance
+ cleararray @npc_loc, 0, 3;
+ setarray @npc_loc, getnpcx(), getnpcy(), @npc_distance;
set @Nx1, (@npc_loc[0] - @npc_loc[2]);
set @Ny1, (@npc_loc[1] - @npc_loc[2]);
set @Nx2, (@npc_loc[0] + @npc_loc[2]);
@@ -15,9 +18,22 @@ function|script|PCtoNPCRange
if (isin(@Nmap$, @Nx1, @Ny1, @Nx2, @Ny2))
goto L_Return;
set @npc_check, 1;
+ if(@distance_handler) goto L_Return;
+ set @dnpc_name$, strnpcinfo(1);
+ if(@dnpc_name$ != "") goto L_Named;
+ mes "You need to move closer to interact with this npc.";
+ close2;
goto L_Return;
+L_Named:
+ message strcharinfo(0), "##3"+@dnpc_name$+" : ##BPlease move closer.";
+ end;
+
L_Return:
+ set @dnpc_name$, "";
+ set @distance_handler, 0;
+ set @npc_distance, 0;
+ cleararray @npc_loc, 0, 3;
return;
}
diff --git a/world/map/npc/functions/inn.txt b/world/map/npc/functions/inn.txt
index ffa75582..e45c398c 100644
--- a/world/map/npc/functions/inn.txt
+++ b/world/map/npc/functions/inn.txt
@@ -2,12 +2,13 @@
function|script|Inn
{
+ if(@npcname$ == "") set @npcname$, strnpcinfo(1);
mes "[" + @npcname$ + "]";
mes "\"Would you like to rest? It's only " + @cost + " gp.\"";
next;
menu
"Yes", L_Next,
- "No", L_No;
+ "No", L_Close;
L_Next:
if (Zeny < @cost)
@@ -17,15 +18,18 @@ L_Next:
mes "[" + @npcname$ + "]";
mes "\"Sleep well!\"";
- close;
+ next;
+ goto L_Close;
-L_No:
+L_Close:
mes "[" + @npcname$ + "]";
mes "\"See you.\"";
+ set @npcname$, "";
close;
L_NoMoney:
mes "[" + @npcname$ + "]";
mes "\"You don't have enough money to stay here.\"";
- close;
+ next;
+ goto L_Close;
}
diff --git a/world/map/npc/functions/stat_reset.txt b/world/map/npc/functions/stat_reset.txt
index d8f484ff..fdb833f7 100644
--- a/world/map/npc/functions/stat_reset.txt
+++ b/world/map/npc/functions/stat_reset.txt
@@ -8,7 +8,7 @@ function|script|StatReset
set @cost, BaseLevel * 100;
- mes "[" + @NpcName$ + "]";
+ mes "[" + @npcname$ + "]";
mes "\"I have come across a spell that will";
mes "reset your status points.";
mes "Normally this spell is expensive, but";
@@ -31,19 +31,19 @@ L_Reset:
set Zeny, Zeny-@cost;
resetstatus;
- mes "[" + @NpcName$ + "]";
+ mes "[" + @npcname$ + "]";
mes "\"There you are.";
mes "";
mes "Good as new!\"";
goto L_Return;
L_Pass:
- mes "[" + @NpcName$ + "]";
+ mes "[" + @npcname$ + "]";
mes "\"Very well then, see you.\"";
goto L_Return;
L_NoMoney:
- mes "[" + @NpcName$ + "]";
+ mes "[" + @npcname$ + "]";
mes "\"Oh dear, the price cannot be bargained.";
mes "";
mes "Perhaps you can borrow from a friend?\"";
diff --git a/world/map/npc/functions/travelers.txt b/world/map/npc/functions/travelers.txt
index 07b084d9..88a9ed9d 100644
--- a/world/map/npc/functions/travelers.txt
+++ b/world/map/npc/functions/travelers.txt
@@ -46,7 +46,8 @@ OnInit:
function|script|TravelerTut
{
//Explain Travelers
- mes "["+@NpcName$+"]";
+ if(@npcname$ == "") set @npcname$, strnpcinfo(1);
+ mes "["+@npcname$+"]";
mes "\"We travelers are found all over the world. Once you have found another traveler, we can create a link and send you between us.\"";
next;
if (TravelFound & $@tut_bit)
@@ -58,13 +59,15 @@ L_SetBit:
goto L_Return;
L_Return:
+ set @npcname$, "";
return;
}
function|script|Traveler
{
- mes "["+@NpcName$+"]";
- mes "\"Greetings. I am "+@NpcName$+" the Traveler.\"";
+ if(@npcname$ == "") set @npcname$, strnpcinfo(1);
+ mes "["+@npcname$+"]";
+ mes "\"Greetings. I am "+@npcname$+" the Traveler.\"";
next;
if (TravelFound & $@tut_bit)
@@ -87,7 +90,7 @@ L_TravelTut:
goto L_Main;
L_SetTravelBit:
- mes "["+@NpcName$+"]";
+ mes "["+@npcname$+"]";
mes "\"Uplink Set. You can now return to this spot for a fee.\"";
next;
set TravelFound, TravelFound | @NpcTravelBit;
@@ -120,7 +123,7 @@ L_TravelChecks:
goto L_TravelPlayer;
L_TravelPlayer:
- mes "["+@NpcName$+"]";
+ mes "["+@npcname$+"]";
mes "\"Be fearless!\"";
close2;
set Zeny, Zeny - @NextLocationCost;
@@ -223,30 +226,31 @@ L_TravelCandor:
goto L_TravelChecks;
L_TravelNo:
- mes "["+@NpcName$+"]";
+ mes "["+@npcname$+"]";
mes "\"Perhaps some day you will have the courage to help us.\"";
close2;
goto L_Clearvars;
L_NoMoney:
- mes "["+@NpcName$+"]";
+ mes "["+@npcname$+"]";
mes "\"Sorry, but you don't have enough money. Maybe next time.\"";
close2;
goto L_Clearvars;
L_NoFound:
- mes "["+@NpcName$+"]";
+ mes "["+@npcname$+"]";
mes "\"Sorry, but you haven't visited a traveler yet at that location. You should talk to a traveler there so you can quickly travel there in the future.\"";
close2;
goto L_Clearvars;
L_AlreadyThere:
- mes "["+@NpcName$+"]";
+ mes "["+@npcname$+"]";
mes "\"Umm, you are already here. Are you sure you know where you are going?\"";
close2;
goto L_Clearvars;
L_Clearvars:
+ set @npcname$, "";
set @Cost, 0;
set @NextLocationBit, 0;
set @NextLocationCost, 0;