viewing paste rA115332-c bg_pvp_round | 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
-       script  custom_bg#control       -1,{
OnInit:
        set .minplayer2start, 1; // minimum player to start. 2vs2 = set to 2
        setarray .rewarditem,
                501,20, // reward to the winning team
                501,10; // reward to the losing team
        set .startingscore, 99; // score at start
        set .eventlasting, 120; // event last 120 seconds
        end;
OnStart:
        if ( getwaitingroomstate( 0, .red1npcname$ ) < .minplayer2start || getwaitingroomstate( 0, .blue1npcname$ ) < .minplayer2start )
                end;
        set .red1, waitingroom2bg( "bat_c01",53,128, strnpcinfo(0)+"::OnredQuit", strnpcinfo(0)+"::OnredDead", .red1npcname$ );
        copyarray .team1aid[.@i], $@arenamembers[.@i], $@arenamembersnum;
        set .blue1, waitingroom2bg( "bat_c01",146,56, strnpcinfo(0)+"::OnblueQuit", strnpcinfo(0)+"::OnblueDead", .blue1npcname$ );
        copyarray .team2aid[.@i], $@arenamembers[.@i], $@arenamembersnum;
        delwaitingroom .red1npcname$;
        delwaitingroom .blue1npcname$;
        disablenpc .red1npcname$;
        disablenpc .blue1npcname$;
        bg_warp .red1, "bat_c01", 53,128;
        bg_warp .blue1, "bat_c01", 146,56;
        set .score[1], .startingscore;
        set .score[2], .startingscore;
        bg_updatescore "bat_c01", .score[1], .score[2];
        sleep 5000;
        mapannounce "bat_c01", "[Clan War] : Clan with most kills within 2 mins wins!",0;
        set .time, gettimetick(2);
        callsub L_showdigitall, 0, 1;
        sleep .eventlasting * 1000;
        if ( .score[1] > .score[2] ) {
                mapannounce "bat_c01", "[Clan War] : The Troll Clan has won the war!", 0;
                callsub L_reward, 1, 0;
                callsub L_reward, 2, 2;
        }
        else if ( .score[1] < .score[2] ) {
                mapannounce "bat_c01", "[Clan War] : The Fairy Clan has won the war!", 0;
                callsub L_reward, 2, 0;
                callsub L_reward, 1, 2;
        }
        else {
                mapannounce "bat_c01", "[Clan War] : The war has been declared draw!",0;
                callsub L_reward, 1, 2;
                callsub L_reward, 2, 2;
        }
        callsub L_showdigitall, gettimetick(2) - .time, 0;
        sleep 5000;
        bg_warp .red1, "prontera" ,150,190;
        bg_warp .blue1, "prontera" ,150,190;
        bg_destroy .red1;
        bg_destroy .blue1;
        enablenpc .red1npcname$;
        enablenpc .blue1npcname$;
        donpcevent .red1npcname$ +"::OnStart";
        donpcevent .blue1npcname$ +"::OnStart";
        end;
L_reward:
        set .@size, getarraysize( getd(".team"+ getarg(0) +"aid") );
        for ( set .@i, 0; .@i < .@size; set .@i, .@i +1 )
                if ( isloggedin( getd(".team"+ getarg(0) +"aid["+ .@i +"]" ) ) )
                        getitem .rewarditem[ getarg(1) ], .rewarditem[ getarg(1) +1 ], getd(".team"+ getarg(0) +"aid["+ .@i +"]" );
        return;
L_showdigitall:
        set .@size, getarraysize( .team1aid );
        for ( set .@i, 0; .@i < .@size; set .@i, .@i +1 ) {
                if ( isloggedin( .team1aid[.@i] ) ) {
                        attachrid .team1aid[.@i];
                        showdigit getarg(0), getarg(1);
                }
        }
        set .@size, getarraysize( .team2aid );
        for ( set .@i, 0; .@i < .@size; set .@i, .@i +1 ) {
                if ( isloggedin( .team2aid[.@i] ) ) {
                        attachrid .team2aid[.@i];
                        showdigit getarg(0), getarg(1);
                }
        }
        detachrid;
        return;
OnredDead: callsub L_dead, 1;
OnblueDead: callsub L_dead, 2;
L_dead:
        set .score[ getarg(0) ], .score[ getarg(0) ] -1;
        bg_updatescore "bat_c01", .score[1], .score[2];
        if ( .score[ getarg(0) ] == 0 )
                awake strnpcinfo(0);
        sleep2 1250;
        percentheal 100,100;
        end;
OnredQuit: callsub L_quit, 1, .red1;
OnblueQuit: callsub L_quit, 2, .blue1;
L_quit:
        percentheal 100,100;
        if ( bg_get_data( getarg(1), 0) ) end;
        set .score[ getarg(0) ], 0;
        awake strnpcinfo(0);
        end;
}
prontera,150,190,5      script  Troll Clan #custom_bg   468,{
        end;
OnInit:
        sleep 1;
        set getvariableofnpc( .red1npcname$, "custom_bg#control" ), strnpcinfo(0);
OnStart:
        waitingroom "Kill War", getvariableofnpc( .minplayer2start, "custom_bg#control" ) +1, strnpcinfo(0)+"::OnJoin",1;
        end;
OnJoin:
        announce "[Clan War] : Troll Clan side has ["+ getwaitingroomstate(0) +"/"+ getvariableofnpc( .minplayer2start, "custom_bg#control" ) +"] Users. ( Kill War )",0;
        donpcevent "custom_bg#control::OnStart";
        end;
}
prontera,155,190,5      script  Fairy Clan #custom_bg   435,{
        end;
OnInit:
        sleep 1;
        set getvariableofnpc( .blue1npcname$, "custom_bg#control" ), strnpcinfo(0);
OnStart:
        waitingroom "Kill War", getvariableofnpc( .minplayer2start, "custom_bg#control" ) +1, strnpcinfo(0)+"::OnJoin",1;
        end;
OnJoin:
        announce "[Clan War] : Fairy Clan side has ["+ getwaitingroomstate(0) +"/"+ getvariableofnpc( .minplayer2start, "custom_bg#control" ) +"] Users. ( Kill War )",0;
        donpcevent "custom_bg#control::OnStart";
        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 193 times, submitted by AnnieRuru.