diff options
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/map/script.c b/src/map/script.c index db2ab5a86..4eb2e6324 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -7468,6 +7468,24 @@ BUILDIN_FUNC(areamonster) /*========================================== * モンスター削除 *------------------------------------------*/ + static int buildin_killmonster_sub_strip(struct block_list *bl,va_list ap) +{ //same fix but with killmonster instead - stripping events from mobs. + TBL_MOB* md = (TBL_MOB*)bl; + char *event=va_arg(ap,char *); + int allflag=va_arg(ap,int); + + md->npc_killmonster = 1; + + if(!allflag){ + if(strcmp(event,md->npc_event)==0) + status_kill(bl); + }else{ + if(!md->spawn) + status_kill(bl); + } + md->npc_killmonster = 0; + return 0; +} static int buildin_killmonster_sub(struct block_list *bl,va_list ap) { TBL_MOB* md = (TBL_MOB*)bl; @@ -7496,7 +7514,15 @@ BUILDIN_FUNC(killmonster) if( (m=map_mapname2mapid(mapname))<0 ) return 0; - map_foreachinmap(buildin_killmonster_sub, m, BL_MOB, event ,allflag); + + if( script_hasdata(st,4) ) { + if ( script_getnum(st,4) == 1 ) { + map_foreachinmap(buildin_killmonster_sub, m, BL_MOB, event ,allflag); + return 0; + } + } + + map_foreachinmap(buildin_killmonster_sub_strip, m, BL_MOB, event ,allflag); return 0; } @@ -13456,7 +13482,7 @@ struct script_function buildin_func[] = { BUILDIN_DEF(produce,"i"), BUILDIN_DEF(monster,"siisii*"), BUILDIN_DEF(areamonster,"siiiisii*"), - BUILDIN_DEF(killmonster,"ss"), + BUILDIN_DEF(killmonster,"ss?"), BUILDIN_DEF(killmonsterall,"s?"), BUILDIN_DEF(clone,"siisi*"), BUILDIN_DEF(doevent,"s"), |