// TMW-2 Script // Author: // Jesusalva // Description: // GM Bot for the Monster King. 000-0,0,0,0 script Monster King NPC_HIDDEN,{ OnSlaveDie: end; OnBourneAgain: dispbottom l("Oh well, this sucks, but that was only an illusion."); dispbottom l("The real Monster King is probably on his fortress. It'll take more than that to take him down."); getexp BaseLevel**3, 0; Mobpt = Mobpt + 165; // We need to start over OnInit: $@MK=monster("boss", 45, 45, "The Monster King", MonsterKing, 1, "Monster King::OnBourneAgain"); // Variables which other NPCs must take in account $@MK_AGGRO=0; $@MK_SCENE=0; // Variables only for this NPC .users=getusers(1); .nearby=getusers(8); .map$="boss"; .aid="200000"; .cid="150002"; // Constants .MK_SIEGE=1; .MK_BONUS=2; .MK_MANAF=3; // We should jump straight to loop (it runs every 62 seconds) OnTimer62000: // Regenerate some data, and kill spurious mobs .users=getusers(1); if (mobcount(.map$, "Monster King::OnSlaveDie")) { announce ("Monster King: Noobs, you are all a bunch of noobs!"), bc_map|bc_npc; killmonster(.map$, "Monster King::OnSlaveDie"); } // We are on an event, so skip this loop if ($@MK_SCENE) initnpctimer; // The Monster King is online. This loop is not needed if (isloggedin(.aid, .cid)) { if (!$@MK_SCENE) unitwarp($@MK, "boss", 45, 45); else rodex_sendmail(.cid, "MKBot", "Running Event", "An event is currently running by the MK Bot. Please logout and suppress it."); initnpctimer; } // If too few players are online, we don't need an event AT ALL! if (.users < rand(2,4)) initnpctimer; // Raise aggro $@MK_AGGRO+=.users; // Mana Stone if (.map$ == "011-1") enablenpc "Mana Stone"; // Select a random map. Never shows up at Candor and cities, nor indoors. Not all caves either. .@m=rand(1,30); switch (.@m) { // MPE case 1: .map$="001-1"; break; case 2: .map$="001-3"; break; case 3: .map$="001-4"; break; case 4: .map$="001-5"; break; case 5: .map$="001-6"; break; case 6: .map$="001-7"; break; // Desert case 7: .map$="003-1"; break; case 8: .map$="003-1-3"; break; case 9: .map$="004-1"; break; case 10: .map$="004-2"; break; case 11: .map$="007-1"; break; case 12: .map$="010-1"; break; case 13: .map$="010-1-1"; break; case 14: .map$="010-2"; break; case 15: .map$="011-1"; break; // Special case // Woodlands case 16: .map$="014-1"; break; case 17: .map$="014-2"; break; case 18: .map$="014-3"; break; case 19: .map$="014-4"; break; case 20: .map$="014-5"; break; case 21: .map$="015-1"; break; case 22: .map$="015-2"; break; case 23: .map$="015-3"; break; case 24: .map$="018-1-1"; break; case 25: .map$="018-2"; break; case 26: .map$="018-3"; break; case 27: .map$="018-4"; break; case 28: .map$="018-4-1"; break; default: .map$="boss"; break; } // Try to warp randomly, up to 30 attempts .@e=0; while (!checkcell(.map$, .@x, .@y, cell_chkpass)) { if (.@e == 30) { .map$="boss"; .@x=45; .@y=45; break; } .@x = rand(20, 300); .@y = rand(20, 300); ++.@e; } unitwarp($@MK, .map$, .@x, .@y); .nearby=getusers(8); // Handle Mana Stone if (.map$ == "011-1") disablenpc "Mana Stone"; // Decide if we should have an event here if (.nearby > 1 && $@MK_AGGRO >= rand(0,100)){ // We should decide event kind, but that's NYI announce ("Monster King: I smell humans! Humans must die!"), bc_map|bc_npc; getmapxy(.@m$, .@x, .@y, UNITTYPE_MOB, $@MK); // 50% more monsters at night time if (is_night()) $@MK_AGGRO=$@MK_AGGRO*3/2; // Spawn stuff areamonster(.@m$, .@x-20, .@y-20, .@x+20, .@y+20, "Monster", ManaGhost, $@MK_AGGRO, "Monster King::OnSlaveDie"); $@MK_AGGRO=0; } // We're done, restart loop timer initnpctimer; end; }