viewing paste topic/4438- bg_pvp_queue | 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
prontera,156,185,5  script  kjdhfkdjsf  100,{
    mes "wanna sign up";
    if ( select( "yes", "no" ) == 2 ) close;
    while ( .signup_aid[.@i] != getcharid(3) && .@i < .signup_count ) .@i++;
    if ( .@i < .signup_count ) {
        mes "you have already sign up in this event";
        close;
    }
    .signup_aid[ .signup_count ] = getcharid(3);
    .signup_count++;
    mes "You are now signed to the BG event";
//  .@i = 0; // DEBUG
//  while ( .signup_aid[.@i] ) {
//      .@signup_name$ = .@signup_name$ +","+ rid2name( .signup_aid[.@i] );
//      .@i++;
//  }
//  mes "[Debug] Currently have "+ .signup_count +" sign-in and they are "+ .@signup_name$;
    close2;
L_start:
    if ( .signup_count < .min2start *2 ) end;
    for ( .@i = 0; .@i < .signup_count; .@i++ ) {
        if ( attachrid( .signup_aid[.@i] ) ) {
            if ( strcharinfo(3) != strnpcinfo(4) ) { // player is no longer on this map
                deletearray .signup_aid[.@i], 1;
                .signup_count--;
                .@i--;
            }
        }
        else {
            deletearray .signup_aid[.@i], 1;
            .signup_count--;
            .@i--;
        }
    }
    if ( .start || .signup_count < .min2start *2 ) end;
    announce "event started", bc_all;
    .start = 1;
    .red = createbgid( "guild_vs3", 13,50, strnpcinfo(0)+"::OnredQuit", strnpcinfo(0)+"::OnredDead" );
    .blue = createbgid( "guild_vs3", 86,50, strnpcinfo(0)+"::OnblueQuit", strnpcinfo(0)+"::OnblueDead" );
    for ( .@i = 0; .@i < .min2start *2; .@i++ )
        setbgid ( .@i %2 )? .red : .blue, .signup_aid[.@i];
    deletearray .signup_aid, .min2start *2;
    .signup_count -= .min2start *2;
    bg_warp .red, "guild_vs3", 13,50;
    bg_warp .blue, "guild_vs3", 86,50;
    .score[1] = .score[2] = .startingscore;
    bg_updatescore "guild_vs3", .score[1], .score[2];
    sleep .eventlasting * 1000;
    if ( .start == 1 ) {
        if ( .score[1] == .score[2] )
            mapannounce "guild_vs3", "Draw !", bc_map;
        else if ( .score[1] > .score[2] ) {
            mapannounce "guild_vs3", " Red side wins !", bc_map;
            callsub L_reward, .red;
        }
        else if ( .score[1] < .score[2] ) {
            mapannounce "guild_vs3", " Blue side wins !", bc_map;
            callsub L_reward, .blue;
        }
    }
    bg_warp .red, "prontera", 155,182;
    bg_warp .blue, "prontera", 158,182;
    bg_destroy .red;
    bg_destroy .blue;
    .start = .score[1] = .score[2] = 0;
    goto L_start;
L_reward:
    getbgusers getarg(0);
    for ( .@i = 0; .@i < $@arenamembersnum; .@i++ )
        getitem 501, 1, $@arenamembers[.@i]; // item reward
    return;
OnredDead: callsub L_dead, 1;
OnblueDead: callsub L_dead, 2;
L_dead:
    .score[ getarg(0) ]--;
    bg_updatescore "guild_vs3", .score[1], .score[2];
    if ( !.score[ getarg(0) ] )
        awake strnpcinfo(0);
    sleep2 1250;
    percentheal 100,100;
    end;
OnredQuit: callsub L_quit, 1, .red;
OnblueQuit: callsub L_quit, 2, .blue;
L_quit:
    percentheal 100, 100;
    if ( bg_get_data( getarg(1), 0 ) ) end;
    .score[ getarg(0) ] = 0;
    awake strnpcinfo(0);
    end;
OnInit:
    .eventlasting = 30 * 60; // how long would the event last or it auto-reset. 30 *60 = 30 mins
    .min2start = 1; // minimum player to start. If 1vs1 (2 players to start), set to 1. If 2vs2 (4 players to start), set to 2.
    .startingscore = 5; // score at start
    end;
}
guild_vs3   mapflag battleground    2
guild_vs3   mapflag nosave  SavePoint
guild_vs3   mapflag nowarp
guild_vs3   mapflag nowarpto
guild_vs3   mapflag noteleport
guild_vs3   mapflag nomemo
guild_vs3   mapflag nopenalty
guild_vs3   mapflag nobranch
guild_vs3   mapflag noicewall
Viewed 1274 times, submitted by AnnieRuru.