Jump to content
  • 0
Sign in to follow this  
simplynice

Simple Script Needs a Simple Help

Question

-	script	Anti_Corrupt	-1,{OnInit:	bindatcmd "monster",strnpcinfo(3)+"::OnAtcommand";	end;	OnAtcommand:	if (getmapxy(@mapname$,@mapx,@mapy,1,"+strcharinfo(0)+")!=0) goto Notfound;		announce "[ "+strcharinfo(0)+" ] spawned a monster on "+@mapname$+" at X:"+@mapx+" Y:"+@mapy+" !",0;	end;	Notfound:	mes "I can't seem to find the person anywhere!";	end;unbindatcmd "monster";}  

This is what i got so far.

 

I'm trying to announce the "MAP LOCATION, MONSTER, MONSTER AMOUNT, GM NAME" everytime a Game Master uses  @monster in game.

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0
-	script	Anti_Corrupt	-1,{OnAtcommand:    if (getmapxy(@mapname$,@mapx,@mapy,0,strcharinfo(0))!=0) goto Notfound;    announce "[ "+strcharinfo(0)+" ] spawned a monster on "+@mapname$+" at X:"+@mapx+" Y:"+@mapy+" !",0;    end;Notfound:    mes "I can't seem to find the person anywhere!";    close;} 

You need source mod for this.

 

@edit

atcommand.c

 

 

ACMD(monster){	char name[NAME_LENGTH];	char monster[NAME_LENGTH];	char eventname[EVENT_NAME_LENGTH] = "";	int mob_id;	int number = 0;	int count;	int i, k, range;	short mx, my;	unsigned int size;	nullpo_retr(-1, sd);		memset(name, '0', sizeof(name));	memset(monster, '0', sizeof(monster));	memset(atcmd_output, '0', sizeof(atcmd_output));		if (!message || !*message) {		clif->message(fd, msg_txt(80)); // Give the display name or monster name/id please.		return false;	}	if (sscanf(message, ""%23[^"]" %23s %d", name, monster, &number) > 1 ||		sscanf(message, "%23s "%23[^"]" %d", monster, name, &number) > 1) {		//All data can be left as it is.	} else if ((count=sscanf(message, "%23s %d %23s", monster, &number, name)) > 1) {		//Here, it is possible name was not given and we are using monster for it.		if (count < 3) //Blank mob's name.			name[0] = '0';	} else if (sscanf(message, "%23s %23s %d", name, monster, &number) > 1) {		//All data can be left as it is.	} else if (sscanf(message, "%23s", monster) > 0) {		//As before, name may be already filled.		name[0] = '0';	} else {		clif->message(fd, msg_txt(80)); // Give a display name and monster name/id please.		return false;	}		if ((mob_id = mobdb_searchname(monster)) == 0) // check name first (to avoid possible name begining by a number)		mob_id = mobdb_checkid(atoi(monster));		if (mob_id == 0) {		clif->message(fd, msg_txt(40)); // Invalid monster ID or name.		return false;	}		if (mob_id == MOBID_EMPERIUM) {		clif->message(fd, msg_txt(83)); // Monster 'Emperium' cannot be spawned.		return false;	}		if (number <= 0)		number = 1;		if( !name[0] )		strcpy(name, "--ja--");		// If value of atcommand_spawn_quantity_limit directive is greater than or equal to 1 and quantity of monsters is greater than value of the directive	if (battle_config.atc_spawn_quantity_limit && number > battle_config.atc_spawn_quantity_limit)		number = battle_config.atc_spawn_quantity_limit;		if (strcmp(command+1, "monstersmall") == 0)		size = SZ_MEDIUM; // This is just gorgeous [mkbu95]	else if (strcmp(command+1, "monsterbig") == 0)		size = SZ_BIG;	else		size = SZ_SMALL;		if (battle_config.etc_log)		ShowInfo("%s monster='%s' name='%s' id=%d count=%d (%d,%d)n", command, monster, name, mob_id, number, sd->bl.x, sd->bl.y);		count = 0;	range = (int)sqrt((float)number) +2; // calculation of an odd number (+ 4 area around)	for (i = 0; i < number; i++) {		iMap->search_freecell(&sd->bl, 0, &mx,  &my, range, range, 0);		k = mob_once_spawn(sd, sd->bl.m, mx, my, name, mob_id, 1, eventname, size, AI_NONE);		count += (k != 0) ? 1 : 0;	}		if (count != 0)		if (number == count)			clif->message(fd, msg_txt(39)); // All monster summoned!		else {			sprintf(atcmd_output, msg_txt(240), count); // %d monster(s) summoned!			clif->message(fd, atcmd_output);		}		else {			clif->message(fd, msg_txt(40)); // Invalid monster ID or name.			return false;		}	npc_event(sd,"Anti_Corrupt::OnAtcommand",0);	return true;}

 

 

Edited by quesoph

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.