viewing paste Unknown #57588 | Text

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 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 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
-   script  bg_pvp_round#control    -1,{
OnInit:
    .minplayer2start = 1; // number of players to start this event automatically
    .winningscore = 2; // how many rounds to win
    .eventlasting = 20*60; // event last 20 minutes or the system abort itself
    .registerlasting = 5*60; // 5 minutes to join
    setarray .rewardwin, 501,10, 502,5, 503,3; // reward to winning team
    setarray .rewardlose, 501,5, 502,3, 503,1; // reward to losing team
 
    .rewardwinsize = getarraysize( .rewardwin );
    .rewardlosesize = getarraysize( .rewardlose );
    .teamname$[1] = "Red";
    .teamname$[2] = "Blue";
    bindatcmd "bgpvp", strnpcinfo(0)+"::OnCommand", 99, 100;
    end;
OnCommand:
    if ( compare( .@atcmd_parameters$, "on" ) ) {
        if ( .start )
            dispbottom "Battle Ground DeathMatch System already started.";
        else
            goto L_Start;
    }
    else if ( compare( .@atcmd_parameters$, "off" ) ) {
        if ( !.start )
            dispbottom "Battle Ground DeathMatch System not yet start.";
        else {
            .gmname$ = strcharinfo(0);
            .start = 0;
            .skip = 1;
            awake strnpcinfo(0);
            end;
        }
    }
    else if ( !.start )
        dispbottom "Battle Ground DeathMatch System is currently not running.";
    dispbottom "Use "+ .@atcmd_command$ +" on to start the event.";
    dispbottom "Use "+ .@atcmd_command$ +" off to abort this event";
    end;
OnStart:
    if ( getwaitingroomstate( 0, .rednpcname$ ) < .minplayer2start || getwaitingroomstate( 0, .bluenpcname$ ) < .minplayer2start )
        announce "[ Battle Ground DeathMatch System ]  Blue Team : "+ getwaitingroomstate( 0, .bluenpcname$ ) + "/" + .minplayer2start + ". Red Team : "+ getwaitingroomstate( 0, .rednpcname$ ) + "/" + .minplayer2start, bc_all, 0x00CED1;
    else
        awake strnpcinfo(0);
    end;
OnClock0000:
OnClock0200:
OnClock0400:
OnClock0600:
OnClock0800:
OnClock1000:
OnClock1200:
OnClock1400:
OnClock1600:
OnClock1800:
OnClock2000:
OnClock2200:
L_Start:
    if ( .start ) end;
    announce "[ Battle Ground DeathMatch System ] Event is now Open ! Come to prontera to join !", bc_all, 0x00CED1;
    enablenpc .rednpcname$;
    enablenpc .bluenpcname$;
    donpcevent .rednpcname$ +"::OnStart";
    donpcevent .bluenpcname$ +"::OnStart";
    .start = 1;
    sleep .registerlasting * 1000;
    if ( !.start ) {
        delwaitingroom .rednpcname$;
        delwaitingroom .bluenpcname$;
        disablenpc .rednpcname$;
        disablenpc .bluenpcname$;
        announce "[ Battle Ground DeathMatch System ] "+ .gmname$ +" has aborted this Event !", bc_all, 0x00CED1;
        .skip = 0;
        end;
    }
    else if ( !getwaitingroomstate( 0, .rednpcname$ ) || !getwaitingroomstate( 0, .bluenpcname$ ) ) {
        delwaitingroom .rednpcname$;
        delwaitingroom .bluenpcname$;
        disablenpc .rednpcname$;
        disablenpc .bluenpcname$;
        announce "[ Battle Ground DeathMatch System ] One side has 0 player. Can not start the Event.", bc_all, 0x00CED1;
        .start = .skip = 0;
        end;
    }
    .start = 2;
    announce "[ Battle Ground DeathMatch System ]  Battleground has started", bc_all, 0x00CED1;
    .red = waitingroom2bg( "bat_b01", 61,150, strnpcinfo(0)+"::OnRedQuit", strnpcinfo(0)+"::OnRedDead", .rednpcname$ );
    copyarray .team1aid, $@arenamembers, $@arenamembersnum;
    .team1count = .life[1] = $@arenamembersnum;
    .blue = waitingroom2bg( "bat_b01", 327,150, strnpcinfo(0)+"::OnBlueQuit", strnpcinfo(0)+"::OnBlueDead", .bluenpcname$ );
    copyarray .team2aid, $@arenamembers, $@arenamembersnum;
    .team2count = .life[2] = $@arenamembersnum;
    delwaitingroom .rednpcname$;
    delwaitingroom .bluenpcname$;
    disablenpc .rednpcname$;
    disablenpc .bluenpcname$;
    callsub L_setwall;
    bg_updatescore "bat_b01", 0, 0;
    bg_warp .red, "bat_b01", 61,150;
    bg_warp .blue, "bat_b01", 327,150;
    sleep 4000 * !.skip;
    mapannounce "bat_b01", "Kill all opponent team to gain 1 point, score "+ .winningscore +" points to win !", 0;
    sleep 2000 * !.skip;
    while (1) {
        for ( .@i = 5; .@i > 0; .@i-- ) {
            mapannounce "bat_b01", "["+ .@i +"]", 0;
            sleep 1000 * !.skip;
        }
        if ( .score[1] == .winningscore -1 && .score[2] == .winningscore -1 )
            mapannounce "bat_b01", "Final Round start!", 0;
        else
            mapannounce "bat_b01", "Round "+ .round++ +" start!", 0;
        callsub L_delwall;
        .life[1] = .team1count;
        .life[2] = .team2count;
        sleep .eventlasting * 1000 * !.skip;
        bg_updatescore "bat_b01", .score[1], .score[2];
        if ( .score[1] == .winningscore || .score[2] == .winningscore || !.winside ) break;
        .winside = 0;
        sleep 5000 * !.skip;
        callsub L_make_player_move;
        bg_warp .red, "bat_b01", 61,150;
        bg_warp .blue, "bat_b01", 327,150;
        callsub L_setwall;
        sleep 1000 * !.skip;
    }
    if ( .winside ) {
        mapannounce "bat_b01", " "+ .teamname$[ .winside ] +" side wins !", bc_all;
        callsub L_reward, .winside, .rewardwin, .rewardwinsize;
        callsub L_reward, ( .winside == 1 )? 2:1, .rewardlose, .rewardlosesize;
    }
    else if ( .start )
        mapannounce "bat_b01", "[ Battle Ground DeathMatch System ] Time Out. Aborting the match.", bc_all;
    else
        mapannounce "bat_b01", "[ Battle Ground DeathMatch System ] "+ .gmname$ +" has aborted this Event !", bc_all, 0x00CED1;
    sleep 5000;
    callsub L_make_player_move;
    bg_warp .red, "prontera", 155,182;
    bg_warp .blue, "prontera", 158,182;
    bg_destroy .red;
    bg_destroy .blue;
    callsub L_delwall;
    deletearray .team1aid;
    deletearray .team2aid;
    .round = .winside = .skip = .score[1] = .score[2] = .team1count = .team2count = .life[1] = .life[2] = .start = 0;
    end;
L_reward:
    .@size = getarraysize( getd(".team"+ getarg(0) +"aid") );
    for ( .@i = 0; .@i < .@size; .@i++ )
        for ( .@j = 0; .@j < getarg(2); .@j += 2 )
            getitem getelementofarray( getarg(1), .@j ), getelementofarray( getarg(1), .@j +1 ), getd(".team"+ getarg(0) +"aid["+ .@i +"]" );
    return;
L_setwall:
    setwall "bat_b01", 58,153, 6, 6, 0, "bg_pvp_round_red_1";
    setwall "bat_b01", 64,153, 6, 4, 0, "bg_pvp_round_red_2";
    setwall "bat_b01", 64,147, 6, 2, 0, "bg_pvp_round_red_3";
    setwall "bat_b01", 58,147, 6, 0, 0, "bg_pvp_round_red_4";
    setwall "bat_b01", 324,153, 6, 6, 0, "bg_pvp_round_blue_1";
    setwall "bat_b01", 330,153, 6, 4, 0, "bg_pvp_round_blue_2";
    setwall "bat_b01", 330,147, 6, 2, 0, "bg_pvp_round_blue_3";
    setwall "bat_b01", 324,147, 6, 0, 0, "bg_pvp_round_blue_4";
    return;
L_delwall:
    delwall "bg_pvp_round_red_1";
    delwall "bg_pvp_round_red_2";
    delwall "bg_pvp_round_red_3";
    delwall "bg_pvp_round_red_4";
    delwall "bg_pvp_round_blue_1";
    delwall "bg_pvp_round_blue_2";
    delwall "bg_pvp_round_blue_3";
    delwall "bg_pvp_round_blue_4";
    return;
L_make_player_move:
    for ( .@j = 1; .@j <= 2; .@j++ ) {
        for ( .@i = 0; .@i < getd(".team"+ .@j +"count"); .@i++ ) {
            attachrid getd(".team"+ .@j +"aid["+ .@i +"]" );
            setoption Option_Xmas | Option_Invisible, 0;
            pcblockmove getcharid(3), 0;
        }
    }
    return;
OnRedQuit: callsub L_quit, 1, 2;
OnBlueQuit: callsub L_quit, 2, 1;
L_quit:
    percentheal 100, 100;
    setoption Option_Xmas | Option_Invisible, 0;
    pcblockmove getcharid(3), 0;
    while ( getd( ".team"+ getarg(0) +"aid["+ .@i +"]" ) != getcharid(3) && .@i < getd(".team"+ getarg(0) +"count") ) .@i++;
    deletearray getd( ".team"+ getarg(0) +"aid["+ .@i +"]" ), 1;
    setd ".team"+ getarg(0) +"count", getd(".team"+ getarg(0) +"count") -1;
    .life[ getarg(0) ]--;
    if ( !getd(".team"+ getarg(0) +"count") ) {
        mapannounce "bat_b01", "All "+ .teamname$[ getarg(0) ] +" team members has Quit !", bc_all, 0xff3333; // purposely use different color
        .score[ getarg(1) ] = .winningscore;
        .winside = getarg(1);
        .skip = 1;
        awake strnpcinfo(0);
    }
    else if ( !.life[ getarg(0) ] ) {
        .winside = getarg(1);
        mapannounce "bat_b01", " "+ .teamname$[ getarg(1) ] +" team has defeated the opponent team, "+ .teamname$[ getarg(1) ] +" team score a point !", bc_all;
        .score[ getarg(1) ]++;
        awake strnpcinfo(0);
    }
    end;
OnRedDead: callsub L_dead, 1, 2;
OnBlueDead: callsub L_dead, 2, 1;
L_dead:
    .life[ getarg(0) ]--;
    if ( !.life[ getarg(0) ] ) {
        .winside = getarg(1);
        mapannounce "bat_b01", " "+ .teamname$[ getarg(1) ] +" team has defeated the opponent team, "+ .teamname$[ getarg(1) ] +" team score a point !", bc_all;
        .score[ getarg(1) ]++;
        awake strnpcinfo(0);
    }
    sleep2 1250;
    percentheal 100,100;
    if ( getcharid(4) ) {
        setoption Option_Xmas | Option_Invisible, 1;
        pcblockmove getcharid(3), 1;
    }
    end;
}
 
prontera,155,182,5  script  Red side    100,{
    end;
OnInit:
    sleep 1;
    set getvariableofnpc( .rednpcname$, "bg_pvp_round#control" ), strnpcinfo(0);
    disablenpc strnpcinfo(0);
    end;
OnStart:
    waitingroom "Red side", getvariableofnpc( .minplayer2start, "bg_pvp_round#control" ) +1, "bg_pvp_round#control::OnStart", 1;
    end;
}
 
prontera,158,182,5  script  Blue side   100,{
    end;
OnInit:
    sleep 1;
    set getvariableofnpc( .bluenpcname$, "bg_pvp_round#control" ), strnpcinfo(0);
    disablenpc strnpcinfo(0);
    end;
OnStart:
    waitingroom "Blue side", getvariableofnpc( .minplayer2start, "bg_pvp_round#control" ) +1, "bg_pvp_round#control::OnStart", 1;
    end;
}
 
bat_b01 mapflag battleground    2
bat_b01 mapflag nosave  SavePoint
bat_b01 mapflag nowarp
bat_b01 mapflag nowarpto
bat_b01 mapflag noteleport
bat_b01 mapflag nomemo
bat_b01 mapflag nopenalty
bat_b01 mapflag nobranch
bat_b01 mapflag noicewall
Viewed 701 times, submitted by Guest.