viewing paste topic/4570- battleground sample | 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
prontera,154,185,5  script  Battleground Creation   100,{
    mes "blah";
    next;
    switch ( select( "Create a Battleground Team", "Join a Battleground Team", "Leave your Battleground Team", "List Battleground Teams members", "Destroy a Battleground Team" ) ) {
    .@size = getarraysize( .team );
    case 1:
        getmapxy .@map$, .@x, .@y, 1;
        .team[ .@size ] = createbgid( .@map$, .@x, .@y, "", strnpcinfo(0)+"::OnDie" );
        mes "A new battleground Team has created. ID = "+ .team[ .@size ];
        close;
    case 2:
        if ( !.@size ) {
            mes "there is no available team";
            close;
        }
        for ( .@i = 0; .@i < .@size; .@i++ )
            .@menu$ = .@menu$ + .team[.@i] +":";
        .@s = select( .@menu$ ) -1;
        .@value = setbgid( .team[.@s] );
        if ( .@value > 0 )
            mes "Successfully join a Team No."+ .team[.@s];
        else if ( .@value == -2 )
            mes "This battleground Team already FULL";
        else if ( .@value == -5 )
            mes "You already in this team";
        else
            mes "shouldn't display this message at all ... lol";
        close;
    case 3:
        if ( !getcharid(4) ) {
            mes "You don't have a Battleground team!";
            close;
        }
        bg_leave;
        mes "You have leave your Battleground Team";
        close;
    case 4:
        if ( !.@size ) {
            mes "there is no available team";
            close;
        }
        .@menu$ = "Your Team";
        for ( .@i = 0; .@i < .@size; .@i++ )
            .@menu$ = .@menu$ +":"+ .team[.@i];
        .@s = select( .@menu$ ) -2;
        if ( .@s == -1 ) {
            if ( !getcharid(4) ) {
                mes "You don't have a Battleground team!";
                close;
            }
            .@team = getcharid(4);
        }
        else
            .@team = .team[.@s];
        getbgusers .@team;
        for ( .@i = 0; .@i < $@arenamembersnum; .@i++ )
            mes ( .@i +1 )+". "+ rid2name( $@arenamembers[.@i] );
        close;
    case 5:
        if ( !.@size ) {
            mes "there is no available team";
            close;
        }
        .@menu$ = "Your Team";
        for ( .@i = 0; .@i < .@size; .@i++ )
            .@menu$ = .@menu$ +":"+ .team[.@i];
        .@s = select( .@menu$ ) -2;
        if ( .@s == -1 ) {
            if ( !getcharid(4) ) {
                mes "You don't have a Battleground team!";
                close;
            }
            .@s = 0; // search through the array .. use my trick
            while ( getcharid(4) != .team[.@s] && .@s < .@size ) .@s++;
        }       
        bg_destroy .team[.@s];
        mes "Battleground Team ID = "+ .team[.@s] +" has destroyed";
        deletearray .team[.@s], 1;
        close;
    }
    close; // shouldn't reach
OnDie:
    sleep2 1250;
    percentheal 100,100;
    end;
}
prontera    mapflag battleground
Viewed 1607 times, submitted by AnnieRuru.