summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpanikon <panikon@zoho.com>2014-04-10 02:40:55 -0300
committerpanikon <panikon@zoho.com>2014-04-10 02:40:55 -0300
commit7a5f7db21c5b9f7dc974067312b6b83753a74dbf (patch)
treea534972a497ce350572ec47c1646ebf11d8a63ca
parentb5c2a71ef2575b66e7b1b25aed0ad3c60b4fef2b (diff)
downloadhercules-7a5f7db21c5b9f7dc974067312b6b83753a74dbf.tar.gz
hercules-7a5f7db21c5b9f7dc974067312b6b83753a74dbf.tar.bz2
hercules-7a5f7db21c5b9f7dc974067312b6b83753a74dbf.tar.xz
hercules-7a5f7db21c5b9f7dc974067312b6b83753a74dbf.zip
Fixed issue: 8140
http://hercules.ws/board/tracker/issue-8140-toucan-npc-error-message/ That error usually happens when the player clicked on a NPC that has the view id of a mob, to activate this kind of npc it's needed to be in a 2,2 range from it. If the OnTouch area of a npc, coincides with the 2,2 range of another it's expected that the OnTouch event be put first in stack, because unit_walktoxy_timer is executed before any other function in this case. So it's best practice to put an 'end;' before OnTouch events in npcs that have view ids of mobs to avoid this kind of error. Also updated script_commands.txt to add this recomendation.
-rw-r--r--doc/script_commands.txt8
-rw-r--r--npc/re/quests/quests_brasilis.txt8
-rw-r--r--src/map/npc.c7
3 files changed, 19 insertions, 4 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 1fd3c47a6..e8069cb0b 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -243,9 +243,11 @@ and to make it look southeast it's facing 5.)
Sprite id is the sprite number used to display this particular NPC. For a
full list of sprite id numbers see http://kalen.s79.xrea.com/npc/npce.shtml
You may also use a monster's ID number instead to display a monster sprite
-for this NPC. It is possible to use a job sprite as well, but you must
-first define it as a monster sprite in 'mob_avail.txt', a full description
-on how to do this is not in the scope of this manual.
+for this NPC, in npcs that have view ids of mobs it's encouraged to use
+OnTouch events with a 2,2 range and with an 'end' after the header to avoid
+bugs (for more info on why see npc_click@map/npc.c). It is possible to use a job
+sprite as well, but you must first define it as a monster sprite in 'mob_avail.txt',
+a full description on how to do this is not in the scope of this manual.
A '-1' sprite id will make the NPC invisible (and unclickable).
A '111' sprite id will make an NPC which does not have a sprite, but is
still clickable, which is useful if you want to make a clickable object of
diff --git a/npc/re/quests/quests_brasilis.txt b/npc/re/quests/quests_brasilis.txt
index b6aa85ce9..33758fe9a 100644
--- a/npc/re/quests/quests_brasilis.txt
+++ b/npc/re/quests/quests_brasilis.txt
@@ -3,7 +3,7 @@
//===== By ===================================================
//= L0ne_W0lf
//===== Version ==============================================
-//= 1.2a
+//= 1.2c
//===== Description ==========================================
//= [Official Conversion]
//= Lost Puppies (Repeatable, 24 hours.)
@@ -18,6 +18,8 @@
//= 1.2 Optimization. [Euphy]
//= 1.2a Added 'consumeitem' command. [Euphy]
//= 1.2b Updated RE EXP. [Michieru]
+//= 1.2c Put end; before OnTouch events in npcs that
+//= have view id of a mob [Panikon]
//============================================================
// Lost Puppies :: dogdog.sc
@@ -862,6 +864,8 @@ brasilis,59,226,3 script Poring#bra 4_PORING,{
}
bra_fild01,75,83,5 script Toucan#bra TOUCAN,2,2,{
+end;
+
OnTouch:
if (brazil_gua == 6) {
mes "[Toucan]";
@@ -922,6 +926,8 @@ OnTouch:
}
bra_fild01,34,184,5 script Jaguar#bra JAGUAR,2,2,{
+end;
+
OnTouch_:
if (brazil_gua == 7) {
mes "[Jaguar]";
diff --git a/src/map/npc.c b/src/map/npc.c
index 3018cceeb..5f9422e9f 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1146,6 +1146,13 @@ int npc_click(struct map_session_data* sd, struct npc_data* nd)
{
nullpo_retr(1, sd);
+ // This usually happens when the player clicked on a NPC that has the view id
+ // of a mob, to activate this kind of npc it's needed to be in a 2,2 range
+ // from it. If the OnTouch area of a npc, coincides with the 2,2 range of
+ // another it's expected that the OnTouch event be put first in stack, because
+ // unit_walktoxy_timer is executed before any other function in this case.
+ // So it's best practice to put an 'end;' before OnTouch events in npcs that
+ // have view ids of mobs to avoid this kind of error [Panikon]
if (sd->npc_id != 0) {
ShowError("npc_click: npc_id != 0\n");
return 1;