diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 5768e65cd4..33c347406b 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -5,6 +5,12 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. EV GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS 2006/03/17 + * Final fix on Juperos NPC. [Lance] + * Fix on initnpctimer not attaching rid. [Lance] + * Fix on OnTouch ignoring -1 NPCs. [Lance] + * Fix on @reloadscript crashing due to passing non BL_SKILL bl to a function that accepts only BL_SKILL bl. + [Lance] + * Added area NPC detection in clif_parseLoadEndAck. [Lance] * Fixed compiler warning in script.c get_mob_data. [Lance] * Temperory resolved issues on Juperos until I get the exact description on the behaviour in retail servers. [Lance] diff --git a/npc/warps/dungeons/juperos.txt b/npc/warps/dungeons/juperos.txt index 42c1433da1..1882a35182 100644 --- a/npc/warps/dungeons/juperos.txt +++ b/npc/warps/dungeons/juperos.txt @@ -55,21 +55,19 @@ juperos_02.gat,129,150,0 script Juperos 111,{ mes "Are you sure you want to enter?"; next; if(select("Yes","No") == 1){ - close2; - set jupe_destination$, "jupe_ele.gat"; + set jupe_destination$, "jupe_ele_r.gat"; set jupe_destination_x, 50; set jupe_destination_y, 94; + close2; warp "jupe_ele.gat",41,45; end; } close; } -jupe_ele.gat,41,45,0 script detectionUnit -1,10,10{ - if(jupe_ele_timer == 0){ - set jupe_ele_timer, 1; - initnpctimer; - } +jupe_ele.gat,41,45,0 script detectionUnit -1,20,20{ +OnTouch: + initnpctimer; end; OnTimer1000: @@ -80,11 +78,10 @@ OnTimer1000: OnTimer15000: stopnpctimer; setnpctimer 0; - set jupe_ele_timer, 0; + warp jupe_destination$,jupe_destination_x,jupe_destination_y; set jupe_destination$, ""; set jupe_destination_x, 0; set jupe_destination_y, 0; - warp jupe_destination$,jupe_destination_x,jupe_destination_y; end; } @@ -92,10 +89,10 @@ jupe_ele_r.gat,50,98,0 script Juperos Elevator 111,{ mes "Are you sure you want to go up?"; next; if(select("Yes","No") == 1){ - close2; set jupe_destination$, "juperos_02.gat"; set jupe_destination_x, 129; set jupe_destination_y, 147; + close2; warp "jupe_ele.gat",41,45; } close; diff --git a/src/map/clif.c b/src/map/clif.c index 13e936f184..556a48f8d4 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -8846,6 +8846,12 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) clif_status_load(&sd->bl, SI_DEVIL, 1); //blindness [Komurka] map_foreachinarea(clif_getareachar,sd->bl.m,sd->bl.x-AREA_SIZE,sd->bl.y-AREA_SIZE,sd->bl.x+AREA_SIZE,sd->bl.y+AREA_SIZE,BL_ALL,sd); + + // For automatic triggering of NPCs after map loading (so you don't need to walk 1 step first) + if (map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNPC)) + npc_touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y); + else + sd->areanpc_id = 0; } /*========================================== diff --git a/src/map/map.c b/src/map/map.c index ef67616c42..92bddc3c54 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1279,7 +1279,7 @@ void map_foreachobject(int (*func)(struct block_list*,va_list),int type,...) { for(i=2;i<=last_object_id;i++){ if(objects[i]){ - if(!(objects[i]->type&type)) + if(!(objects[i]->type==type)) // Fixed [Lance] continue; if(bl_list_count>=BL_LIST_MAX) { if(battle_config.error_log) diff --git a/src/map/npc.c b/src/map/npc.c index 1fc99de95f..4e6842b979 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -777,6 +777,7 @@ int npc_settimerevent_tick(struct npc_data *nd,int newtimer) flag= sd->npc_timer_id != -1 ; } else flag= nd->u.scr.timerid != -1 ; + if(flag) npc_timerevent_stop(nd); nd->u.scr.timer=newtimer; @@ -1556,6 +1557,7 @@ int npc_unload (struct npc_data *nd) } } } + aFree(nd); return 0; @@ -2033,7 +2035,7 @@ static int npc_parse_script (char *w1,char *w2,char *w3,char *w4,char *first_lin if (xs >= 0) xs = xs * 2 + 1; if (ys >= 0) ys = ys * 2 + 1; - if (class_ >= 0) { + if (class_ >= -1) { // -1 NPCs use OnTouch [Lance] for (i = 0; i < ys; i++) { for (j = 0; j < xs; j++) { if (map_getcell(m, x - xs/2 + j, y - ys/2 + i, CELL_CHKNOPASS)) diff --git a/src/map/script.c b/src/map/script.c index 7de21a76f7..4eeea13cb0 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -5659,6 +5659,7 @@ int buildin_initnpctimer(struct script_state *st) else nd=(struct npc_data *)map_id2bl(st->oid); + nd->u.scr.rid = st->rid; npc_settimerevent_tick(nd,0); npc_timerevent_start(nd, st->rid); return 0;