viewing paste kvm04 | 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 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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426
// ==============================================================================
// BattleGround System - KvM 1~59
// ==============================================================================
 
// Registration NPC's
// *********************************************************************
 
bat_room,113,227,4  script  Registration::KvM04R_Guillaume  418,{ // KvM Guillaume
    end;
 
OnInit:
    waitingroom "Battle Station Duel",1,"KvM04_BG::OnGuillaumeJoin",1;
    end;
    
OnEnterBG:
    set $@KvM04BG_id1, waitingroom2bg("bat_c04",53,128,0,"KvM04_BG::OnGuillaumeQuit","KvM04_BG::OnGuillaumeDie");
    end;
}
 
bat_room,113,204,0  script  Registration::KvM04R_Croix  414,{ // KvM Croix
    end;
 
OnInit:
    waitingroom "Battle Station Duel",1,"KvM04_BG::OnCroixJoin",1;
    end;
 
OnEnterBG:
    set $@KvM04BG_id2, waitingroom2bg("bat_c04",146,55,1,"KvM04_BG::OnCroixQuit","KvM04_BG::OnCroixDie");
    end;
}
 
// Light Effects
// *********************************************************************
 
bat_c04,54,123,0    script  #bat_c04a   111,{
    end;
 
OnKvM04LightA: misceffect 54; end;
OnKvM04LightB: misceffect 55; end;
OnKvM04LightC: misceffect 56; end;
}
 
bat_c04,56,125,0    duplicate(#bat_c04a)    #bat_c04b   111
bat_c04,58,127,0    duplicate(#bat_c04a)    #bat_c04c   111
bat_c04,141,56,0    duplicate(#bat_c04a)    #bat_c04d   111
bat_c04,143,58,0    duplicate(#bat_c04a)    #bat_c04e   111
bat_c04,145,60,0    duplicate(#bat_c04a)    #bat_c04f   111
 
// Battleground Engine
// *********************************************************************
 
-   script  KvM04_BG    -1,{
    end;
 
OnInit:
    setwall "bat_c04",54,122,6,7,0,"batc04wall_a";
    setwall "bat_c04",55,122,5,7,0,"batc04wall_b";
    setwall "bat_c04",140,56,6,7,0,"batc04wall_c";
    setwall "bat_c04",140,57,5,7,0,"batc04wall_d";
    disablenpc "TherapistKvM04a";
    disablenpc "TherapistKvM04b";
    disablenpc "VintenarKvM04a";
    disablenpc "VintenarKvM04b";
    end;
 
OnGuillaumeJoin:
OnCroixJoin:
    donpcevent "KvM04_BG::OnReadyCheck";
    end;
 
OnGuillaumeQuit:
    setquest 8506;
OnGuillaumeDie:
    if( $@KvM04BG == 2 )
    {
        getmapxy .@m$, .@x, .@y, 0;
        if( .@m$ != "bat_c04" || (.@x >= 50 && .@x <= 58 && .@y >= 123 && .@y <= 131) )
            end; // Killed/Logout on Cementery or outside the map?
 
        set .Guillaume_Count, .Guillaume_Count - 1;
        set .Croix_Score, .Croix_Score + 1;
        bg_updatescore "bat_c04",.Guillaume_Score,.Croix_Score;
        if( .Guillaume_Count < 1 ) donpcevent "KvM04_BG::OnCroixWin";
    }
    end;
 
OnCroixQuit:
    setquest 8506;
OnCroixDie:
    if( $@KvM04BG == 2 )
    {
        getmapxy .@m$, .@x, .@y, 0;
        if( .@m$ != "bat_c04" || (.@x >= 141 && .@x <= 149 && .@y >= 52 && .@y <= 60) )
            end; // Killed/Logout on Cementery or outside the map?
 
        set .Croix_Count, .Croix_Count - 1;
        set .Guillaume_Score, .Guillaume_Score + 1;
        bg_updatescore "bat_c04",.Guillaume_Score,.Croix_Score;
        if( .Croix_Count < 1 ) donpcevent "KvM04_BG::OnGuillaumeWin";
    }
    end;
 
OnReadyCheck:
    if( $@KvM04BG )
        end;
 
    if( gettime(3) < 16 || gettime(3) > 22 )
        end; // 4 to 11 p.m.
 
    if( set(.@Guillaume, getwaitingroomstate(6,"KvM04R_Guillaume")) > 0 )
        set $@KvM04_GU$, $@waitingroommembers$[0];
    if( set(.@Croix, getwaitingroomstate(6,"KvM04R_Croix")) > 0 )
        set $@KvM04_CU$, $@waitingroommembers$[0];
 
    if( .@Guillaume < 1 || .@Croix < 1 )
    { // Not enough players to start
        set .@Announce$, "Battleground -- Duel Arena [80-99] ";
        if( .@Guillaume )
            set .@Announce$, .@Announce$ + "<" + $@KvM04_GU$ + "> [G] VS [C] <       >";
        else if( .@Croix )
            set .@Announce$, .@Announce$ + "<       > [G] VS [C] <" + $@KvM04_CU$ + ">";
        else
            set .@Announce$, .@Announce$ + "The Duel Arena is available for players.";
 
        if( !agitcheck() && $@KvM_Flood < gettimetick(2) )
        {
            announce .@Announce$,0,0xDDA0DD;
            set $@KvM_Flood, gettimetick(2) + 15;
        }
        else
            mapannounce "bat_c04",.@Announce$,1,0xDDA0DD;
        end;
    }
 
    set $@KvM04BG, 1; // Starting
    donpcevent "KvM04R_Croix::OnEnterBG";
    donpcevent "KvM04R_Guillaume::OnEnterBG";
    donpcevent "KvM04_BG::OnStart";
    end;
 
OnStart:
    announce "Battleground -- Duel Arena [80-99] <" + $@KvM04_GU$ + "> [G] VS [C] <" + $@KvM04_CU$ + "> Started.",0,0xDDA0DD;
    enablenpc "TherapistKvM04a";
    enablenpc "TherapistKvM04b";
    disablenpc "VintenarKvM04a";
    disablenpc "VintenarKvM04b";
    set $@KvM04BG_Victory, 0;
    sleep 2000;
    // Warp Teams
    bg_warp $@KvM04BG_id1,"bat_c04",53,128;
    bg_warp $@KvM04BG_id2,"bat_c04",146,55;
    // ScoreBoard
    set .Guillaume_Score, 0;
    set .Croix_Score, 0;
    initnpctimer;
    end;
 
OnTimer5000:
    areapercentheal "bat_c04",50,123,58,131,100,100;
    areapercentheal "bat_c04",141,52,149,60,100,100;
    mapannounce "bat_c04","The Battle will start in 25 seconds!!",1,0xDDA0DD;
    end;
 
OnTimer26000:
    mapannounce "bat_c04","The Battle will start in 4 seconds!!",1,0xDDA0DD;
    end;
 
OnTimer27000:
    donpcevent "::OnKvM04LightA";
    end;
 
OnTimer28000:
    donpcevent "::OnKvM04LightB";
    end;
    
OnTimer29000:
    donpcevent "::OnKvM04LightC";
    end;
 
OnTimer30000:
    // Team Members
    set .Guillaume_Count, bg_get_data($@KvM04BG_id1, 0);
    set .Croix_Count, bg_get_data($@KvM04BG_id2, 0);
    if( .Guillaume_Count < 1 || .Croix_Count < 1 )
    {
        set $@KvM04BG_Victory, 3;
        set $@KvM04BG, 3;
        
        set .@Announce$, "Battleground -- Duel Arena [80-99] ";
        if( .Guillaume_Count < 1 && .Croix_Count < 1 )
            set .@Announce$, "<" + $@KvM04_GU$ + "> [G] VS [C] <" + $@KvM04_CU$ + "> Canceled.";
        else if( .Guillaume_Count < 1 )
            set .@Announce$, "<" + $@KvM04_CU$ + "> runs away from <" + $@KvM04_GU$ + ">...";
        else if( .Croix_Count < 1 )
            set .@Announce$, "<" + $@KvM04_GU$ + "> runs away from <" + $@KvM04_CU$ + ">...";
 
        announce .@Announce$,0,0xDDA0DD;
        stopnpctimer;
        sleep 2000;
        donpcevent "KvM04_BG::OnStop";
        end;
    }
 
    set $@KvM04BG, 2; // Playing
    areapercentheal "bat_c04",50,123,58,131,100,100;
    bg_warp $@KvM04BG_id1,"bat_c04",62,119;
    areapercentheal "bat_c04",141,52,149,60,100,100;
    bg_warp $@KvM04BG_id2,"bat_c04",137,64;
    end;
 
OnTimer32000:
    mapannounce "bat_c04","The Duel has begun!!",1,0xDDA0DD;
    end;
 
OnTimer300000:
    mapannounce "bat_c04","The Battle will ends in 30 seconds!!",1,0xDDA0DD;
    end;
 
OnTimer330000:
    if( .Croix_Count > .Guillaume_Count )
        donpcevent "KvM04_BG::OnCroixWin";
    else if( .Croix_Count < .Guillaume_Count )
        donpcevent "KvM04_BG::OnGuillaumeWin";
    else
    { // Draw Game
        set $@KvM04BG, 3;
        set $@KvM04BG_Victory, 3;
 
        stopnpctimer;
        sleep 2000;
        announce "Battleground -- Duel Arena [80-99] <" + $@KvM04_GU$ + "> [G] VS [C] <" + $@KvM04_CU$ + "> Draw Game.",0,0xDDA0DD;
        donpcevent "KvM04_BG::OnStop";
    }
    end;
 
OnGuillaumeWin:
    set $@KvM04BG, 3;
    set $@KvM04BG_Victory, 1;
    
    stopnpctimer;
    sleep 2000;
    announce "Battleground -- Duel Arena [80-99] <" + $@KvM04_GU$ + "> is the Winner. <" + $@KvM04_CU$ + "> lose.",0,0xDDA0DD;
    donpcevent "KvM04_BG::OnStop";
    end;
 
OnCroixWin:
    set $@KvM04BG, 3;
    set $@KvM04BG_Victory, 2;
 
    stopnpctimer;
    sleep 2000;
    announce "Battleground -- Duel Arena [80-99] <" + $@KvM04_CU$ + "> is the Winner. <" + $@KvM04_GU$ + "> lose.",0,0xDDA0DD;
    donpcevent "KvM04_BG::OnStop";
    end;
 
OnStop:
    disablenpc "TherapistKvM04a";
    disablenpc "TherapistKvM04b";
    enablenpc "VintenarKvM04a";
    enablenpc "VintenarKvM04b";
    // Warp Teams
    bg_warp $@KvM04BG_id1,"bat_c04",53,128;
    bg_warp $@KvM04BG_id2,"bat_c04",146,55;
    donpcevent "KvM04_BG_Out::OnBegin";
    end;
 
OnReset:
    stopnpctimer;
    stopnpctimer "KvM04_BG_Out";
    set .Croix_Count, 0;
    set .Guillaume_Count, 0;
    set .Croix_Score, 0;
    set .Guillaume_Score, 0;
    set $@KvM04_GU$, "";
    set $@KvM04_CU$, "";
    set $@KvM04BG_Victory, 0;
    if( $@KvM04BG_id1 ) { bg_destroy $@KvM04BG_id1; set $@KvM04BG_id1, 0; }
    if( $@KvM04BG_id2 ) { bg_destroy $@KvM04BG_id2; set $@KvM04BG_id2, 0; }
    disablenpc "TherapistKvM04a";
    disablenpc "TherapistKvM04b";
    disablenpc "VintenarKvM04a";
    disablenpc "VintenarKvM04b";
    sleep 1000;
    mapwarp "bat_c04","bat_room",155,150;
    sleep 2000;
    maprespawnguildid "bat_c04",0,3; // Just in case someone else
    bg_updatescore "bat_c04",0,0;
    sleep 2000;
    set $@KvM04BG, 0;
    donpcevent "KvM04_BG::OnReadyCheck"; // Maybe a game is ready to start
    end;
}
 
-   script  KvM04_BG_Out    -1,{
    end;
 
OnBegin:
    initnpctimer;
    end;
 
OnTimer3000:
    mapannounce "bat_c04","Duel Arena will close in 2 minutes!",1,0xDDA0DD;
    end;
OnTimer90000:
    mapannounce "bat_c04","Duel Arena will close in 30 seconds!",1,0xDDA0DD;
    end;
OnTimer110000:
    mapannounce "bat_c04","Duel Arena will close in 10 seconds!",1,0xDDA0DD;
    end;
OnTimer120000:
OnClock1600:
    donpcevent "KvM04_BG::OnReset";
    end;
}
 
// Battleground Therapist
// *********************************************************************
 
bat_c04,51,130,5    script  Therapist in battle::TherapistKvM04a    95,{
    mes "[Therapist in battle]";
    mes "Just close your eyes, and take a deep breathe.";
    mes "You can be free from pain.";
    specialeffect2 312;
    close;
}
 
bat_c04,148,53,1    script  Therapist in battle::TherapistKvM04b    95,{
    mes "[Therapist in battle]";
    mes "Just close your eyes, and take a deep breathe.";
    mes "You can be free from pain.";
    specialeffect2 312;
    close;
}
 
// Battleground rewards
// *********************************************************************
 
bat_c04,51,130,5    script  Guillaume Vintenar::VintenarKvM04a  419,{
    if( $@KvM04BG_Victory )
    {
        if( $@KvM04BG_Victory == 3 )
        {
            setquest 6025;
            bg_leave;
            warp "bat_room",155,150;
            end;
        }
        else if( $@KvM04BG_Victory == Bat_Team )
        { // Victory
            set .@Reward, 4;
            mes "[Swandery]";
            mes "Blessed Guillaume!!";
            mes "Let's enjoy our glorious victory!";
            mes "" + strcharinfo(0) + ", its a sign reflecting victory";
            close2;
        }
        else
        { // 
            set .@Reward, 1;
            mes "[Swandery]";
            mes "You lost, but you're dedicated to this battle.";
            mes "This is a reward for your great dedication by Guillaume Marollo!";
            mes "Just take this defeat a lesson, and later you would definitely learn.";
            close2;
        }
 
        setquest 6025;
        getitem 7773, .@Reward;
        bg_leave;
        warp "bat_room",155,150;
        end;
    }
    end;
}
 
bat_c04,148,53,1    script  Croix Vintenar::VintenarKvM04b  415,{
    if( $@KvM04BG_Victory )
    {
        if( $@KvM04BG_Victory == 3 )
        {
            setquest 6025;
            bg_leave;
            warp "bat_room",155,150;
            end;
        }
        else if( $@KvM04BG_Victory == Bat_Team )
        { // Victory
            set .@Reward, 4;
            mes "[Swandery]";
            mes "Blessed Croax!!";
            mes "Let's enjoy our glorious victory!";
            mes "" + strcharinfo(0) + ", its a sign reflecting victory";
            close2;
        }
        else
        { // 
            set .@Reward, 1;
            mes "[Swandery]";
            mes "Oh, " + strcharinfo(0) + ". Don't be sad.";
            mes "Even though we didn't win, we did our best.";
            mes "Please don't forget this battle. We can win the next.";
            close2;
        }
 
        setquest 6025;
        getitem 7773, .@Reward;
        bg_leave;
        warp "bat_room",155,150;
        end;
    }
    end;
}
 
// MapFlags
// *********************************************************************
 
bat_c04 mapflag battleground    2
bat_c04 mapflag nomemo
bat_c04 mapflag nosave  SavePoint
bat_c04 mapflag noteleport
bat_c04 mapflag nowarp
bat_c04 mapflag nowarpto
bat_c04 mapflag noreturn
bat_c04 mapflag nobranch
bat_c04 mapflag nopenalty
bat_c04 mapflag noemergencycall
Viewed 806 times, submitted by Guest.