// TMW2 scripts.
// Author:
// Jesusalva
// Description:
// The Impregnable Fortress Control Files - Boss Chamber - Final Showdown
026-7,39,34,0 script Impregnable#B7F NPC_HIDDEN,{
function _moveNpc;
end;
OnInit:
end;
// Maybe not OnTouch, but OnSit?
OnTouch:
if (strcharinfo(2) == "Monster King") end;
slide 39, 35;
percentheal -15,0;
dispbottom l("The throne is cursed, only the Monster King may seat on it.");
end;
function _moveNpc {
// Try to warp randomly, up to 30 attempts
.@e=0;
.@mx=getmapinfo(MAPINFO_SIZE_X, getarg(0))-20;
.@my=getmapinfo(MAPINFO_SIZE_Y, getarg(0))-20;
do {
if (.@e >= 30)
break;
.npc_x = rand2(20, .@mx);
.npc_y = rand2(20, .@my);
.@e+=1;
} while (!checknpccell(getarg(0), .npc_x, .npc_y, cell_chkpass));
return;
} // _moveNpc
// Controls the Event
OnBegin:
end;
// Monster King was defeated - game won
OnVictory:
// Not killed by a player? It doesn't counts, then
if (!playerattached())
end;
$@MK_CHALLENGE=false;
kamibroadcast("has just defeated the Monster King.", strcharinfo(0));
stopnpctimer;
mapwarp("boss", "017-1", 120, 88);
$GAME_STORYLINE=5;
$MANA_BLVL-=10; // Set base level to 5~15
$MANA_BLVL=max(0, $MANA_BLVL);
specialeffect(FX_FANFARE, AREA, getcharid(3));
// Without the Monster King to rule monsters... TODO Isbamuth, Moubootaur
// This disables all mosnters :<
setbattleflag("monster_ai", 0x209);
setbattleflag("monster_active_enable", false);
setbattleflag("mob_count_rate", 25);
//charcommand("@reloadbattleconf"); // Careful!
donpcevent("@exprate::OnReload");
donpcevent("@droprate::OnReload");
// Player Reward
/*getitembound(AegisShield, 1, 1);
dispbottom l("For defeating the Monster King, you've got the Legendary @@.", getitemlink(AegisShield));
dispbottom l("This item cannot be traded normally and is a Legendary Item.");
dispbottom l("You can transfer it with \"@grantpower\" command. Please contact a GM for more info.");
dispbottom l("Protip: If you plan in selling it, it's adviseable to ask for GM mediation."); */
end;
}
// Room Traps, only against players
026-7,0,0,0 script #MKBossTrap01 NPC_TRAP_ONLINE,0,0,{
end;
OnTouch:
OnTouchNPC:
WorldHeartTrap();
sleep(500); // Wait 500ms for animation
setnpcdisplay .name$, NPC_TRAP_ONLINE;
// Move the trap away after it disarms (up to 30 attempts)
OnInit:
.@e=0;
do {
if (.@e >= 30)
break;
.@x = rand2(21, 60);
.@y = rand2(21, 60);
.@e+=1;
} while (!checknpccell("026-6", .@x, .@y, cell_chkpass));
movenpc .name$, .@x, .@y;
end;
}
// Create more traps
026-7,0,0,0 duplicate(#MKBossTrap01) #MKBossTrap02 NPC_TRAP,0,0
026-7,0,0,0 duplicate(#MKBossTrap01) #MKBossTrap03 NPC_TRAP,0,0
026-7,0,0,0 duplicate(#MKBossTrap01) #MKBossTrap04 NPC_TRAP,0,0
026-7,0,0,0 duplicate(#MKBossTrap01) #MKBossTrap05 NPC_TRAP,0,0
026-7,0,0,0 duplicate(#MKBossTrap01) #MKBossTrap06 NPC_TRAP,0,0
026-7,0,0,0 duplicate(#MKBossTrap01) #MKBossTrap07 NPC_TRAP,0,0
026-7,0,0,0 duplicate(#MKBossTrap01) #MKBossTrap08 NPC_TRAP,0,0
026-7,0,0,0 duplicate(#MKBossTrap01) #MKBossTrap09 NPC_TRAP,0,0
026-7,0,0,0 duplicate(#MKBossTrap01) #MKBossTrap10 NPC_TRAP,0,0