Here's a small example of instancing Prontera.
10,Instanced Prontera,3600,prontera,155,150,prontera
prontera,150,150,0 script Instanced Prontera#a 101,{
set .@instance$, "Instanced Prontera";
if (instance_id()) {
if (select("Enter Instance.:Cancel.") == 2) end;
if (instance_enter(.@instance$) != 0) {
mes "Instance entrance ^FF0000failed^000000.";
close;
}
} else {
if (select("Create Instance.:Cancel.") == 2) end;
if (instance_create(.@instance$) < 0) {
mes "Instance creation ^FF0000failed^000000.";
close;
}
mes "Instance created.";
close2;
instance_enter(.@instance$);
}
end;
OnInstanceInit:
disablenpc instance_npcname(strnpcinfo(0));
end;
}
prontera,150,150,0 script Instanced Prontera#b 101,{
if (.Finished) {
specialeffect2 EF_MVP;
getitem 512,1;
dispbottom "Congratulations!";
instance_destroy;
end;
}
mes "Are you ready to begin?";
next;
if(select("Yes.:No.") == 1) {
mes "Good luck.";
donpcevent instance_npcname("#ins_prontera_mobs")+"::OnEnable";
donpcevent instance_npcname(strnpcinfo(0))+"::OnDisable";
} else
mes "Take your time.";
close;
OnInstanceInit:
enablenpc instance_npcname(strnpcinfo(0));
set .Finished,0;
waitingroom "Click me!",0;
end;
OnDisable:
disablenpc instance_npcname(strnpcinfo(0));
end;
OnEnable:
enablenpc instance_npcname(strnpcinfo(0));
set .Finished,1;
end;
OnInit:
disablenpc strnpcinfo(0);
end;
}
prontera,0,0,0 script #ins_prontera_mobs -1,{
OnEnable:
set .@map$, instance_mapname("prontera");
set .@label$, instance_npcname(strnpcinfo(0))+"::OnMyMobDead";
mapannounce .@map$,"Welcome to Instanced Prontera.",bc_all;
sleep 4000;
mapannounce .@map$,"Kill 50 monsters for a prize.",bc_all;
sleep 1000;
freeloop(1);
for(set .@j,0; .@j<10; set .@j,.@j+1) {
set .@size, query_sql("SELECT ID FROM `mob_db` WHERE left(Sprite, 4) != 'meta' AND left(Sprite, 2) != 'E_' AND ~Mode & 32 AND EXP > 0 AND MVP1id = 0 AND DropCardid > 4000 AND DropCardid < 5000 AND ID < 2000 ORDER BY rand() LIMIT 100", .@mob);
for(set .@i,0; .@i<.@size; set .@i,.@i+1)
monster .@map$,0,0,"--ja--",.@mob[.@i],1,.@label$;
set .MyMobCount, .MyMobCount + .@size;
}
freeloop(0);
end;
OnMyMobDead:
set .@map$, instance_mapname("prontera");
set .@label$, instance_npcname(strnpcinfo(0))+"::OnMyMobDead";
if (.MyMobCount - mobcount(.@map$,.@label$) >= 50) {
killmonster .@map$,.@label$;
mapannounce .@map$,"Congrats. We're done here! Please return to me as soon as possible.",bc_all;
donpcevent instance_npcname("Instanced Prontera#b")+"::OnEnable";
}
end;
}