viewing paste [ Request ] Free for All | 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 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
// =============================
/* Free for All: http://herc.ws/board/topic/13863-rlast-man-standing-pvp-with-prize/
    ----------------------------
    by: Legend
    compatible w/: Hercules
    ----------------------------
    special thanks to:
    * Annieruru
    ----------------------------
    Description:
    * Free for all event like last man standing
    * Can be activated through command "@ffa"
    * Also can be activated every hour
    * You can set your own number of winners
    * Configurable settings (npc name, maps, minimum level to participate,
      maximum recognized winners, rewards, restricted jobs.)
    * Significant mapflags were set
*/
// =============================
 
prontera,156,157,4  script  Request#2   4_CAT_DOWN,{
    doevent "Request#2::OnMenu";
    end;
    
OnActivate: // activated by the GM
    if (agitcheck()) || (agitcheck2()){
        mes .npc$;
        mes "WoE is in progress.";
        close;
    }
    if (.checkffa > 0) {
        mes .npc$;
        mes "Event is in progress.";
        close;
    }
OnMinute00: // activated every hour
    if (agitcheck()) || (agitcheck2()) end;
    if (.checkffa > 0) end;
    .checkffa = 1;
    announce .npc$+": Registration for the event is now open for 3 minutes!",bc_all;
    initnpctimer;
    end;
        OnTimer150000:
            announce .npc$+": 30 seconds left before the registration will be closed.",bc_all;
            end;
            
        OnTimer180000:
            .checkffa = 2;
            if ( .psize <= .maxwin) {
                announce .npc$+": The Event has been cancelled! Not enough participants.",bc_all;
                callsub Reset_evt_stats;
                end;
            }
            announce .npc$+": Registration is now closed!",bc_all;
            end;
            
        OnTimer185000:
            mapannounce .pvpmap$,.npc$+": The Event will occur in a few moments!",bc_blue;
            end;
            
        OnTimer187000:
            mapannounce .pvpmap$,.npc$+": Get ready in 3!",bc_blue;
            end;
            
        OnTimer188000:
            mapannounce .pvpmap$,.npc$+": 2!",bc_blue;
            end;
            
        OnTimer189000:
            mapannounce .pvpmap$,.npc$+": 1!",bc_blue;
            end;
            
        OnTimer190000:
            stopnpctimer;
            mapannounce .pvpmap$,.npc$+": Good luck everyone!",bc_blue;
            setmapflag .pvpmap$, mf_pvp_noguild;
            removemapflag .pvpmap$, mf_noskill;
            pvpon .pvpmap$;
            end;
    
OnMenu:
    mes .npc$;
    mes "Good day "+strcharinfo(0)+"!";
    mes "How may I help you?";
    next;
    switch(select("Information:Join")){
        case 1:
            mes .npc$;
            mes "Minimum Base Level: ^FF0000"+.minblvl+"^000000";
            mes "Restricted Jobs:";
            for( .@z = 0; .@z < .rjsize; .@z++ ) {
                mes ( .@z +1 ) +". ^FF0000"+jobname (.resjob[.@z])+"^000000";
            }
            close;
        case 2:
            if (!.checkffa) {
                mes .npc$;
                mes "Event isn't activated, come back later.";
                close;
            }
            if (.checkffa == 2) {
                mes .npc$;
                mes "Event is in progress, come back later.";
                close;
            }
            if (BaseLevel < .minblvl) {
                mes .npc$;
                mes "You need to";
                mes "have ^FF0000"+.minblvl+"^000000 Base level or more than";
                mes "before you can participate.";
                close;
            }
            for( .@z = 0; .@z < .rjsize; .@z++ ) {
                if (Class == .resjob[.@z] ){
                    mes .npc$;
                    mes "Your job is restricted to join this event.";
                    close;
                }
            }
            sc_end SC_ALL;
            percentheal 100,100;
            warp .pvpmap$,0,0;
            .regaid[.psize] = getcharid(3);
            .psize++;
            end;
    }
    
OnPCDieEvent:
OnPCLogoutEvent:
    if (strcharinfo(3) != .pvpmap$) end;
    while (.regaid != getcharid(3) && .@i < .psize) .@i++;
    deletearray .regaid[.@i],1;
    .psize--;
    if (.psize > .maxwin) end;
    if (.checkffa > 0) {
        announce .npc$+": The Event is now over! We already have our winners!",bc_all;
            for (.@i = 0; .@i < .psize; ++.@i){
                getitem .ritem,.rcount,.regaid[.@i];
            }
    }
    callsub Reset_evt_stats;
    end;
    
Reset_evt_stats:
    removemapflag .pvpmap$, mf_pvp_noguild;
    setmapflag .pvpmap$, mf_noskill;
    pvpoff .pvpmap$;
    .checkffa = 0;
    deletearray .regaid;
    .psize = 0;
    mapwarp .pvpmap$,.extmap$,.extx,.exty,0;
    end;
    
OnInit:
    bindatcmd "ffa",strnpcinfo(3)+"::OnActivate",99,99;
    
// CONFIGURATION
    .npc$ = "[ Free for All ]"; // NPC name
    .pvpmap$ = "pvp_n_1-5"; // Set your FFA Map
    .minblvl = 99; // Set minimum base level who can enter
    .maxwin = 2; // Set the maximum winners
    .ritem = 7227; // Set the item id of the reward
        .rcount = 5; // Set reward amount
    .extmap$ = "prontera"; // Set exit map
        .extx = 150; // Exit map "x" coordinate
        .exty = 150; // Exit map "y" coordinate
    setarray .resjob[0], 0,4001; // This list serves as the restricted jobs
        .rjsize = getarraysize (.resjob); // DO NOT TOUCH THIS
        
// MAPFLAGS
    setmapflag .pvpmap$, mf_noskill;
    pvpoff .pvpmap$;
//---
    setmapflag .pvpmap$, mf_nowarpto;
    setmapflag .pvpmap$, mf_nocommand;
    setmapflag .pvpmap$, mf_nowarp;
    setmapflag .pvpmap$, mf_nosave;
    setmapflag .pvpmap$, mf_noteleport;
    setmapflag .pvpmap$, mf_nomemo;
    setmapflag .pvpmap$, mf_novending;
    setmapflag .pvpmap$, mf_nobranch;
    end;
}
Viewed 1464 times, submitted by Legend.