viewing paste Unknown #21874 | Athena

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
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 (2000);
    mes "...";
    sleep2 (2000);;
    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 (450);
    specialeffect2 14;
    specialeffect2 587;
    sleep2 (200);
    
    .@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@cake",.@instance) == "" ) {
        instance_destroy( .@instance );
        dispbottom "Failed to instance yuno_fild02/Instance Name: 1@cake";
        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@cake",.@instance),92,189;
    end;
    case 2:
    mes "Alright then, come again another time!";
    close;
}
}
1@cake,90,189,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@cake";
 
    '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@cake"),94,190,"[ Farm Zone ] Resident",PORING,6,instance_npcname("FarmInstance#Ins")+"::OnFarmItem";
    monster instance_mapname("1@cake"),94,190,"[ 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;
}
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;
}
}
Viewed 999 times, submitted by Guest.