prontera,160,162,4 script Farming Instance 630,{
if (#HuntRoomDelay == 0) {
callsub FARM_INSTANCE;
end;
}
if (#HuntRoomDelay < 1 ) {
set .last,#HuntRoomDelay - gettimetick(2);
set .@min, .last % ( 24 * 3600 ) % 3600 / (60);
mes "less than 1 min";
close;
} else if( #HuntRoomDelay > gettimetick(2) ) {
set .last,#HuntRoomDelay - gettimetick(2);
set .@min, .last % ( 24 * 3600 ) % 3600 / (60);
mes "Wait for ^FF0000"+.@min+" Minutes^000000.";
close;
}
FARM_INSTANCE:
#FarmHunt = 0;
.@md_namenpc$ = "[ ^551A8B Farming Instance ^000000 ]";
.@md_name$ = "Farming Instance";
mes .@md_namenpc$;
mes "Hello there "+strcharinfo(0)+".";
mes "I have something I want to tell you..";
next;
mes .@md_namenpc$;
mes "etc";
next;
mes .@md_namenpc$;
mes "etc";
next;
mes .@md_namenpc$;
switch(select("Yes, I want to farm: No thanks.")) {
case 1:
mes "Attempting to open the dimension gate to enter the realm of bountiful item farming.";
sleep2 (200);
mes "...";
sleep2 (200);;
mes "The gate is OPEN! Good luck on farming!";
mes "Watch as the rift engulfs you!";
specialeffect2 777;
announce "[Entering Farming Instance]",bc_self;
sleep2 (45);
specialeffect2 EF_HEALSP;
specialeffect2 EF_M05;
sleep2 (20);
.@instance = instance_create( .@md_name$, getcharid( 3 ), IOT_CHAR);
if( .@instance < 0 ) {
dispbottom "Instance Failed.";
end;
}
dispbottom "^0000ff" + .@md_name$ + "^000000- Attempting to create Farm Instance.";
if( instance_attachmap("1@def01",.@instance) == "" ) {
instance_destroy( .@instance );
dispbottom "Failed to instance yuno_fild02/Instance Name: 1@def01";
end;
}
dispbottom "^0000ff" + .@md_name$ + " attempt successful on Instance attach!";
instance_set_timeout( 3600, 300, .@instance );
instance_init( .@instance );
instance_attach .@instance;
'cid = getcharid(0);
'aid = getcharid(3);
// CK_cooldown = gettimetick(2) + 3600; // 1 hour cooldown
warp instance_mapname("1@def01",.@instance),50,50;
end;
case 2:
mes "Alright then, come again another time!";
close;
}
}
1@def01,45,50,1 script FarmInstance#Ins -1,{
OnInstanceInit:
.DelayMin = 1;
.MaxItemLimit = 3;
'FarmID1Rate = 50;
// Adding X Minutes of Delay before can go in again.
// Map that will be used in this Instance.
set .Map$,"1@def01";
'Farm_Count = 0;
'Farm_Start = 0;
if (!'Farm_Start) {
donpcevent instance_npcname("FarmInstance#Ins")+"::OnFarmStart";
'Farm_Start++;
end;
}
OnFarmStart:
instance_announce -1,"[Farming Instance] Enjoy farming some items!",bc_map;
monster instance_mapname("1@def01"),50,50,"[ Farm Zone ] Resident",PORING,6,instance_npcname("FarmInstance#Ins")+"::OnFarmItem";
monster instance_mapname("1@def01"),50,50,"[ Farm Zone ] Resident",PORING,6,instance_npcname("FarmInstance#Ins")+"::OnFarmItem";
end;
OnFarmItem:
if ( rand(100) < 'FarmID1Rate ) {
'FarmIDList = callfunc("F_Rand",1129,1222,1163,1357,1360,1522,1811,1410);
#FarmHunt++;
// dispbottom "You obtained an item! Congratulations!";
'Farm_Count++;
dispbottom "[ Farm Zone ] : Farmed "+#FarmHunt+" / "+.MaxItemLimit+" Items";
if( #FarmHunt >= .MaxItemLimit ) {
message strcharinfo(0),"Limit Reach , you may join again later.";
sleep2 500;
set #HuntRoomDelay,gettimetick(2) + ( .DelayMin * 60 );
warp "prontera",150,150;
instance_destroy();
end;
}
donpcevent instance_npcname("FarmInstance#Ins")+"::OnCountFarm";
getitem 'FarmIDList, 1;
} else {
dispbottom "Sorry, you didn't obtain an item! Keep farming!";
'Farm_Count++;
donpcevent instance_npcname("FarmInstance#Ins")+"::OnCountFarm";
end;
}
end;
/// YOUR PROBLEM IS DID NOT PUT AN end; HERE !!! AGAIN !! How many times I have to tell
/// you donpcevent to OnCountFarm, but there is no end; command here, so it read the next line through the label
OnCountFarm:
if ('Farm_Count >= 1) { // I SET THIS TO 1 TO QUICKLY TEST FARMING INSTANCE COMPLETED, which executes twice... D:
if( attachrid('aid) )
if( getcharid(0) == 'cid ) {
instance_announce -1,"[Farming Instance] Farming instance Completed.",bc_map;
set #HuntRoomDelay,gettimetick(2) + ( .DelayMin * 60 );
sleep2 5000;
instance_destroy();
end;
}
else
end;
}
}