viewing paste topic/4668- flag_pole_capture | Athena

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
prontera,150,190,4  script  test flag 1 722,{
    end;
OnInit:
    .tick = 1000; // 
    .areasize = 3; // the player has to stand in the .times * .tick mili-seconds in the .areasize area to capture this flag pole
    getmapxy .@map$, .@x, .@y, 1;
    while ( true ) {
        getmemberaid AREA, .@map$, .@x - .areasize, .@y - .areasize, .@x + .areasize, .@y + .areasize;
        for ( .@i = 0; .@i < $@onlinecount; .@i++ ) {
            attachrid $@onlineaid[.@i];
            mapannounce .@map$, strcharinfo(0) +" -> "+ strcharinfo(2), bc_map;
        }
        sleep .tick;
    }
    end; // shouldn't reach
}
 
//  =============================================================
 
prontera,160,190,4  script  test flag 2 722,{
    end;
OnInit:
    .tick = 1000; // 
    .areasize = 3; // the player has to stand in the .times * .tick mili-seconds in the .areasize area to capture this flag pole
    getmapxy .@map$, .@x, .@y, 1;
    while ( true ) {
        deletearray .@array_gid;
        deletearray .@array_inside;
        getmemberaid AREA, .@map$, .@x - .areasize, .@y - .areasize, .@x + .areasize, .@y + .areasize;
        for ( .@i = 0; .@i < $@onlinecount; .@i++ ) {
            attachrid $@onlineaid[.@i];
            .@j = 0;
            .@size = getarraysize( .@array_gid );
            while ( getcharid(2) != .@array_gid[.@j] && .@j < .@size ) .@j++;
            if ( .@j == .@size ) {
                .@array_gid[ .@size ] = getcharid(2);
                .@array_inside[ .@size ] = 1;
            }
            else
                .@array_inside[ .@j ]++;
        }
        .@size = getarraysize( .@array_gid );
        for ( .@i = 0; .@i < .@size; .@i++ ) {
            mapannounce .@map$, getguildname( .@array_gid[.@i] ) +" has "+ .@array_inside[.@i] +" players standing in", bc_map;
        }
        sleep .tick;
    }
    end; // shouldn't reach
}
 
//  ===================================================================
 
prontera,150,180,4  script  test flag 3 722,{
    if ( .gid )
        dispbottom "this current flag belongs to "+ getguildname( .gid );
    else
        dispbottom "nobody has claim this flag pole yet";
    end;
OnInit:
    .times = 2;
    .tick = 1000; // 
    .areasize = 3; // the player has to stand in the .times * .tick mili-seconds in the .areasize area to capture this flag pole
    getmapxy .@map$, .@x, .@y, 1;
    while ( true ) {
        deletearray .@array_gid;
        deletearray .@array_inside;
        getmemberaid AREA, .@map$, .@x - .areasize, .@y - .areasize, .@x + .areasize, .@y + .areasize;
        for ( .@i = 0; .@i < $@onlinecount; .@i++ ) {
            attachrid $@onlineaid[.@i];
            .@j = 0;
            .@size = getarraysize( .@array_gid );
            while ( getcharid(2) != .@array_gid[.@j] && .@j < .@size ) .@j++;
            if ( .@j == .@size ) {
                .@array_gid[ .@size ] = getcharid(2);
                .@array_inside[ .@size ] = 1;
            }
            else
                .@array_inside[ .@j ]++;
        }
        .@size = getarraysize( .@array_gid );
//      for ( .@i = 0; .@i < .@size; .@i++ )
//          mapannounce .@map$, getguildname( .@array_gid[ .@idx[.@i] ] ) +" has "+ .@array_inside[ .@idx[.@i] ] +" players standing in", bc_map;
//      announce "tesT "+  .@size +" "+ .@array_gid +" "+ .@high_gid +" "+ .@high_count, 0;
        if ( .@size > 1 )
            .@high_count = 0;       
        else if ( .@size == 1 ) {
            if ( .@array_gid != .@high_gid ) {
                .@high_gid = .@array_gid;
                .@high_count = 0;
            }
            .@high_count++;
            if ( .@high_count == .times && .gid != .@high_gid ) {
                .gid = .@high_gid;
                flagemblem .@high_gid;
                mapannounce .@map$, getguildname( .@high_gid ) +" has capture this flag pole", bc_map;
            }
        }
        sleep .tick;
    }
    end; // shouldn't reach
}
Viewed 1404 times, submitted by AnnieRuru.