diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/npc.c | 16 | ||||
-rw-r--r-- | src/map/npc.h | 1 | ||||
-rw-r--r-- | src/map/script.c | 5 | ||||
-rw-r--r-- | src/map/script.h | 1 |
4 files changed, 19 insertions, 4 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index c0e61e41f..63514710f 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -139,11 +139,22 @@ int npc_ontouch2_event(struct map_session_data *sd, struct npc_data *nd) { char name[EVENT_NAME_LENGTH]; - if( sd->areanpc_id == nd->bl.id ) + if (sd->areanpc_id == nd->bl.id) return 0; snprintf(name, ARRAYLENGTH(name), "%s::%s", nd->exname, script->config.ontouch2_name); - return npc->event(sd,name,2); + return npc->event(sd, name, 2); +} + +int npc_onuntouch_event(struct map_session_data *sd, struct npc_data *nd) +{ + char name[EVENT_NAME_LENGTH]; + + if (sd->areanpc_id == nd->bl.id) + return 0; + + snprintf(name, ARRAYLENGTH(name), "%s::%s", nd->exname, script->config.onuntouch_name); + return npc->event(sd, name, 2); } /*========================================== @@ -4614,6 +4625,7 @@ void npc_defaults(void) { npc->isnear = npc_isnear; npc->ontouch_event = npc_ontouch_event; npc->ontouch2_event = npc_ontouch2_event; + npc->onuntouch_event = npc_onuntouch_event; npc->enable_sub = npc_enable_sub; npc->enable = npc_enable; npc->name2id = npc_name2id; diff --git a/src/map/npc.h b/src/map/npc.h index 0825faf10..cb8f09644 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -182,6 +182,7 @@ struct npc_interface { bool (*isnear) (struct block_list *bl); int (*ontouch_event) (struct map_session_data *sd, struct npc_data *nd); int (*ontouch2_event) (struct map_session_data *sd, struct npc_data *nd); + int (*onuntouch_event) (struct map_session_data *sd, struct npc_data *nd); int (*enable_sub) (struct block_list *bl, va_list ap); int (*enable) (const char *name, int flag); struct npc_data* (*name2id) (const char *name); diff --git a/src/map/script.c b/src/map/script.c index fbfb88de2..3ccb6a45a 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -20124,8 +20124,9 @@ void script_defaults(void) { script->config.loadmap_event_name = "OnPCLoadMapEvent"; script->config.baselvup_event_name = "OnPCBaseLvUpEvent"; script->config.joblvup_event_name = "OnPCJobLvUpEvent"; - script->config.ontouch_name = "OnTouch_";//ontouch_name (runs on first visible char to enter area, picks another char if the first char leaves) - script->config.ontouch2_name = "OnTouch";//ontouch2_name (run whenever a char walks into the OnTouch area) + script->config.ontouch_name = "OnTouch_"; //ontouch_name (runs on first visible char to enter area, picks another char if the first char leaves) + script->config.ontouch2_name = "OnTouch"; //ontouch2_name (run whenever a char walks into the OnTouch area) + script->config.onuntouch_name = "OnUnTouch"; //onuntouch_name (run whenever a char walks from the OnTouch area) // for ENABLE_CASE_CHECK script->calc_hash_ci = calc_hash_ci; diff --git a/src/map/script.h b/src/map/script.h index e28abf970..548c0f261 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -343,6 +343,7 @@ struct Script_Config { const char* ontouch_name; const char* ontouch2_name; + const char* onuntouch_name; }; /** |