viewing paste Event_Invasion_v1.5 | 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 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 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658
//===== Hercules Script ======================================
//= Invasion Event
//===== By: ==================================================
//= ZelosAvalon
//===== Current Version: =====================================
//= 1.5
//===== Description: =========================================
//= 1.0 Automatic invasion by random MVPs and Monsters in a random town with reward drop by MVP 
//  and points earn by each Event Monster killed by you. [ZelosAvalon]
//===== Additional Comments: =================================
//= 1.1 Now you can choose which MVP, Monster will spawned and what Reward 
//= the Event will give you, and which map you want to start the Invasion Event.
//= GM can stop the event any time, normal player can teleport to the map where's events running. [ZelosAvalon]
//= 1.2 Now you have two options by start Invasion Event:
//= Standard Invasion (where you have some options of Invasions pre-defined)
//= Custom Invasion (where you can choose which MVP, Monster and Reward the Event will give you, 
//= and which map you want to start the event). [ZelosAvalon]
//= 1.3 Now the event has added a limit for spawning monsters on each map, to prevent LAG.
//=     Maximum monster can be spawned is 500 and the minimum is 20. [ZelosAvalon]
//= 1.4 Now you have more two options in the event:
//= Current Configuration (where you can set in the Invasion Event the configuration for the next event)
//= Reset Configuration (where you can reset the Invasion Configuration set by you). [ZelosAvalon]
//= 1.5 Now we merge the event_points previously saved in a variable in the account (Ex:. #Event_Points) for a SQL table
//= Along with the SQL table added a new NPC: [Event Helper], where you can check how many Event Points you have, 
//= exchange them for items and check their position in the ranking of the event.[ZelosAvalon]
//============================================================
 
prontera,148,178,5  script  Event Invasion  8W_SOLDIER,{
 
set .GM,4;//GM Level to access the GM Menu. Default: 50
 
function Go {
    warp getarg(0),getarg(1,0),getarg(2,0);
    getmapxy(lastwarp$,lastwarpx,lastwarpy,0);
    end;
}
 
    // If a player clicks the NPC, it displays:
    if (getgmlevel()<.GM){
        if (.mobs_left) == 0{
        mes "[Event Invasion]";
        mes "We haven't monster invasion at the moment";
        mes "All the Cities in Rune Midgard are safe!";
        close;
        }
    mes "[Event Invasion]";
    mes "Help us!!! "+.mobs_left+" "+getmonsterinfo(.MobID,0)+" have invaded "+.Map$+"!";
    next;
    mes "You want, I teleport you to "+.Map$+"?";
        switch(select("Yes:No")) {
        case 1:
            mes "[Event Invasion]";
            mes "Teleporting ...";
            if (.Map$) == "prontera" {
            Go("prontera",155,183);
            }
            if (.Map$) == "alberta" {
            Go("alberta",28,234);
            }
            if (.Map$) == "aldebaran" {
            Go("aldebaran",140,131);
            }
            if (.Map$) == "amatsu" {
            Go("amatsu",198,84);
            }
            if (.Map$) == "ayothaya" {
            Go("ayothaya",208,166);
            }
            if (.Map$) == "brasilis" {
            Go("brasilis",196,217);
            }
            if (.Map$) == "comodo" {
            Go("comodo",209,143);
            }
            if (.Map$) == "dewata" {
            Go("dewata",200,180);
            }
            if (.Map$) == "ecl_in01" {
            Go("ecl_in01",48,53);
            }
            if (.Map$) == "einbech" {
            Go("einbech",63,35);
            }
            if (.Map$) == "einbroch" {
            Go("einbroch",64,200);
            }
            if (.Map$) == "dicastes01" {
            Go("dicastes01",198,187);
            }
            if (.Map$) == "geffen" {
            Go("geffen",119,59);
            }
            if (.Map$) == "gonryun" {
            Go("gonryun",160,120);
            }
            if (.Map$) == "hugel" {
            Go("hugel",96,145);
            }
            if (.Map$) == "izlude" {
            Go("izlude",128,114);
            }
            if (.Map$) == "jawaii" {
            Go("jawaii",251,132);
            }
            if (.Map$) == "lighthalzen" {
            Go("lighthalzen",158,92);
            }
            if (.Map$) == "louyang" {
            Go("louyang",217,100);
            }
            if (.Map$) == "xmas" {
            Go("xmas",147,134);
            }
            if (.Map$) == "malangdo" {
            Go("malangdo",140,114);
            }
            if (.Map$) == "malaya" {
            Go("malaya",212,206);
            }
            if (.Map$) == "manuk" {
            Go("manuk",282,138);
            }
            if (.Map$) == "mid_camp" {
            Go("mid_camp",210,288);
            }
            if (.Map$) == "mora" {
            Go("mora",55,146);
            }
            if (.Map$) == "morocc" {
            Go("morocc",156,93);
            }
            if (.Map$) == "moscovia" {
            Go("moscovia",223,184);
            }
            if (.Map$) == "nameless_n" {
            Go("nameless_n",256,215);
            }
            if (.Map$) == "niflheim" {
            Go("niflheim",202,174);
            }
            if (.Map$) == "payon" {
            Go("payon",179,100);
            }
            if (.Map$) == "rachel" {
            Go("rachel",130,110);
            }
            if (.Map$) == "splendide" {
            Go("splendide",201,147);
            }
            if (.Map$) == "thor_camp" {
            Go("thor_camp",246,68);
            }
            if (.Map$) == "umbala" {
            Go("umbala",97,153);
            }
            if (.Map$) == "veins" {
            Go("veins",216,123);
            }
            if (.Map$) == "yuno" {
            Go("yuno",157,51);
            }
        case 2:
            close;
        }
    }
    // GM menu 
    //It allows GMs Level 50 or more to Start and Stop invasions.
    if (getgmlevel()>.GM) {
        if (.mobs_left) {
            mes "[Event Invasion]";
            mes "An invasion is in progress..";
            mes "Location: " + .Map$;
            mes "^FF0000" +.mobs_left+ " : ^000000" + getmonsterinfo(.MobID,0) + " left ";
            mes " ";
            mes "^FF0000Stop invasion?^000000";
            if(select("No:Yes")==1) close;
            donpcevent "Event Invasion::OnEventEnd";
            next;
            mes "[Event Invasion]";
            mes "^FF0000Invasion has been stopped^000000";
            announce "The Invasion has been stopped by "+strcharinfo(0),bc_all;
            close;
        }
        Main:
        mes "[Event Invasion]";
        mes "Please customize the Invasion event before starting it.";
        mes "^FF0000Note - The MVP drops a event item.^000000";
        next;
            switch(select("^3355FFStandard Invasion^000000:^3355FFCustom Invasion^000000:^3355FFCurrent Configuration^000000:^3355FFReset Configuration^000000:^3355FFStart Invasion^000000:^FF0000Nothing now^000000")) {
            case 1:
            mes "[Event Invasion]";
            mes "Please choose the type of Invasion Event you want to start.";
            mes "^FF0000Note - The MVP drops a event item.^000000";
            next;
            switch(select("^3355FF1^000000 - ^FF0000Baphomet^000000:^3355FF2^000000 - ^FF0000Doppelganger^000000:^3355FF3^000000 - ^FF0000Eddga^000000:^3355FF4^000000 - ^FF0000Garm^000000:^3355FF5^000000 - ^FF0000Orc Hero^000000:^3355FF6^000000 - ^FF0000Osires^000000:^3355FF7^000000 - ^FF0000Turtle General^000000:^3355FFBack to Menu^000000")) {
                    case 1:
                        set .MvpID,"2100";
                        set .ItemID,"5518";
                        set .MobID,"1431";
                        mes "Map for Invasion?";
                        mes "Please choose the map for the Event:";
                        next;
                        goto SelectTown;
                        
                    case 2:
                        set .MvpID,"2098";
                        set .ItemID,"5151";
                        set .MobID,"1427";
                        mes "Map for Invasion?";
                        mes "Please choose the map for the Event:";
                        next;
                        goto SelectTown;
                        
                    case 3:
                        set .MvpID,"2095";
                        set .ItemID,"5497";
                        set .MobID,"1603";
                        mes "Map for Invasion?";
                        mes "Please choose the map for the Event:";
                        next;
                        goto SelectTown;
 
                    case 4:
                        set .MvpID,"1252";
                        set .ItemID,"5610";
                        set .MobID,"1606";
                        mes "Map for Invasion?";
                        mes "Please choose the map for the Event:";
                        goto SelectTown;
                        
                    case 5:
                        set .MvpID,"2094";
                        set .ItemID,"5375";
                        set .MobID,"1439";
                        mes "Map for Invasion?";
                        mes "Please choose the map for the Event:";
                        next;
                        goto SelectTown;
                        
                    case 6:
                        set .MvpID,"2096";
                        set .ItemID,"5490";
                        set .MobID,"1393";
                        mes "Map for Invasion?";
                        mes "Please choose the map for the Event:";
                        next;
                        goto SelectTown;
                        
                    case 7:
                        set .MvpID,"2105";
                        set .ItemID,"5611";
                        set .MobID,"1364";
                        mes "Map for Invasion?";
                        mes "Please choose the map for the Event:";
                        next;
                        goto SelectTown;
                    case 8:
                        goto Main;
                    }
            case 2:
            mes "[Event Invasion]";
            mes "Please customize the Invasion event before starting it.";
            mes "Note - The MVP drops a event item.";
            next;
                switch(select("^3355FFMap^000000 [^3CB371"+.Map$+"^000000]:^3355FFMVP^000000 [^3CB371"+getmonsterinfo(.MvpID,0)+"^000000]:^3355FFMVP Reward^000000 [^3CB371"+getitemname(.ItemID)+"^000000]:^3355FFMonster^000000 [^3CB371"+getmonsterinfo(.MobID,0)+"^000000]:^3355FFAmount of Monsters^000000 [^3CB371"+.MobX+"^000000]:^FF0000Start Event^000000:^3355FFBack to Menu^000000")) {
                    case 1:
                        mes "Map for Invasion?";
                        mes "Please choose the map for the Event:";
                        next;
                        switch(select("Prontera:Alberta:Aldebaran:Amatsu:Ayothaya:Brasilis:Comodo:Dewata:Eclage:Einbech:Einbroch:El Dicastes:Geffen:Gonryun:Hugel:Izlude:Jawaii:Lighthalzen:Louyang:Lutie:Malangdo:Malaya:Manuk:Midgarts Expedition Camp:Mora:Morroc:Moscovia:Nameless Island:Niflheim:Payon:Rachel:Splendide:Thor Camp:Umbala:Veins:Yuno")){
                        case 1: 
                        set .Map$,"prontera";
                        goto Main;
                        case 2: 
                        set .Map$,"alberta";
                        goto Main;
                        case 3: 
                        set .Map$,"aldebaran";
                        goto Main;
                        case 4: 
                        set .Map$,"amatsu";
                        goto Main;
                        case 5: 
                        set .Map$,"ayothaya";
                        goto Main;
                        case 6: 
                        set .Map$,"brasilis";
                        goto Main;
                        case 7: 
                        set .Map$,"comodo";
                        goto Main;
                        case 8: 
                        set .Map$,"dewata";
                        goto Main;
                        case 9: 
                        set .Map$,"eclage";
                        goto Main;
                        case 10: 
                        set .Map$,"einbech";
                        goto Main;
                        case 11: 
                        set .Map$,"einbroch";
                        goto Main;
                        case 12: 
                        set .Map$,"dicastes01";
                        goto Main;
                        case 13: 
                        set .Map$,"geffen";
                        goto Main;
                        case 14: 
                        set .Map$,"gonryun";
                        goto Main;
                        case 15: 
                        set .Map$,"hugel";
                        goto Main;
                        case 16: 
                        set .Map$,"izlude";
                        goto Main;
                        case 17: 
                        set .Map$,"jawaii";
                        goto Main;
                        case 18: 
                        set .Map$,"lighthalzen";
                        goto Main;
                        case 19: 
                        set .Map$,"louyang";
                        goto Main;
                        case 20: 
                        set .Map$,"xmas";
                        goto Main;
                        case 21: 
                        set .Map$,"malangdo";
                        goto Main;
                        case 22: 
                        set .Map$,"malaya";
                        goto Main;
                        case 23: 
                        set .Map$,"manuk";
                        goto Main;
                        case 24: 
                        set .Map$,"mid_camp";
                        goto Main;
                        case 25: 
                        set .Map$,"mora";
                        goto Main;
                        case 26: 
                        set .Map$,"morocc";
                        goto Main;
                        case 27: 
                        set .Map$,"moscovia";
                        goto Main;
                        case 28: 
                        set .Map$,"nameless_n";
                        goto Main;
                        case 29: 
                        set .Map$,"niflheim";
                        goto Main;
                        case 30: 
                        set .Map$,"payon";
                        goto Main;
                        case 31: 
                        set .Map$,"rachel";
                        goto Main;
                        case 32: 
                        set .Map$,"splendide";
                        goto Main;
                        case 33: 
                        set .Map$,"thor_camp";
                        goto Main;
                        case 34: 
                        set .Map$,"umbala";
                        goto Main;
                        case 35: 
                        set .Map$,"veins";
                        goto Main;
                        case 36: 
                        set .Map$,"yuno";
                        goto Main;
                        }
                    case 2:
                        mes "What MVP would you like to summom?";
                        mes "Please input the MVP ID:";
                        next;
                        input .MvpID;
                        goto Main;
                    case 3:
                        mes "Which item would you like the MVP to drop?";
                        mes "Please input the amount of monster you want to summon:";
                        next;
                        input .ItemID;
                        goto Main;
                    case 4:
                        mes "What monster would you like to summom ?";
                        mes "Please input the Monster ID:";
                        next;
                        input .MobID;
                        goto Main;
                    case 5:
                        mes "Who many monster would you like to summom ?";
                        mes "Please input the item ID:";
                        next;
                        input .MobX;
                        goto Main;
                    case 6:
                        mes "Starting the event now...";
                        close2;
                        goto OnStart;
                    case 7:
                    goto EventConf;
                    }
            case 3:
                goto EventConf;
            case 4:
                donpcevent "Event Invasion::OnCleanEvent";
                goto EventConf;
            case 5:
                mes "Starting the event now...";
                close2;
                goto OnStart;
            case 6:
                close;
        }
        end;
    
            /////////////////////////
            //The actual NPC Script//
            /////////////////////////
EventConf:
    mes "^7733ff[Event Configuration]^000000";
    mes "^3355FFMap:^000000 [^3CB371"+.Map$[0]+"^000000]";
    mes "^3355FFMVP:^000000 [^3CB371"+getmonsterinfo(.MvpID,0)+"^000000]";
    mes "^3355FFMVP Reward:^000000 [^3CB371"+getitemname(.ItemID)+"^000000]";
    mes "^3355FFMonster:^000000 [^3CB371"+getmonsterinfo(.MobID,0)+"^000000]";
    mes "^3355FFAmount of Monsters:^000000 [^3CB371"+.MobX+"^000000]";
    next;
    goto Main;
    end;
    
SelectTown:
switch(select("Prontera:Alberta:Aldebaran:Amatsu:Ayothaya:Brasilis:Comodo:Dewata:Eclage:Einbech:Einbroch:El Dicastes:Geffen:Gonryun:Hugel:Izlude:Jawaii:Lighthalzen:Louyang:Lutie:Malangdo:Malaya:Manuk:Midgarts Expedition Camp:Mora:Morroc:Moscovia:Nameless Island:Niflheim:Payon:Rachel:Splendide:Thor Camp:Umbala:Veins:Yuno")){
case 1: 
                        set .Map$,"prontera";
                        goto MonsterAmount;
                        case 2: 
                        set .Map$,"alberta";
                        goto MonsterAmount;
                        case 3: 
                        set .Map$,"aldebaran";
                        goto MonsterAmount;
                        case 4: 
                        set .Map$,"amatsu";
                        goto MonsterAmount;
                        case 5: 
                        set .Map$,"ayothaya";
                        goto MonsterAmount;
                        case 6: 
                        set .Map$,"brasilis";
                        goto MonsterAmount;
                        case 7: 
                        set .Map$,"comodo";
                        goto MonsterAmount;
                        case 8: 
                        set .Map$,"dewata";
                        goto MonsterAmount;
                        case 9: 
                        set .Map$,"eclage";
                        goto MonsterAmount;
                        case 10: 
                        set .Map$,"einbech";
                        goto MonsterAmount;
                        case 11: 
                        set .Map$,"einbroch";
                        goto MonsterAmount;
                        case 12: 
                        set .Map$,"dicastes01";
                        goto MonsterAmount;
                        case 13: 
                        set .Map$,"geffen";
                        goto MonsterAmount;
                        case 14: 
                        set .Map$,"gonryun";
                        goto MonsterAmount;
                        case 15: 
                        set .Map$,"hugel";
                        goto MonsterAmount;
                        case 16: 
                        set .Map$,"izlude";
                        goto MonsterAmount;
                        case 17: 
                        set .Map$,"jawaii";
                        goto MonsterAmount;
                        case 18: 
                        set .Map$,"lighthalzen";
                        goto MonsterAmount;
                        case 19: 
                        set .Map$,"louyang";
                        goto MonsterAmount;
                        case 20: 
                        set .Map$,"xmas";
                        goto MonsterAmount;
                        case 21: 
                        set .Map$,"malangdo";
                        goto MonsterAmount;
                        case 22: 
                        set .Map$,"malaya";
                        goto MonsterAmount;
                        case 23: 
                        set .Map$,"manuk";
                        goto MonsterAmount;
                        case 24: 
                        set .Map$,"mid_camp";
                        goto MonsterAmount;
                        case 25: 
                        set .Map$,"mora";
                        goto MonsterAmount;
                        case 26: 
                        set .Map$,"morocc";
                        goto MonsterAmount;
                        case 27: 
                        set .Map$,"moscovia";
                        goto MonsterAmount;
                        case 28: 
                        set .Map$,"nameless_n";
                        goto MonsterAmount;
                        case 29: 
                        set .Map$,"niflheim";
                        goto MonsterAmount;
                        case 30: 
                        set .Map$,"payon";
                        goto MonsterAmount;
                        case 31: 
                        set .Map$,"rachel";
                        goto MonsterAmount;
                        case 32: 
                        set .Map$,"splendide";
                        goto MonsterAmount;
                        case 33: 
                        set .Map$,"thor_camp";
                        goto MonsterAmount;
                        case 34: 
                        set .Map$,"umbala";
                        goto MonsterAmount;
                        case 35: 
                        set .Map$,"veins";
                        goto MonsterAmount;
                        case 36: 
                        set .Map$,"yuno";
                        goto MonsterAmount;
                        }
                        end;
// Times to Start and End of Event
OnClock0000: goto OnStart; //Start Event
OnClock0030: goto OnEventEnd; //End Event
end;
OnClock0800: goto OnStart; //Start Event
OnClock0830: goto OnEventEnd; //End Event
end;
OnClock1130: goto OnStart; //Start Event
OnClock1132: goto OnEventEnd; //End Event
end;;
OnClock1600: goto OnStart; //Start Event
OnClock1630: goto OnEventEnd; //End Event
end;
                                    
MonsterAmount: // Menu select amount of monster event will summon
    mes "Who many monster would you like to summom ?";
    mes "Please input the number of monster you want to summom:";
    mes "^FF0000NOTE: Event can summon a maximum of 500 Monsters^000000";
    next;
    input .MobX; 
        if (.MobX) > 500 {
        mes "^FF0000Event can't summon that amount of Monsters^000000";
        mes "^FF0000Event can summon a maximum of 500 Monsters^000000";
        next;
        goto MonsterAmount;
        }
        if (.MobX) < 20 {
        mes "^FF0000Event can't summon that amount of Monsters^000000";
        mes "^FF0000The minimum that can be summoned is 20 Monsters^000000";
        next;
        goto MonsterAmount;
        }
    goto OnEventStart;
    
OnEventStart: // Menu Start Event
    mes "[Event Invasion]";
    mes "^3355FFMap:^000000 [^3CB371"+.Map$[0]+"^000000]";
    mes "^3355FFMVP:^000000 [^3CB371"+getmonsterinfo(.MvpID,0)+"^000000]";
    mes "^3355FFMVP Reward:^000000 [^3CB371"+getitemname(.ItemID)+"^000000]";
    mes "^3355FFMonster:^000000 [^3CB371"+getmonsterinfo(.MobID,0)+"^000000]";
    mes "^3355FFAmount of Monsters:^000000 [^3CB371"+.MobX+"^000000]";
    mes "^FF0000Start Event now?^000000";
    switch(select("Yes:No")){
        case 1:
        next;
        mes "^FF0000Starting the event...^000000";
        close2;
        goto OnStart;
        case 2:
        next;
        mes "Ok, start just when you're sure!";
        close2;
        goto EventConf;
    }
    end;
    
OnStart:
    set .mobs_left, .MobX;
    sleep2 1000;
    announce "[ Rune-Midgard Guard ]: We have trouble here in the town " + .Map$ + "!", bc_all;
    sleep2 5000;
    announce "[ Rune-Midgard Guard ]: Everyone, we need your help to get rid of these "+getmonsterinfo(.MobID,0)+"!", bc_all;
    set .mobs_left, .MobX;
    monster .Map$,0,0,getmonsterinfo(.MobID,0) +" [Event] ",.MobID,.MobX,strnpcinfo(3) + "::OnMyMobDead";
    end;
    
OnEventEnd: // 30 minutes later, kills all the mobs.
    announce "[ Rune-Midgard Guard ]: The invasion was ended in the town " + .Map$ + "!", bc_all;
    killmonster .Map$,"Event Invasion::OnMyMobDead";
    killmonster .Map$,strnpcinfo(3) + "::OnSpecialMobDead";
    set .mobs_left,0;
    end;
 
OnStop: // When the event is stopped by a GM, or all monsters dead.
    killmonster .Map$,strnpcinfo(3) + "::OnMyMobDead";
    killmonster .Map$,strnpcinfo(3) + "::OnSpecialMobDead";
    announce "It seems that "+strcharinfo(0)+" has ended the Invasion!",bc_all;
    set .mobs_left,0;
    end;
 
OnMyMobDead: //When a Monster is killed
    set .mobs_left, .mobs_left-1;
    if (.mobs_left==0) {
        announce "[ Rune-Midgard Guard ]: "+getmonsterinfo(.MvpID,0)+" has spawned in " + .Map$ + "!", bc_all;
        monster .Map$,0,0,getmonsterinfo(.MvpID,0),.MvpID,1,"Event Invasion::OnSpecialMobDead";
    } else {
        query_sql "INSERT INTO `event_rank`(`id`, `name`, `event_points`, `t_event_points`) VALUES ('"+getcharid(0)+"','"+strcharinfo(0)+"','1','1') ON DUPLICATE KEY UPDATE `event_points` = `event_points` + '1', `t_event_points` = `t_event_points` + '1'";
        announce "["+.mobs_left+"/"+.MobX+"] Monster left.",bc_map;
    }
    end;
 
OnSpecialMobDead:
        query_sql "INSERT INTO `event_rank`(`id`, `name`, `event_points`, `t_event_points`) VALUES ('"+getcharid(0)+"','"+strcharinfo(0)+"','1','1') ON DUPLICATE KEY UPDATE `event_points` = `event_points` + '10', `t_event_points` = `t_event_points` + '10'";
        announce strcharinfo(0)+" has fought off the "+ getmonsterinfo(.MobID,0) +" Invasion and has been awarded a worthy prize!", bc_all;
        getitem .ItemID,1;
        donpcevent "Event Invasion::OnStop";
        donpcevent "Event Invasion::OnCleanEvent";
    end;
    
OnCleanEvent:
    set .MobX,0;
    set .Map$,"null";
    set .MobID,"null";
    set .MvpID,"null";
    set .ItemID,"null";
    }
    end;
}
Viewed 1242 times, submitted by ZelosAvalon.