Jump to content
  • 0

Instance with multiple Instance names


Eross

Question


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

Hi ! I would like to ask if is it possible to have an array of Instance names (.@instance_name$)?? 

For example

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

	//if (!is_party_leader()) { mes .@name$; mes "You must be a party leader"; end;};
	mes .@name$;
	mes "Today's featured instance guild dungeon is [^000088"+.@instance_name$+"^000000]!";
	mes "What would you like to do?";
	next;
	switch(select(	"~ ^FF6900Create Instance^000000 -> 1,000,000 Z",
					"~ ^000088Enter Instance^000000 [^777777"+.@instance_name$+"^000000] -> 200,000 Z",
					"~ ^FF0000Destroy Current Instance^000000")) {
		case 1:
			if (#CD > gettimetick(2)) {
				mes .@name$;
				mes "You can create new instance after " + Time2Str(CD) + ".";
				end;
			}		
			if (!is_party_leader()) { mes .@name$; mes "Only party leader can create an instance."; end;};
			if (instance_picker > 0) {
				mes .@name$;
				mes "You have already created one. Kindly destroy instance before getting new one.";
				end;
			}
			callsub(OnCheckZenyCreate);
			#CD = gettimetick(2) + .@InstanceCooldown;
			instance_create(.@instance_name$, IM_PARTY);
			instance_picker = 1;	
			specialeffect2 75;			
			break;
		case 2:
			mes .@name$;
			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 .@name$;
			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 .@name$;
				mes "Kafra Card, Token of Siegfried or Flywing item or boxes on your inventory.";
				end;
			}
			
			switch(instance_enter(.@instance_name$)) {
				case IE_NOMEMBER:
					mes .@name$;
					mes "ERROR: Party not found.";
					break;
				case IE_NOINSTANCE:
					mes .@name$;
					mes "ERROR: Party does not have an instance.";
					break;
				case IE_OTHER:
					mes .@name$;
					mes "ERROR: Unknown error.";
					break;
				default:
					callsub(OnCheckZenyEntry);
					#CD = gettimetick(2) + .@InstanceCooldown;
					//announce "Player ["+strcharinfo(0)+"] has entered Guild Dungeon ["+.@instance_name$+"]!",BC_ALL;
					break;
			}
			break;
		case 3:
			if (instance_picker <= 0) {
				mes .@name$;
				mes "No current instance available to destroy.";
				end;
			}
			mes .@name$;
			mes "Are you sure you want to destroy ["+.@instance_name$+"] instance?";
			switch (select("I'm 100% sure!","No, cancel it!")) {
				case 1:
					dispbottom "["+.@instance_name$+"] instance has been destroyed.";
					instance_destroy(instance_id(IM_PARTY));
					specialeffect2 677;
					instance_picker = 0;
					break;
				case 2:
					end;
			}
	}
	close;
OnCheckZenyCreate:
	.@name$ = "["+strnpcinfo(0)+"]";
	if (Zeny < 1000000) {
		mes .@name$;
		mes "You don't have enough zeny to enter this instance.";
		end;
	}
	Zeny -= 1000000;
	return;
OnCheckZenyEntry:
	.@name$ = "["+strnpcinfo(0)+"]";
	if (Zeny < 200000) {
		mes .@name$;
		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 .@instance_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

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  159
  • Reputation:   58
  • Joined:  07/11/14
  • Last Seen:  

could you explain better?

Link to comment
Share on other sites

  • 0

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

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 .@Instance_Name$[0], "gld_dun01", "gld_dun02", "gld_dun03";

	switch (select("Create Instance", "Enter Instance", "Exit")) {
		case 1:
            set .@menu, select("Guild Dungeon 1","Guild Dungeon 2","Guild Dungeon 3");
            switch(.@menu) {
              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

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  159
  • Reputation:   58
  • Joined:  07/11/14
  • Last Seen:  

	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");
			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(!@menu_slt){ mes "instance not created..."; close; }
			instance_enter(.@Instance_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

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

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

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  159
  • Reputation:   58
  • Joined:  07/11/14
  • Last Seen:  

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