Jump to content
  • 0
Eross

Instance with multiple Instance names

Question

Posted (edited)

Hi ! I would like to ask if is it possible to have an array of Instance names ([email protected]_name$)?? 

For example

//prontera,155,181,5	script	Guild Instance Officer	418,{
moc_para01,52,32,4	script	Guild Instance Officer 	418,{ 
	[email protected] = 28800;
	[email protected]$ = "["+strnpcinfo(0)+"]";
	setarray [email protected]_name$[0] = "gld_dun01","gld_dun02","gld_dun03","gld_dun04";

	//if (!is_party_leader()) { mes [email protected]$; mes "You must be a party leader"; end;};
	mes [email protected]$;
	mes "Today's featured instance guild dungeon is [^000088"[email protected]_name$+"^000000]!";
	mes "What would you like to do?";
	next;
	switch(select(	"~ ^FF6900Create Instance^000000 -> 1,000,000 Z",
					"~ ^000088Enter Instance^000000 [^777777"[email protected]_name$+"^000000] -> 200,000 Z",
					"~ ^FF0000Destroy Current Instance^000000")) {
		case 1:
			if (#CD > gettimetick(2)) {
				mes [email protected]$;
				mes "You can create new instance after " + Time2Str(CD) + ".";
				end;
			}		
			if (!is_party_leader()) { mes [email protected]$; mes "Only party leader can create an instance."; end;};
			if (instance_picker > 0) {
				mes [email protected]$;
				mes "You have already created one. Kindly destroy instance before getting new one.";
				end;
			}
			callsub(OnCheckZenyCreate);
			#CD = gettimetick(2) + [email protected];
			instance_create([email protected]_name$, IM_PARTY);
			instance_picker = 1;	
			specialeffect2 75;			
			break;
		case 2:
			mes [email protected]$;
			mes "^FF0000Please note that Token of^000000";
			mes "^FF0000Siegfried, Kafra Card^000000";
			mes "^FF0000infinite fly wing and any teleport^000000";
			mes "^FF0000skills are not allowed inside.^000000";
			next;
			mes [email protected]$;
			mes "Ah! I almost Forgot, all guild";
			mes "dungeons have two Bow and Sword Guardians.";
			next;
			if (select("Enter now","Cancel")==2) end;
			if ((countitem(40036) || countitem(12887) || countitem(40014) || countitem(12323) || countitem(40028) || countitem(6293) || countitem(40114) || countitem(12211) || countitem(40114) || countitem(40029) || countitem(13602) || countitem(14211) || countitem(13603) || countitem(14212) || countitem(12909) || countitem(14165) ||  countitem(7621) || countitem(13601) || countitem(14210) || countitem(13600) || countitem(14209) || countitem(12922) || countitem(14178)) > 0 ) {
				mes [email protected]$;
				mes "Kafra Card, Token of Siegfried or Flywing item or boxes on your inventory.";
				end;
			}
			
			switch(instance_enter([email protected]_name$)) {
				case IE_NOMEMBER:
					mes [email protected]$;
					mes "ERROR: Party not found.";
					break;
				case IE_NOINSTANCE:
					mes [email protected]$;
					mes "ERROR: Party does not have an instance.";
					break;
				case IE_OTHER:
					mes [email protected]$;
					mes "ERROR: Unknown error.";
					break;
				default:
					callsub(OnCheckZenyEntry);
					#CD = gettimetick(2) + [email protected];
					//announce "Player ["+strcharinfo(0)+"] has entered Guild Dungeon ["[email protected]_name$+"]!",BC_ALL;
					break;
			}
			break;
		case 3:
			if (instance_picker <= 0) {
				mes [email protected]$;
				mes "No current instance available to destroy.";
				end;
			}
			mes [email protected]$;
			mes "Are you sure you want to destroy ["[email protected]_name$+"] instance?";
			switch (select("I'm 100% sure!","No, cancel it!")) {
				case 1:
					dispbottom "["[email protected]_name$+"] instance has been destroyed.";
					instance_destroy(instance_id(IM_PARTY));
					specialeffect2 677;
					instance_picker = 0;
					break;
				case 2:
					end;
			}
	}
	close;
OnCheckZenyCreate:
	[email protected]$ = "["+strnpcinfo(0)+"]";
	if (Zeny < 1000000) {
		mes [email protected]$;
		mes "You don't have enough zeny to enter this instance.";
		end;
	}
	Zeny -= 1000000;
	return;
OnCheckZenyEntry:
	[email protected]$ = "["+strnpcinfo(0)+"]";
	if (Zeny < 200000) {
		mes [email protected]$;
		mes "You don't have enough zeny to enter this instance.";
		end;
	}
	Zeny -= 200000;
	return;	
	
//OnPCLogoutEvent:
//OnPCLoginEvent:
//OnPCDieEvent:
	//if (!IE_NOINSTANCE) end;
	//if (strcharinfo(3) != "gld_dun01" || strcharinfo(3) != "gld_dun02" || strcharinfo(3) != "gld_dun03" || strcharinfo(3) != "gld_dun04" || strcharinfo(3) != "schg_dun01" || strcharinfo(3) != "arug_dun01") end;	
	//instance_announce('instance_id,"A party member has died! You have 5 minutes to resurect or the instance will be destroyed.",0);
	
	//instance_destroy(instance_id(IM_PARTY));
	//instance_picker = 0;
	//end;
}

If yes, how does the NPC recognize your chosen instance after creating instance and leaving npc ??? 

Quote

setarray [email protected]_name$[0] = "gld_dun01","gld_dun02","gld_dun03","gld_dun04";

This post is related to my last topic .. 

I hope someone help me agan. thanks

Edited by Eross
Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0
Posted (edited)
4 hours ago, Hyroshima said:

could you explain better?

Hi ! what i mean is , is it possible to have multiple instances in one npc ?? like for example I have the gld_dun01 gld_dun02 ~ 03 instances ?
I mean , I want to make an NPC like this sir .. I have codes below , problems are noted with // .. Thankyou!

 

	setarray [email protected]_Name$[0], "gld_dun01", "gld_dun02", "gld_dun03";

	switch (select("Create Instance", "Enter Instance", "Exit")) {
		case 1:
            set [email protected], select("Guild Dungeon 1","Guild Dungeon 2","Guild Dungeon 3");
            switch([email protected]) {
              case 1:
                  <create instance for gld01>
                    break;
              case 2:
                   <create instance for gld02>
                     break;
              case 3:
                   <create instance for gld03> 
                  break;
            }
       //NOW AFTER THE PLAYER CREATES INSTANCE THE NPC WILL THEN CLOSE DIALOGUE AND THE PLAYER WILL BE UNATTACHED TO NPC.              
       //THE PROBLEM IS HERE IN CASE 2. MY QUESTION IS.... HOW WILL NPC REGNIZE YOUR CURRENT INSTANCE???
       case 2:
          switch(instance_enter( PROBLEM #2 COZ MY INSTANCE NAMES ARE IN ARRAY FORM.. HOW WILL THE NPC KNOW WHAT INSTANCE TO RUN AND TO WARP MY CHARACTER???))
             
	}

Because Ive noticed that instance npc like Endless tower has only 1 dedicated script/npc .. Im planning to make an NPC with many INSTANCES inside.. Please help thankyou ..

Edited by Eross
Link to comment
Share on other sites

  • 0
	setarray [email protected]_Name$[0], "gld_dun01", "gld_dun02", "gld_dun03";

	switch (select("Create Instance", "Enter Instance", "Exit")) {
		case 1:
			set @menu_slt, select("Guild Dungeon 1","Guild Dungeon 2","Guild Dungeon 3");
			switch(@menu_slt) {
				case 1:
					<create instance for gld01>
					break;
				case 2:
					<create instance for gld02>
					break;
				case 3:
					<create instance for gld03> 
					break;
			}
			
		//NOW AFTER THE PLAYER CREATES INSTANCE THE NPC WILL THEN CLOSE DIALOGUE AND THE PLAYER WILL BE UNATTACHED TO NPC.              
		//THE PROBLEM IS HERE IN CASE 2. MY QUESTION IS.... HOW WILL NPC REGNIZE YOUR CURRENT INSTANCE???
		case 2:
			if([email protected]_slt){ mes "instance not created..."; close; }
			instance_enter([email protected]_Name$[(@menu_slt-1)]);
			break;
	}
	end;

this might solve your problem, but you need to check if the instance was created before teleporting.

I did a generic check

  • Upvote 1
Link to comment
Share on other sites

  • 0

Hi sir this works good .. One more question .. What if my NPC for creating is different to the npc that will warp me to instance ??

Link to comment
Share on other sites

  • 0

then you use to create like this:

	setarray .@Instance_Name$[0], "gld_dun01", "gld_dun02", "gld_dun03";

	switch (select("Create Instance", "Enter Instance", "Exit")) {
		case 1:
			set @menu_slt, select("Guild Dungeon 1","Guild Dungeon 2","Guild Dungeon 3");
			set @myInstance$,.@Instance_Name$[(@menu_slt-1)];
			switch(@menu_slt) {
				case 1:
					<create instance for gld01>
					break;
				case 2:
					<create instance for gld02>
					break;
				case 3:
					<create instance for gld03> 
					break;
			}			
			
		//NOW AFTER THE PLAYER CREATES INSTANCE THE NPC WILL THEN CLOSE DIALOGUE AND THE PLAYER WILL BE UNATTACHED TO NPC.              
		//THE PROBLEM IS HERE IN CASE 2. MY QUESTION IS.... HOW WILL NPC REGNIZE YOUR CURRENT INSTANCE???
		case 2:
			if(@myInstance$ == ""){ mes "instance not created..."; close; }
			instance_enter(@myInstance$);
			set @myInstance$,"";
			break;
	}
	end;

that way you can use case 2 on another npc too.

 

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

Important Information

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