summaryrefslogtreecommitdiff
path: root/world/map
diff options
context:
space:
mode:
authormekolat <mekolat@gmail.com>2015-04-21 00:30:19 -0400
committermekolat <mekolat@users.noreply.github.com>2015-04-30 02:06:42 -0400
commit27fe76b6a48cf51aa87346094845fb0ed6333304 (patch)
tree4f88cae1c5ce996adaa41de52f0e72830e2fd497 /world/map
parentb28709f705abf9ca0fff5bf79f95d0599722fdff (diff)
downloadserverdata-27fe76b6a48cf51aa87346094845fb0ed6333304.tar.gz
serverdata-27fe76b6a48cf51aa87346094845fb0ed6333304.tar.bz2
serverdata-27fe76b6a48cf51aa87346094845fb0ed6333304.tar.xz
serverdata-27fe76b6a48cf51aa87346094845fb0ed6333304.zip
make PCtoNPCRange smarter
Diffstat (limited to 'world/map')
-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.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/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/morgan.txt3
-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/functions/default_npc_checks.txt24
16 files changed, 34 insertions, 81 deletions
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 f513955b..8b7ebdb4 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..cdc8d40e 100644
--- a/world/map/npc/006-1/pachua.txt
+++ b/world/map/npc/006-1/pachua.txt
@@ -1,6 +1,6 @@
006-1,24,113,0|script|Pachua|143
{
- setarray @npc_loc, 24, 113, 4;
+ set @distance_handler, 1;
callfunc "PCtoNPCRange";
if (@npc_check)
goto L_Close;
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/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/morgan.txt b/world/map/npc/029-2/morgan.txt
index 59285daa..c4703c70 100644
--- a/world/map/npc/029-2/morgan.txt
+++ b/world/map/npc/029-2/morgan.txt
@@ -25,10 +25,7 @@ OnInit:
}
029-2,101,57,0|script|Morgan#_M|355
{
- setarray @npc_loc, 101, 57, 4;
callfunc "PCtoNPCRange";
- if (@npc_check)
- goto L_Close;
callfunc "MorganState";
if (readparam(bInt) >= 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/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;
}