Jump to content
  • 0

@monster restriction depending on GM level


Eross

Question


  • Group:  Members
  • Topic Count:  155
  • Topics Per Day:  0.11
  • Content Count:  349
  • Reputation:   12
  • Joined:  04/05/20
  • Last Seen:  

Hi, do you have a script that will restrict level 60 and below GM on summoning certain boss id ? For example my event gm wants to summon VALKYRIE ..there is a pop up message that will say "You are not allowed to summon this kind of mob"

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  12
  • Reputation:   3
  • Joined:  04/29/14
  • Last Seen:  

OnMonsterCommand:
	.@mob = atoi(.@atcmd_parameters$[0]);		
	if(!.@mob)		//Input is not mob ID, store as string instead
		.@mob$ = .@atcmd_parameters$[0];		
	if(getgmlevel()<60 && (inarray(.restricted[0],.@mob)>-1 || inarray(.restricted$[0],.@mob$)>-1)){
 		message strcharinfo(0),"Your GM level does not allow you to summon this monster.";
 		end;
	}
	if(.@atcmd_numparameters==2){
		.@amt = atoi(.@atcmd_parameters$[1]);
	}
	atcommand "@monster "+(.@mob?.@mob:.@mob$)+" "+(.@amt>0?.@amt:"");
	end;

OnInit:
	bindatcmd "monster","<npc name>::OnMonsterCommand",60,100;
	setarray .restricted[0],1751;			//Add mob id as needed
	setarray .restricted$[0],"RANDGRIS";	//Added mob name that corresponds to mob id in the above array.This is required for mob name inputs instead of mob id

Quick and dirty solution. Tested for functionality, but not tested for bugs. It accounts for both mob name and mob id inputs, but you'll have to add both the mob id and proper mob name in the arrays in OnInit.

Personally, I don't like overwriting atcommands. Here's a nicer src-based solution that you could put under ACMD_FUNC(monster) in atcommand.ccp. Note that the MOBID_EMPERIUM statement is there for reference on where you should put it.

if (mob_id == MOBID_EMPERIUM) {
	clif_displaymessage(fd, msg_txt(sd,83)); // Monster 'Emperium' cannot be spawned.
 	return -1;
}


int restricted_mob_id[] {1751}; //Add mob ID as needed
i = 0;
int restricted_mob_id_size = ARRAYLENGTH(restricted_mob_id);
ARR_FIND(0,restricted_mob_id_size,i,restricted_mob_id[i]==mob_id);
if(pc_get_group_level(sd)<=60 && i<restricted_mob_id_size){
	clif_displaymessage(fd, "Your GM level does not allow you to summon this monster.");
	return -1;
}

 

Edited by Dazzu
Link to comment
Share on other sites

  • 0

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

just configure your GM group properly with the necessary atcommands.

https://github.com/rathena/rathena/blob/master/conf/groups.conf

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...