Jump to content

  •  

Photo

need help on Instance script


  • Please log in to reply
1 reply to this topic

#1 ace9010

ace9010

    Advanced Member

  • Members
  • PipPipPip
  • 32 posts

Posted 18 June 2016 - 07:36 PM

new_3-1,44,109,5	script	Instance	120,{
	.@instance$ = "Instance Name ";

	if (instance_id()) {
		mes "[ Instance]";
		mes "You are already part of an instance.";
		next;
		switch(select("Enter Instance.:Cancel.")) {
		case 1:
			break;
		case 2:
			mes "[ Instance]";
			mes "You don't want to try again?";
			emotion e_sob;
			close;
		}
	} else {
		mes "[Instance]";
		mes "Would you like to try the Instance in You Map?";
		next;
		switch(select("Create Instance.:Cancel.")) {
		case 1:
			set .@instance, instance_create("instanced", getcharid(1));
			if (.@create < 0) {
				mes "[Instance]";
				switch (.@create) {
					case -1: mes "ERROR: Invalid type."; break;
					case -2: mes "ERROR: Party not found."; break;
					case -3: mes "ERROR: Instance already exists."; break;
					case -4: mes "ERROR: No free instances."; break;
				}
				mes " ";
				mes "Instance creation ^FF0000failed^000000.";
				emotion e_omg;
				close;
			}
			mes "[Instance]";
			mes "Instance created.";
			mes " ";
			mes "Now entering the instance...";
			next;
			break;
		case 2:
			mes "[Instance]";
			mes "Okay. Maybe next time!";
			close;
		}
	}
	.@enter = instance_enter;
	if (.@enter != 0) {
		mes "[Instance]";
		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;
}

// Instance Scripts
//============================================================
new_3-1,130,114,1	script	Instance NPC#start	999,{
	mes "[Instance NPC]";
	mes "Are you ready to begin?";
	next;
	switch(select("Yes.:No.")) {
	case 1:
		mes "[Instance NPC]";
		mes "Good luck.";
		close2;
		donpcevent instance_npcname("#ins_new_3-1name_mobs")+"::OnEnable";
		delwaitingroom;
		disablenpc instance_npcname(strnpcinfo(0));
		end;
	case 2:
		mes "[Instance NPC]";
		mes "Take your time.";
		close;
	}
	end;

OnInit:  
	disablenpc strnpcinfo(0);
	end;
OnInstanceInit:  
	disablenpc instance_npcname("NPC Name");
	waitingroom "Click here to start!",0;
	end;
}

new_3-1,0,0,0	script	#ins_new_3-1_mobs	-1,{
	end;
OnEnable:
	initnpctimer;
	end;
OnTimer1000: 
	mapannounce strnpcinfo(4),"Instance NPC: The Your instance has begun.",bc_all;
	end;
OnTimer4000:
	mapannounce strnpcinfo(4),"Instance NPC: Smash the Treasure Chest in the center of the map for a prize.",bc_all;
	end;
OnTimer5000:
	stopnpctimer;

	// spawn mobs
	.@map$        = instance_mapname("new_3-1");
	.@label$      = instance_npcname(strnpcinfo(0))+"::OnMyMobDead";
	.@label_boss$ = instance_npcname(strnpcinfo(0))+"::OnMyBossDead";
	monster .@map$,0,0,"Huge Poring",1002,20,.@label$,2;
	monster .@map$,0,0,"Huge Drops",1113,15,.@label$,2;
	monster .@map$,0,0,"Huge Poporing",1031,10,.@label$,2;
	monster .@map$,0,0,"Huge Marin",1242,10,.@label$,2;
	monster .@map$,0,0,"Tiny Zombie",1015,30,.@label$,1;
	monster .@map$,0,0,"Huge Mime Monkey",1585,2,.@label$,2;
	monster .@map$,135,97,"Treasure Chest",1732,1,.@label_boss$,2;
	end;
OnMyMobDead:  // normal mobs
	dispbottom "What am I doing? I should be attacking the Treasure Chest!";
	viewpoint 0,97,102,0,0xFF0000;
	switch (rand(6)) {  // for fun (:
		case 0: sc_start SC_STONE,5000,0; break;
		case 1: sc_start SC_FREEZE,5000,0; break;
		case 2: sc_start SC_STUN,5000,0; break;
		case 3: sc_start SC_SLEEP,5000,0; break;
		case 4: sc_start SC_CONFUSION,5000,0; break;
		case 5: sc_start SC_BLIND,5000,0; break;
	}
	end;
OnMyBossDead:  // treasure chest
	specialeffect2 EF_MVP;
	getitem 512,1;

	// trigger other events
	.@map$   = instance_mapname("new_3-1");
	.@label$ = instance_npcname(strnpcinfo(0))+"::OnMyMobDead";
	killmonster .@map$,.@label$;
	mapannounce .@map$,"Instance NPC: Good work! Please speak to me as soon as possible.",bc_all;
	donpcevent instance_npcname("Instance NPC#finish")+"::OnEnable";
	end;
}

new_3-1,149,85,4	script	Instance NPC#finish	101,{
	mes "[Instance NPC]";
	mes "Congratulations! You've finished the instance.";
	mes "I'll send you back to town now.";
	emotion e_no1;
	close2;
	warp "prontera",111,111;
	instance_destroy();
	end;

OnInit:
	disablenpc strnpcinfo(0);
	end;
OnInstanceInit:
	disablenpc instance_npcname(strnpcinfo(0));
	end;
OnEnable:
	enablenpc instance_npcname(strnpcinfo(0));
	specialeffect EF_HIDING;
	end;
}

new_3-1,124,110,6	script	#ins_new_3-1_warp	45,5,5,{
	end;
OnTouch:
	mes "Are you sure you want to leave?";
	next;
	switch(select("Leave.:Stay.")) {
	case 1:
		warp "prontera",156,191;
		break;
	case 2:
		warp strnpcinfo(4),160,155;
		break;
	}
	close;
OnInit:
	disablenpc strnpcinfo(0);
	end;
}

 unable move to next step 


Edited by ace9010, 18 June 2016 - 07:36 PM.


#2 Alayne

Alayne

    Advanced Member

  • Members
  • PipPipPip
  • 213 posts

Posted 12 July 2016 - 09:38 AM

That's a bit blurry...Can you describe a bit more your problem?






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users


This topic has been visited by 36 user(s)