diff options
Diffstat (limited to 'world/map/npc/functions')
-rw-r--r-- | world/map/npc/functions/banker.txt | 2 | ||||
-rw-r--r-- | world/map/npc/functions/default_npc_checks.txt | 24 | ||||
-rw-r--r-- | world/map/npc/functions/inn.txt | 12 | ||||
-rw-r--r-- | world/map/npc/functions/stat_reset.txt | 8 | ||||
-rw-r--r-- | world/map/npc/functions/travelers.txt | 22 |
5 files changed, 47 insertions, 21 deletions
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; |