viewing paste Unknown #49951 | 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
// http://herc.ws/board/topic/15915-a-battleground-idea-d/
 
prontera,150,185,5      script  bg_assassination        1_F_MARIA,{
        if ( .start ) {
                mes "battleground in progress...";
                close;
        }
        .@it = queueiterator( .qid );
        for ( .@aid = qiget(.@it); qicheck(.@it); .@aid = qiget(.@it) ) {
                if ( .@aid == getcharid(CHAR_ID_ACCOUNT) ) {
                        mes "You already join the queue.";
                        qiclear .@it;
                        close;
                }
        }
        qiclear .@it;
        select "join";
        mes "you have to stick to this map";
        close2;
        queueadd .qid, getcharid(CHAR_ID_ACCOUNT);
        if ( queuesize(.qid) < .minplayer2start *2 ) {
                announce queuesize(.qid) +" players join", bc_npc | bc_area;
                end;
        }
        .start = true;
        .red = bg_create_team( "bat_c01", 53,128 );
        .blue = bg_create_team( "bat_c01", 146,56 );
        .qred = queue();
        .qblue = queue();
        queueopt .qred, QUEUEOPT_DEATH, strnpcinfo(NPC_NAME) +"::OnRedDead";
        queueopt .qred, QUEUEOPT_LOGOUT, strnpcinfo(NPC_NAME) +"::OnRedQuit";
        queueopt .qblue, QUEUEOPT_DEATH, strnpcinfo(NPC_NAME) +"::OnBlueDead";
        queueopt .qblue, QUEUEOPT_LOGOUT, strnpcinfo(NPC_NAME) +"::OnBlueQuit";
        .@it = queueiterator( .qid );
        while ( .@num = qiget(.@it) )
                .@aid[.@size++] = .@num;
        qiclear .@it;
        queuedel .qid;
        .qid = queue();
        queueopt .qid, QUEUEOPT_LOGOUT, strnpcinfo(0)+"::OnQuitRegister";
        queueopt .qid, QUEUEOPT_MAPCHANGE, strnpcinfo(0)+"::OnQuitRegister";
        callfunc "F_ShuffleNumbers", 0, .@size -1, .@r;
        for ( .@i = 0; .@i < .@size; ++.@i ) {
                bg_join_team ( .@i % 2 )? .red : .blue, .@aid[ .@r[.@i] ];
                queueadd ( .@i % 2 )? .qred : .qblue, .@aid[ .@r[.@i] ];
        }
        bg_updatescore "bat_c01", 0, 0;
        bg_warp .red, "bat_c01", 53,128;
        bg_warp .blue, "bat_c01", 146,56;
        queueopt .qred, QUEUEOPT_MAPCHANGE, strnpcinfo(NPC_NAME) +"::OnRedMapChange";
        queueopt .qblue, QUEUEOPT_MAPCHANGE, strnpcinfo(NPC_NAME) +"::OnBlueMapChange";
        setwall "bat_c01", 54,122, 6, DIR_NORTHEAST, 0, "bg_pvp_leader_red";
        setwall "bat_c01", 140,56, 6, DIR_NORTHEAST, 0, "bg_pvp_leader_blue";
        if ( !.skip ) sleep 10000;
        bg_updatescore "bat_c01", .score[ .red ], .score[ .blue ];
        while ( true ) {
                for ( .@i = 5; .@i > 0; --.@i ) {
                        mapannounce "bat_c01", "["+ .@i +"]", bc_map;
                        if ( !.skip ) sleep 1000;
                }
                if ( .score[ .red ] == .winningscore -1 && .score[ .blue ] == .winningscore -1 )
                        mapannounce "bat_c01", "Final Round start!", bc_map;
                else
                        mapannounce "bat_c01", "Round "+ ++.round +" start!", bc_map;
                callsub L_SetLeader, .qred, "Red";
                callsub L_SetLeader, .qblue, "Blue";
                detachrid;
                delwall "bg_pvp_leader_red";
                delwall "bg_pvp_leader_blue";
                if ( !.skip ) sleep .eventlasting * 1000;
                deletearray .leader_aid;
                bg_updatescore "bat_c01", .score[ .red ], .score[ .blue ];
                if ( .score[ .red ] == .winningscore || .score[ .blue ] == .winningscore || !.winside ) break;
                .winside = 0;
                if ( !.skip ) sleep 1000;
                bg_warp .red, "bat_c01", 53,128;
                bg_warp .blue, "bat_c01", 146,56;
                setwall "bat_c01", 54,122, 6, DIR_NORTHEAST, 0, "bg_pvp_leader_red";
                setwall "bat_c01", 140,56, 6, DIR_NORTHEAST, 0, "bg_pvp_leader_blue";
        }
        if ( .score[ .red ] > .score[ .blue ] ) {
                mapannounce "bat_c01", "- Red side wins !", bc_map;
                .@it = queueiterator( .qred );
                while ( .@aid = qiget(.@it) )
                        getitem .rewarditem[0], .rewarditem[1], .@aid;
                qiclear .@it;
        }
        else if ( .score[ .blue ] > .score[ .red ] ) {
                mapannounce "bat_c01", "- Blue side wins !", bc_map;
                .@it = queueiterator( .qblue );
                while ( .@aid = qiget(.@it) )
                        getitem .rewarditem[0], .rewarditem[1], .@aid;
                qiclear .@it;
        }
        else
                mapannounce "bat_c01", "Time Out. Aborting the match.", bc_map;
        sleep 5000;
        queuedel .qred;
        queuedel .qblue;
        bg_warp .red, "prontera", 145,182;
        bg_warp .blue, "prontera", 155,182;
        bg_destroy .red;
        bg_destroy .blue;
        .round = .winside = .skip = .start = 0;
        deletearray .score;
        end;
OnQuitRegister:
        queueremove .qid, getcharid(CHAR_ID_ACCOUNT);
        end;
OnInit:
        .minplayer2start = 1;      // minimum players to start (ex. if 3vs3, set to 3).
        .winningscore = 2;         // how many rounds to win
        .eventlasting    = 2*60;  // event duration before auto-reset (20 minutes * seconds)
        setarray .rewarditem[0],   // rewards for the winning team: <item>,<amount>,...
                501, 10;
 
        .qid = queue();
        queueopt .qid, QUEUEOPT_LOGOUT, strnpcinfo(0)+"::OnQuitRegister";
        queueopt .qid, QUEUEOPT_MAPCHANGE, strnpcinfo(0)+"::OnQuitRegister";
        end;
OnRedDead:  callsub L_Dead, .qred, "Red", .blue;
OnBlueDead: callsub L_Dead, .qblue, "Blue", .red;
L_Dead:
        if ( .leader_aid[ getarg(0) ] == getcharid(CHAR_ID_ACCOUNT) ) {
                if ( killerrid == getcharid(CHAR_ID_ACCOUNT) )
                        mapannounce "bat_c01", "The target ["+ strcharinfo(PC_NAME) +"] From "+ getarg(1) +" Team has suicide !", bc_map;
                else if ( killerrid )
                        mapannounce "bat_c01", "The target ["+ strcharinfo(PC_NAME) +"] From "+ getarg(1) +" Team has assassinated by ["+ rid2name(killerrid) +"] !", bc_map;
                else
                        mapannounce "bat_c01", "The target ["+ strcharinfo(PC_NAME) +"] From "+ getarg(1) +" Team has been killed !", bc_map;
                .winside = getarg(2);
                ++.score[ .winside ];
                awake strnpcinfo(0);
        }
        sleep2 1250;
        percentheal 100,100;
        end;
OnRedMapChange:  OnRedQuit:  callsub L_Quit, .red, "Red", .blue, .qred;
OnBlueMapChange: OnBlueQuit: callsub L_Quit, .blue, "Blue", .red, .qblue;
L_Quit:
        percentheal 100, 100;
        bg_leave;
        if ( !bg_get_data( getarg(0), 0 ) ) {
                mapannounce "bat_c01", "All "+ getarg(1) +" Team members has left the Game !", bc_map;
                .score[ getarg(2) ] = .winningscore;
                .skip = true;
                awake strnpcinfo(0);
        }
        else if ( .leader_aid[ getarg(3) ] == getcharid(CHAR_ID_ACCOUNT) ) {
                mapannounce "bat_c01", "The target ["+ strcharinfo(PC_NAME) +"] From "+ getarg(1) +" Team has left the Game !", bc_map;
                .winside = getarg(2);
                ++.score[ .winside ];
                awake strnpcinfo(0);
        }
        end;
L_SetLeader:
        .@it = queueiterator( getarg(0) );
        while ( .@num = qiget(.@it) )
                .@aid[.@c++] = .@num;
        qiclear .@it;
        .leader_aid[ getarg(0) ] = .@aid[ rand(.@c) ];
        attachrid .leader_aid[ getarg(0) ];
        addtimer 1, strnpcinfo(0) +"::OnSetTeam"+ getarg(1) +"Leader";
        return;
OnSetTeamRedLeader: callsub L_LeaderEffect, .qred, EF_RED_HIT;
OnSetTeamBlueLeader: callsub L_LeaderEffect, .qblue, EF_BLUE_HIT;
L_LeaderEffect:
        while ( .leader_aid[ getarg(0) ] == getcharid(CHAR_ID_ACCOUNT) ) {
                specialeffect getarg(1), AREA, getcharid(CHAR_ID_ACCOUNT);
                sleep2 1000;
        }
        end;
}
 
bat_c01 mapflag battleground    2
bat_c01 mapflag nosave  SavePoint
bat_c01 mapflag nowarp
bat_c01 mapflag nowarpto
bat_c01 mapflag noteleport
bat_c01 mapflag nomemo
bat_c01 mapflag nopenalty
bat_c01 mapflag nobranch
bat_c01 mapflag noicewall
Viewed 3071 times, submitted by Begin.