Jump to content
  • 0

MOBCOUNT BY MOB_ID


cahadeyelo

Question


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   1
  • Joined:  11/13/14
  • Last Seen:  

Hi rAthena, Is it possible that instead of event label, the script will read the mob_id on a given map. If yes, can i see what's codes do need to add on my script.cpp.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  898
  • Reputation:   119
  • Joined:  05/23/12
  • Last Seen:  

Take a look at the Convex Mirror

Or u can use *mobcount("map",1002)

 

The question does not rly match with ur topic title

 

Rynbef~

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   1
  • Joined:  11/13/14
  • Last Seen:  

BUILDIN_FUNC(mobcount)
{
	const char *mapname,*event;
	int16 m;
	mapname=script_getstr(st,2);
	event=script_getstr(st,3);

	if( strcmp(event, "all") == 0 )
		event = NULL;
	else
		check_event(st, event);

	if( strcmp(mapname, "this") == 0 ) {
		struct map_session_data *sd;
		if( script_rid2sd(sd) )
			m = sd->bl.m;
		else {
			script_pushint(st,-1);
			return SCRIPT_CMD_SUCCESS;
		}
	}
	else if( (m = map_mapname2mapid(mapname)) < 0 ) {
		script_pushint(st,-1);
		return SCRIPT_CMD_SUCCESS;
	}

	script_pushint(st,map_foreachinmap(buildin_mobcount_sub, m, BL_MOB, event));
	return SCRIPT_CMD_SUCCESS;
}

what codes do i need to replace so that the mobcount script will read the mob_id instead of event label?

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

what you need is rewrite the 

static int buildin_mobcount_sub(struct block_list *bl,va_list ap)

into

static int buildin_mobcount_by_id_sub(struct block_list *bl,va_list ap)	// Added by RoVeRT
{
	unsigned int id = va_arg(ap,unsigned int);
	struct mob_data *md = ((struct mob_data *)bl);
	if (md->status.hp > 0 && md->status.class_ == id)
		return 1;
	return SCRIPT_CMD_SUCCESS;
}
script_pushint(st,map_foreachinmap(buildin_mobcount_by_id_sub, id));

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...