viewing paste Unknown #25038 | 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
//===== rAthena Script =======================================
//= Battleground: PVP
//===== By: ==================================================
//= AnnieRuru
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
//= rAthena Project
//===== Description: =========================================
//= A simple battleground script:
//= Kill players from the other team.
//===== Additional Comments: =================================
//= 1.0 First version, edited. [Euphy]
//============================================================
 
-   script  bg_pvp#control  -1,{
OnInit:
    .minplayer2start = 2;      // minimum players to start (ex. if 3vs3, set to 3)
    .eventlasting    = 20*60;  // event duration before auto-reset (20 minutes * seconds)
    setarray .rewarditem[0],   // rewards for the winning team: <item>,<amount>,...
        501, 10;
    end;
OnStart:
    if ( getwaitingroomstate( 0, .rednpcname$ ) < .minplayer2start || getwaitingroomstate( 0, .bluenpcname$ ) < .minplayer2start )
        end;
 
    // create Battleground and teams
    .red = waitingroom2bg( "guild_vs3", 13,50, strnpcinfo(0)+"::OnRedQuit", strnpcinfo(0)+"::OnRedDead", .rednpcname$ );
    copyarray .team1aid, $@arenamembers, $@arenamembersnum;
    .team1count = .minplayer2start;
    .blue = waitingroom2bg( "guild_vs3", 86,50, strnpcinfo(0)+"::OnBlueQuit", strnpcinfo(0)+"::OnBlueDead", .bluenpcname$ );
    copyarray .team2aid, $@arenamembers, $@arenamembersnum;
    .team2count = .minplayer2start;
    delwaitingroom .rednpcname$;
    delwaitingroom .bluenpcname$;
    bg_warp .red, "guild_vs3", 13,50;
    bg_warp .blue, "guild_vs3", 86,50;
    .score[1] = .score[2] = .minplayer2start;
    bg_updatescore "guild_vs3", .score[1], .score[2];
 
    // match duration
    sleep .eventlasting * 1000;
 
    // end match, destroy Battleground, reset NPCs
    if ( .score[1] > .score[2] ) {
        mapannounce "guild_vs3", "- Red Team is victorious! -", bc_map;
        callsub L_Reward, 1;
    }
    else if ( .score[1] < .score[2] ) {
        mapannounce "guild_vs3", "- Blue Team is victorious! -", bc_map;
        callsub L_Reward, 2;
    }
    else
        mapannounce "guild_vs3", "- The match has ended in a draw! -", bc_map;
    bg_warp .red, "prontera",152,178;
    bg_warp .blue, "prontera",154,178;
    bg_destroy .red;
    bg_destroy .blue;
    donpcevent .rednpcname$ +"::OnStart";
    donpcevent .bluenpcname$ +"::OnStart";
    end;
 
L_Reward:
    for ( .@i = 0; .@i < getd(".team"+ getarg(0) +"count"); .@i++ )
        getitem .rewarditem[0], .rewarditem[1], getd(".team"+ getarg(0) +"aid["+ .@i +"]" );
    return;
 
// "OnDeath" event
OnRedDead:  callsub L_Dead, 1;
OnBlueDead: callsub L_Dead, 2;
L_Dead:
    .score[ getarg(0) ]--;
    bg_updatescore "guild_vs3", .score[1], .score[2];
    while ( getd( ".team"+ getarg(0) +"aid["+ .@i +"]" ) != getcharid(3) && .@i < getd(".team"+ getarg(0) +"count") ) .@i++;
    deletearray getd( ".team"+ getarg(0) +"aid["+ .@i +"]" ), 1;
    setd ".team"+ getarg(0) +"count", getd(".team"+ getarg(0) +"count") -1;
    bg_leave;
    if ( !.score[ getarg(0) ] )
        awake strnpcinfo(0);
    sleep2 1250;
    percentheal 100,100;
    end;
 
// "OnQuit" event
OnRedQuit:  callsub L_Quit, 1;
OnBlueQuit: callsub L_Quit, 2;
L_Quit:
    .score[ getarg(0) ]--;
    bg_updatescore "guild_vs3", .score[1], .score[2];
    percentheal 100, 100;
    while ( getd( ".team"+ getarg(0) +"aid["+ .@i +"]" ) != getcharid(3) && .@i < getd(".team"+ getarg(0) +"count") ) .@i++;
    deletearray getd( ".team"+ getarg(0) +"aid["+ .@i +"]" ), 1;
    setd ".team"+ getarg(0) +"count", getd(".team"+ getarg(0) +"count") -1;
    if ( !.score[ getarg(0) ] )
        awake strnpcinfo(0);
    end;
}
 
prontera,152,178,5  script  Red Team#bg_pvp 733,{
    end;
OnInit:
    sleep 1;
    set getvariableofnpc( .rednpcname$, "bg_pvp#control" ), strnpcinfo(0);
OnStart:
    waitingroom "Red Team", getvariableofnpc( .minplayer2start, "bg_pvp#control" ) +1, "bg_pvp#control::OnStart", getvariableofnpc( .minplayer2start, "bg_pvp#control" );
    end;
}
 
prontera,154,178,5  script  Blue Team#bg_pvp    734,{
    end;
OnInit:
    sleep 1;
    set getvariableofnpc( .bluenpcname$, "bg_pvp#control" ), strnpcinfo(0);
OnStart:
    waitingroom "Blue Team", getvariableofnpc( .minplayer2start, "bg_pvp#control" ) +1, "bg_pvp#control::OnStart", getvariableofnpc( .minplayer2start, "bg_pvp#control" );
    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 926 times, submitted by Guest.