Jump to content
  • 0

Need help. Instance level restriction


Rizz

Question


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  72
  • Reputation:   0
  • Joined:  07/29/17
  • Last Seen:  

I have severali ssues:

I need a guidance about how to make the npc only allows party members which are between level x ~ y (ex. lv 120-150) to enter the instance.

I tried to create one based on some examples but when the instance already generated, the underlevelled members which joins the party after the instance was generated can enter.

Some player can trick this restriction by adding their underlevelled char to the party when the instance has been generated.

prontera,155,172,6	script	Mystic Instance	693,{
	.@instance$ = "Mystic Cave";
	set .@party_id,getcharid(1);
	if (BaseLevel < 120) {
		mes "[Worried Woman]";
		mes "This is too dangerous, come back when you are level 120...";
		close;
	}
	if (!.@party_id) {
		mes "[Worried Woman]";
		mes "Don't go there alone.";
		mes "Why don't you at least organize a party?";
		close;
	}
	if (instance_id()) {  // ignore the console debug message (harmless)
		mes "[Worried Woman]";
		mes "You are already part of an instance.";
		next;
		switch(select("Enter Instance.:Cancel.")) {
		case 1:
			break;
		case 2:
			mes "[Worried Woman]";
			mes "Please help my son?";
			emotion e_sob;
			close;
		}
	} else {
		mes "[Worried Woman]";
		mes "Help me traveler..";
		next;
		mes "[Worried Woman]";
		mes "I beg you..please help me. My son... it's been a week. I am afraid if something bad happened on him.";
		switch(select("Create Instance.:Cancel.")) {
		case 1:
			.@create = instance_create(.@instance$);
			if (.@create < 0) {
				mes "[Worried Woman]";
				switch (.@create) {
					case -1: mes "ERROR: Invalid type."; break;
					case -2: mes "I think you are not ready for this."; break;
					case -3: mes "Instance is on going."; break;
					case -4: mes "No free instances."; break;
				}
				mes " ";
				mes "Instance creation ^FF0000failed^000000.";
				emotion e_omg;
				close;
			}
			mes "[Worried Woman]";
			mes "He went with prontera search party to find out a tree in weird cave. Please.. bring him back to me";
			mes " ";
			mes "Now entering the instance...";
			next;
			break;
		case 2:
			mes "[Worried Woman]";
			mes "Okay. Maybe next time!";
			close;
		}
	}
	.@enter = instance_enter(.@instance$); 
	if (.@enter != 0) {
		mes "[Worried Woman]";
		switch (.@enter) {
			case 1: mes "ERROR: Party not found."; break;
			case 2: mes "ERROR: Party does not have an instance."; break;
			case 3: mes "ERROR: Unknown error."; break;
		}
		mes " ";
		mes "Instance entry ^FF0000failed^000000.";
		emotion e_omg;
		close;
	}
	close;
}

I hope Rathena shifus can help me :D

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  763
  • Reputation:   227
  • Joined:  02/11/17
  • Last Seen:  

getpartymember .@party_id,2;
	for( set .@i, 0; .@i < $@partymembercount; set .@i,.@i+1 )
	if( attachrid( $@partymemberaid[.@i] ) ){
	if( BaseLevel < .base_level[0] || BaseLevel > .base_level[1] ) set .@error, .@error|1;
	if( .@fail ){
	set .@name$, strcharinfo(0);
	break;

if( .@name$ != "" && .@error ){
	mes "^FF0000[ Failed ]^000000";
	mes "^0055FF"+.@name$+"^000000, You cannot join right now.";
	mes " ";
	mes "^FF0000[ ERROR: ]^000000";
	if( .error & 1 ) mes "^777777You must be Level: "+.base_level[0]+" - "+.base_level[1]+"^000000";
	break;
	}
	
setarray .base_level,120,175;

something like this

Edited by crazyarashi
fixed something
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  72
  • Reputation:   0
  • Joined:  07/29/17
  • Last Seen:  

13 minutes ago, crazyarashi said:

getpartymember .@party_id,2; for( set .@i, 0; .@i < $@partymembercount; set .@i,.@i+1 ) if( attachrid( $@partymemberaid[.@i] ) ){ if( BaseLevel < .base_level[0] || BaseLevel > .base_level[1] ) set .@error, .@error|1; if( .@fail ){ set .@name$, strcharinfo(0); break; if( .@name$ != "" && .@error ){ mes "^FF0000[ Failed ]^000000"; mes "^0055FF"+.@name$+"^000000, You cannot join right now."; mes " "; mes "^FF0000[ ERROR: ]^000000"; if( .error & 1 ) mes "^777777You must be Level: "+.base_level[0]+" - "+.base_level[1]+"^000000"; break; } setarray .base_level,120,175;

 could you show me where should i put this on my script above? , I am sry, I am inexperienced

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  763
  • Reputation:   227
  • Joined:  02/11/17
  • Last Seen:  

prontera,155,172,6	script	Mystic Instance::mainnpc	693,{

OnStart:
	set .@party_id, getcharid(1);
	set .@is_leader, ( getcharid(0) == getpartyleader(.@party_id,2) );
	set .@has_instance, $instance_at_id == getcharid(2);
	
		mes "[Worried Woman]";
		mes "Help me traveler..";
		next;
		mes "[Worried Woman]";
		mes "I beg you..please help me. My son... it's been a week. I am afraid if something bad happened on him.";
		switch( select( 
		( .@party_id && .@is_leader && !.@has_instance )?"Start Mystic Cave":"",
		( .@party_id && .@has_instance )?"Enter Mystic Cave":"",
		case 1:
			getpartymember .@party_id,2;
			if( .min_party_member >= 1 ){
				set .@origin, getcharid(3);
				for( set .@i, 0; .@i < $@partymembercount; set .@i,.@i+1 )
					if( attachrid( $@partymemberaid[.@i] ) ){
						set .@member_count, .@member_count + 1;
						if( BaseLevel < .base_level[0] || BaseLevel > .base_level[1] ) set .@fail, .@fail|1;
						if( .@fail ){
							set .@name$, strcharinfo(0);
							break;
						}
					}
				attachrid( .@origin );
			}
			
			for(set .@i,1; .@i<=getarraysize(.map$); set .@i,.@i+1)
			{
				if (getmapusers(instance_mapname(.map$[.@i], -1)) > 0) {
					mes "Another team is already in the Temple. I can't send you there, sorry.";
					close;
				}
			}
			
			if( .@name$ != "" && .@fail ){
				mes "^FF0000[ Failed ]^000000";
				mes "^0055FF"+.@name$+"^000000, You cannot join right now.";
				mes " ";
				mes "^FF0000[ Error: ]^000000";
				if( .@fail & 1 ) mes "^777777You must be Level: "+.base_level[0]+" - "+.base_level[1]+"^000000";
				break;
			}
			
			if (instance_check_party(.@party_id, .min_party_member, .base_level[0], .base_level[1]) == 0) {
				mes "^0055FF[ "+.instance_name$+" ]^000000";
				mes "Make or join a party with at least "+.min_party_member+" member and try again.";
				break;
			} else {
				set $instance_at, instance_create( .instance_name$ );
				if( $instance_at < 0 ) {
					mes "Mystic Cave creation failed.";
					mes "^0000FF"+.instance_name$+" ^000000- Creation Failed!";
					close;
				}
				mes "^0055FF[ "+.instance_name$+" ]^000000";
				mes "^0000FF"+.instance_name$+" ^000000 - Reserved";
				getpartymember .@party_id,2;
				for( set .@i, 0; .@i < $@partymembercount; set .@i,.@i+1 )
					if( attachrid( $@partymemberaid[.@i] ) ){
					mes "Instance Created";
					}
					attachrid( .@origin );
					donpcevent instance_npcname("mystic_cave")+"::OnInstanceInit"; <-- donnpcevent to start your instance script change the name to the npc of your liking
		case 2:
			if( has_instance( .map$[0] ) == "" ){
				mes "Mystic Cave doesnt exist for Party - "+getpartyname( .@party_id );
			}
			else{
			switch(instance_enter(.instance_name$)) {
				case IE_Unknown:
					mes "An unknown error has occurred.";
					close;
				case IE_Noinstance:
					mes "The memorial dungeon " + .instance_name$ + " does not exist.";
					mes "The party leader did not generate the cave yet.";
					close;
				case IE_NoParty:
					mes "You can enter the cave after making the party.";
					close;
				case IE_Good:
					mapannounce .map$[0], strcharinfo(0)+" from party, " +getpartyname( .@party_id )+", is entering the cave, "+.instance_name$+".",bc_map,"0x00ff99",FW_NORMAL,12;
					close;
				}
			}
			break;
			
OnInit:
	setarray .base_level,120,175;
	setarray .map$,"yourmap";
	set .map_size, getarraysize( .map$ );
	set .min_party_member, 1; //min party member
	set .instance_name$, "Mystic Cave";
	
yourmap,1,2,3 	script	mystic_cave	123,{ //Sample
OnInstanceInit:
	donpcevent instance_npcname( "firstnpc" )+"::OnEnable";
	}
	
yourmap,1,2,3	script	firstnpc	123,{
OnEnable:
	mes "Hello i need help please help me";

		

something like this maybe rushly made maybe have some mistakes

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