Jump to content

shefer

Members
  • Posts

    10
  • Joined

  • Last visited

Posts posted by shefer

  1. Thank you.

    I haven't tried to add a new script command myself.

    Thank you for your answer.

    On 11/18/2022 at 1:13 AM, Tokei said:

    Heya,

    You can create a new script command:

    static int buildin_killmonsterarea_sub(struct block_list *bl,va_list ap)
    {
    	int   x1       = va_arg(ap, int);
    	int   y1       = va_arg(ap, int);
    	int   x2       = va_arg(ap, int);
    	int   y2       = va_arg(ap, int);
    
    	if (x1 <= bl->x && bl->x <= x2 &&
    		y2 <= bl->y && bl->y <= y1)
    		status_kill(bl);
    	return 0;
    }
    
    BUILDIN_FUNC(killmonsterarea)
    {
    	const char *mapname;
    	int16 m;
    	int x1, x2, y1, y2;
    
    	mapname=script_getstr(st,2);
    
    	if( (m = map_mapname2mapid(mapname))<0 )
    		return 0;
    
    	x1=script_getnum(st,3);
    	y1=script_getnum(st,4);
    	x2=script_getnum(st,5);
    	y2=script_getnum(st,6);
    
    	map_foreachinmap(buildin_killmonsterarea_sub,m,BL_MOB, x1, y1, x2, y2);
    	return SCRIPT_CMD_SUCCESS;
    }
          
    // def
    BUILDIN_DEF(killmonsterarea,"siiii"),

     

    Thank you.

    I haven't tried to add a new script command myself.

    Thank you for your answer.

×
×
  • Create New...