viewing paste Unknown #1368 | 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
-   script  bg_emp#control  -1,{
OnInit:
    setarray .rewarditem, 673, 5; // reward to the winning team
    set .winningscore, 2; // final score to win
    set .eventlasting, 1200; // abort the system if there's no progress, 1200 seconds = 20 mins
    sleep 1;
    disablenpc .rednpcname$;
    disablenpc .bluenpcname$;
    end;
    
OnTimer600000:
    if ( getwaitingroomstate( 0, .rednpcname$ ) < .minplayer2start || getwaitingroomstate( 0, .bluenpcname$ ) < .minplayer2start ){
        kickwaitingroomall .rednpcname$;
        kickwaitingroomall .bluenpcname$;
        delwaitingroom .rednpcname$;
        delwaitingroom .bluenpcname$;
        disablenpc .rednpcname$;
        disablenpc .bluenpcname$;
        announce "Event Aborted.",0;
    }
    end;
    
OnStart:
    initnpctimer;
    if ( getwaitingroomstate( 0, .rednpcname$ ) < .minplayer2start || getwaitingroomstate( 0, .bluenpcname$ ) < .minplayer2start ) end;
    stopnpctimer;
    set .red, waitingroom2bg( "bat_a01", 171,346, strnpcinfo(0)+"::OnRedQuit", strnpcinfo(0)+"::OnRedDead", .rednpcname$ );
    copyarray .team1aid, $@arenamembers, $@arenamembersnum;
    set .blue, waitingroom2bg( "bat_a01", 162,50, strnpcinfo(0)+"::OnBlueQuit", strnpcinfo(0)+"::OnBlueDead", .bluenpcname$ );
    copyarray .team2aid, $@arenamembers, $@arenamembersnum;
    delwaitingroom .rednpcname$;
    delwaitingroom .bluenpcname$;
    disablenpc .rednpcname$;
    disablenpc .bluenpcname$;
    bg_warp .red, "bat_a01", 171,346;
    bg_warp .blue, "bat_a01", 162,50;
    setwall "bat_a01", 154,51, 6, 4, 0, "bg_emp_town_blue";
    setwall "bat_a01", 164,347, 6, 4, 0, "bg_emp_town_red";
    bg_updatescore "bat_a01", 0, 0;
    sleep 6000; if ( .inprogress == 0 ) goto L_Abort;
    mapannounce "bat_a01", "Rules are simple. The first one to break the opponent's emperium will get a score.", 0;
    sleep 3000; if ( .inprogress == 0 ) goto L_Abort;
    mapannounce "bat_a01", "Score "+ .winningscore +" rounds to win ! ... GET READY", 0;
    sleep 2000; if ( .inprogress == 0 ) goto L_Abort;
    while (1) {
        for ( .@i = 5; .@i > 0; .@i-- ) {
            mapannounce "bat_a01", .@i +"", 0;
            sleep 1000; if ( .inprogress == 0 ) goto L_Abort;
        }
        if ( .score[1] == .winningscore -1 && .score[2] == .winningscore -1 )
            mapannounce "bat_a01", "Final Round start!", 0;
        else
            mapannounce "bat_a01", "Round "+ .round++ +" start!", 0;
        bg_monster .red,"bat_a01",171,346, "--ja--",1915, strnpcinfo(3)+"::OnRedDown";
        bg_monster .blue,"bat_a01",162,50, "--ja--",1914, strnpcinfo(3)+"::OnBlueDown";
        delwall "bg_emp_town_red";
        delwall "bg_emp_town_blue";
        sleep .eventlasting * 1000; if ( .inprogress == 0 ) goto L_Abort;
        .score[ .winside ]++;
        bg_updatescore "bat_a01", .score[1], .score[2];
        killmonster "bat_a01", strnpcinfo(3)+"::OnRedDown";
        killmonster "bat_a01", strnpcinfo(3)+"::OnBlueDown";
        if ( .winside )
            mapannounce "bat_a01", .empkiller$ +" has Destroy "+( ( .winside == 1 )?"Blue":"Red" )+"'s side Emperium. "+( ( .winside == 1 )?"Red":"Blue" )+" team score a point !", 0;
        if ( .score[1] == .winningscore || .score[2] == .winningscore || !.winside ) break;
        sleep 5000; if ( .inprogress == 0 ) goto L_Abort;
        bg_warp .red, "bat_a01", 171,346;
        bg_warp .blue, "bat_a01", 162,50;
        setwall "bat_a01", 154,51, 6, 4, 0, "bg_emp_town_blue";
        setwall "bat_a01", 164,347, 6, 4, 0, "bg_emp_town_red";
        .winside = 0;
    }
    if ( .winside ) {
        mapannounce "bat_a01", ( ( .winside == 1 )?"Red":"Blue" )+" side wins !", 0;
        .@size = getarraysize( getd(".team"+ .winside +"aid") );
        for ( .@i = 0; .@i < .@size; .@i++ )
            getitem .rewarditem[0], .rewarditem[1], getd(".team"+ .winside +"aid["+ .@i +"]" );
    } else
        mapannounce "bat_a01", "Time Out. Aborting the match.", 0;
    sleep 5000;
L_Abort:
    bg_warp .red, "prontera", 155,182;
    bg_warp .blue, "prontera", 158,182;
    bg_destroy .red;
    bg_destroy .blue;
    delwall "bg_emp_town_red";
    delwall "bg_emp_town_blue";
    .round = .winside = .score[0] = .score[1] = .inprogress = 0;
    end;
OnRedDown: callsub L_EmpDown, 2;
OnBlueDown: callsub L_EmpDown, 1;
L_EmpDown:
    .empkiller$ = strcharinfo(0);
    .winside = getarg(0);
    awake strnpcinfo(3);
OnRedDead:
OnBlueDead:
    end;
    
OnRedQuit: callsub L_RemoveUser,1;
OnBlueQuit: callsub L_RemoveUser,2;
L_RemoveUser:
    for( .@i = 0; .@i < getarraysize( getd(".team"+getarg(0)+"aid") ); .@i++ )
        if( getd(".team"+getarg(0)+"aid["+.@i+"]") == getcharid(3) ){
            deletearray getd(".team"+getarg(0)+"aid["+.@i+"]"),1;
            mapannounce "bat_a01",strcharinfo(0)+" logout",0;
            bg_leave;
        }
    if( !getarraysize( .team1aid ) || !getarraysize( .team2aid ) ){
        mapannounce "bat_a01","All Opponent Users Logout...Aborting Event....",0;
        sleep 3000;
        goto L_Abort;
    }
}
 
prontera,156,186,5  script  gm_start    100,{
    if ( getgmlevel() < 99 ) {
        mes "I only talk to gm";
        close;
    }
    if ( getvariableofnpc( .inprogress, "bg_emp#control" ) ) {
        mes "abort ?";
        next;
        if ( select ( "Yes", "No" ) == 2 ) close;
        awake "bg_emp#control";
        killmonster "bat_a01", strnpcinfo(3)+"::OnRedDown";
        killmonster "bat_a01", strnpcinfo(3)+"::OnBlueDown";
        delwaitingroom getvariableofnpc( .rednpcname$, "bg_emp#control" );
        delwaitingroom getvariableofnpc( .bluenpcname$, "bg_emp#control" );
        disablenpc getvariableofnpc( .rednpcname$, "bg_emp#control" );
        disablenpc getvariableofnpc( .bluenpcname$, "bg_emp#control" );
        announce strcharinfo(0) +" has abort the battleground", 0;
        close;
    }
    mes "select how many players to start";
    next;
    input .@a;
    if ( .@a == 0 || .@a > 30 ) close;
    set getvariableofnpc( .minplayer2start, "bg_emp#control" ), .@a;
    announce strcharinfo(0) +" has hosted "+ .@a +"vs"+ .@a +" battleground", 0;
    enablenpc getvariableofnpc( .rednpcname$, "bg_emp#control" );
    enablenpc getvariableofnpc( .bluenpcname$, "bg_emp#control" );
    donpcevent getvariableofnpc( .rednpcname$, "bg_emp#control" ) +"::OnStart";
    donpcevent getvariableofnpc( .bluenpcname$, "bg_emp#control" ) +"::OnStart";
    set getvariableofnpc( .inprogress, "bg_emp#control" ), 1;
    close;
}
 
prontera,155,182,5  script  Red side#bg_emp 100,{
    bg_leave;
    end;
OnStart:
    waitingroom "Red side", getvariableofnpc( .minplayer2start, "bg_emp#control" ) +1, "bg_emp#control::OnStart",1;
    end;
OnInit:
    set getvariableofnpc( .rednpcname$, "bg_emp#control" ), strnpcinfo(0);
    end;
}
 
prontera,158,182,5  script  Blue side#bg_emp    100,{
    bg_leave;
    end;
OnStart:
    waitingroom "Blue side", getvariableofnpc( .minplayer2start, "bg_emp#control" ) +1, "bg_emp#control::OnStart",1;
    end;
OnInit:
    set getvariableofnpc( .bluenpcname$, "bg_emp#control" ), strnpcinfo(0);
    end;
}
 
bat_a01 mapflag battleground    2
bat_a01 mapflag nosave  SavePoint
bat_a01 mapflag nowarp
bat_a01 mapflag nowarpto
bat_a01 mapflag noteleport
bat_a01 mapflag nomemo
bat_a01 mapflag nopenalty
bat_a01 mapflag nobranch
bat_a01 mapflag noicewall
Viewed 848 times, submitted by Guest.