viewing paste [Request] Farm Map | Athena

Posted on the | Last edited on
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
// =============================
/* Farming Map: http://herc.ws/board/topic/13874-farm-room-ticket/
    ----------------------------
    by: Legend
    compatible w/: Hercules
    ----------------------------
    Description:
    * Allows everyone to farm unto one map
    * Requires an item to be able to enter
    * Item can be obtain upon entering
    * Item expires after a specific time
    * When item expires, player warps to a certain map
    * When item expires, delay has been set according
      to your liking before you can enter again
    * Mapflags are set
    * Configurable settings
    * Certain checks are applied
*/
// =============================
 
prontera,156,165,4  script  Request#1   1_F_MARIA,{
    if (countitem(.iid) > 0) {
        if (!checkfarm) {
            mes .npc$;
            mes "Your "+getitemname(.iid)+" is not";
            mes "an authentic item and";
            mes "has not been registered";
            mes "to our system.";
            close;
        }
        mes .npc$;
        mes "Would you like to be warped";
        mes "back to the farming site?";
        next;
        if (select("Yes","No") != 2){
            warp .fm$,0,0;
            end;
        }
        close;
    }
    if ( delay > gettimetick(2) ){
        mes .npc$;
        mes "You must wait "+(delay - gettimetick(2))+" seconds";
        mes "before you can enter again.";
        close;
    }
    if (checkfarm) {
        mes .npc$;
        mes "Your time is currently";
        mes "running but you lost";
        mes "your ^FF0000"+getitemname(.iid)+"^000000 so,";
        mes "you need to wait until";
        mes "your time will run out.";
        close;
    }
    mes .npc$;
    mes "I am your Farming manager!";
    mes "How may I help you?";
    next;
    switch(select("Information:Farm Now!")){
        case 1:
            mes .npc$;
            mes "Welcome to Farming Zone!";
            mes "You will be able to obtain";
            mes "different kinds of items";
            mes "you need for your adventure.";
            next;
            mes .npc$;
            mes "Before you can enter inside,";
            mes "you will acquire^FF0000 1 "+getitemname(.iid)+"^000000";
            mes "and once you entered";
            mes "the farm zone, you will";
            mes "be given ^FF0000"+.t+" hour/s^000000 before "+getitemname(.iid)+" expires.";
            next;
            mes .npc$;
            mes "When "+getitemname(.iid)+" expires,";
            mes "you have ^FF0000"+.del+" seconds^000000 before";
            mes "you can enter again.";
            close;
            
        case 2:
            if (getmapusers(.fm$) >= .mp){
                mes .npc$;
                mes "You can no longer enter";
                mes "on the farming map,";
                mes "Max Count: ^00ff00"+.mp+"^000000";
                mes "Current: ^FF0000"+getmapusers(.fm$)+"^000000 players";
                close;
            }
            checkfarm = 1;
            .time = 1000*60*60*.t; // 1 hour
            message strcharinfo(0),"Good luck "+strcharinfo(0)+"!";
            addtimer .time, strnpcinfo(3)+"::OnTrigTime";
            getitem .iid,1;
            close2;
            sleep2 500;
            warp .fm$,0,0;
            end;
    }
    
OnTrigTime:
    announce .npc$+" : Times up! "+.t+" hour/s had passed!",bc_self;
    if (countitem(.iid) > 0) {
        delitem .iid,1;
        dispbottom "Farm ticket has been expired!";
    }
    checkfarm = 0;
    if (.del)
    delay = gettimetick(2) + .del;
        if (strcharinfo(3) == .fm$) {
            sleep2 500;
            warp .em$,.emx,.emy;
        }
    end;
    
OnInit:
// -- CONFIG --
    .npc$ = "[ Farm Manager ]"; // You can set your npc name here
    .mp = 99; // Max player count who can enter on the farm map || default (99) = 99 players
    .t = 1; // (HOUR) when the ticket expires || default (1) = 1 hour
    .del = 300; // (SECONDS) Delay after the ticket expires || default (300) = 15 minutes
    .iid = 7711; // Serves as the farm ticket || default (7711) = Event Ticket
    .fm$ = "morocc"; // Serves as the farming map
    .em$ = "prontera"; // Serves as the exit map
        .emx = 160; // Exit map "x" coordinate
        .emy = 160; // Exit map "y" coordinate
        
// -- set mapflag --
    setmapflag .fm$, mf_nomobloot;
    setmapflag .fm$, mf_nomvploot;
    setmapflag .fm$, mf_nowarpto;
    setmapflag .fm$, mf_nochat;
    setmapflag .fm$, mf_novending;
    setmapflag .fm$, mf_nocommand,60;
    setmapflag .fm$, mf_nojobexp;
    setmapflag .fm$, mf_nobaseexp;
    end;
}
Viewed 1297 times, submitted by Legend.