From 27fe76b6a48cf51aa87346094845fb0ed6333304 Mon Sep 17 00:00:00 2001 From: mekolat Date: Tue, 21 Apr 2015 00:30:19 -0400 Subject: make PCtoNPCRange smarter --- world/map/npc/029-2/barrels.txt | 8 -------- world/map/npc/029-2/barrels_config.txt | 13 +++++-------- world/map/npc/029-2/morgan.txt | 3 --- world/map/npc/029-2/sorfina.txt | 7 +++---- world/map/npc/029-2/stat_reset.txt | 3 --- world/map/npc/029-2/tanisha.txt | 3 --- 6 files changed, 8 insertions(+), 29 deletions(-) (limited to 'world/map/npc/029-2') 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; -- cgit v1.2.3-60-g2f50