// TMW2 scripts.
// Authors:
// Jesusalva
// Description:
// Sagratha Quest (field 3)
015-8-1,49,38,0 script #SaggyDungeonCore NPC_NO_SPRITE,{
// Not in instance, we don't care.
if (instance_id() < 0)
end;
end;
// There is no instance init
OnBegin:
.@m$=getmap();
.@n$=instance_npcname(.name$);
// 255 = PCBLOCK_ATTACK|PCBLOCK_SKILL|PCBLOCK_USEITEM|PCBLOCK_COMMANDS|PCBLOCK_SITSTAND|PCBLOCK_IMMUNE|PCBLOCK_CHAT|PCBLOCK_MOVE
setpcblock(255, true);
setq3 HurnscaldQuest_Sagratha, 1;
// Setup boss units
.SAGRATHA=monster(.@m$, 52, 40, "Sagratha", Sagratha, 1, .@n$+"::OnSagrathaDie", Size_Medium, 2);
.BOSS=monster(.@m$, 52, 40, l("Masked Assassin"), HoodedAssassin, 1, .@n$+"::OnSagrathaWin");
unitstop(.SAGRATHA);
unitstop(.BOSS);
unittalk(.SAGRATHA, l("What are you doing here, @@!", get_race()));
addtimer(1000, .@n$+"::OnS02");
end;
OnS02:
.@m$=getmap();
.@n$=instance_npcname(.name$);
unitstop(.SAGRATHA);
unitstop(.BOSS);
unittalk(.SAGRATHA, l("I don't need help!"));
unittalk(.BOSS, l("Die already!"));
addtimer(1500, .@n$+"::OnS03");
end;
OnS03:
.@m$=getmap();
.@n$=instance_npcname(.name$);
unitstop(.SAGRATHA);
unitstop(.BOSS);
unittalk(.SAGRATHA, l("If you don't want to die, fight!"));
unittalk(.BOSS, lg("Murder her too!", "Murder him too!"));
addtimer(1500, .@n$+"::OnS04");
end;
OnS04:
.@m$=getmap();
.@n$=instance_npcname(.name$);
// Assassin's Army
areamonster .@m$, 44, 40, 55, 50, strmobinfo(1, HoodedNinja), HoodedNinja, 4;
areamonster .@m$, 44, 40, 55, 50, strmobinfo(1, Assassin), Assassin, 7;
// Sagratha's Army
areamonster .@m$, 44, 40, 55, 50, strmobinfo(1, Mouboo), Mouboo, 2, .@n$+"::OnError", Size_Medium, 2;
areamonster .@m$, 44, 40, 55, 50, strmobinfo(1, ForestMushroom), ForestMushroom, 2, .@n$+"::OnError", Size_Medium, 2;
// Heal them because you should not be fighting (yet).
setunitdata(.BOSS, UDT_HP, getunitdata(.BOSS, UDT_MAXHP));
setunitdata(.SAGRATHA, UDT_HP, getunitdata(.SAGRATHA, UDT_MAXHP));
unitstop(.SAGRATHA);
unitstop(.BOSS);
// Objective announce
mapannounce(.@m$, "##2"+l("Victory Conditions: Defeat the assassin!"), 0);
mapannounce(.@m$, "##1"+l("Defeat Conditions: Your death!"), 0);
mapannounce(.@m$, "##1"+l("Defeat Conditions: Time run out!"), 0);
mapannounce(.@m$, "##1"+l("Defeat Conditions: Sagratha gets killed!"), 0);
// Status cleanup
// 255 = PCBLOCK_ATTACK|PCBLOCK_SKILL|PCBLOCK_USEITEM|PCBLOCK_COMMANDS|PCBLOCK_SITSTAND|PCBLOCK_IMMUNE|PCBLOCK_CHAT|PCBLOCK_MOVE
setpcblock(255, false);
// TODO: After x time, reinforcements on both sides
// BOSS: “Kill 'em all!”
// SAGGY: “Beings of florest, come to my aid and protect me!”
addtimer(20000, .@n$+"::OnW01");
end;
OnW01:
.@m$=getmap();
.@n$=instance_npcname(.name$);
unittalk(.BOSS, l("Kill 'em all!"));
monster .@m$, 39, 39, strmobinfo(1, HoodedNinja), HoodedNinja, 1;
monster .@m$, 60, 39, strmobinfo(1, HoodedNinja), HoodedNinja, 1;
monster .@m$, 39, 54, strmobinfo(1, Assassin), Assassin, 1;
monster .@m$, 60, 54, strmobinfo(1, Assassin), Assassin, 1;
addtimer(rand(10000,15000), .@n$+"::OnW02");
end;
OnW02:
.@m$=getmap();
.@n$=instance_npcname(.name$);
unittalk(.SAGRATHA, l("Mouboos, come to my aid and protect me!"));
monster .@m$, 46, 59, strmobinfo(1, Mouboo), Mouboo, 1, .@n$+"::OnError", Size_Medium, 2;
monster .@m$, 44, 61, strmobinfo(1, Mouboo), Mouboo, 1, .@n$+"::OnError", Size_Medium, 2;
monster .@m$, 49, 61, strmobinfo(1, Mouboo), Mouboo, 1, .@n$+"::OnError", Size_Medium, 2;
addtimer(30000, .@n$+"::OnW03");
end;
OnW03:
.@m$=getmap();
.@n$=instance_npcname(.name$);
unittalk(.SAGRATHA, l("Do not think you can defeat me yet!"));
unittalk(.BOSS, l("You'll all die here!"));
monster .@m$, 49, 34, strmobinfo(1, Mouboo), Mouboo, 1, .@n$+"::OnError", Size_Medium, 2;
monster .@m$, 47, 36, strmobinfo(1, Assassin), Assassin, 1;
monster .@m$, 52, 36, strmobinfo(1, Assassin), Assassin, 1;
end;
// Assassin, HoodedNinja, HoodedAssassin (boss)
// Mouboo, ForestMushroom, Fluffy, Sagratha (boss)
OnSagrathaDie:
npctalk "Defeat!";
dispbottom l("You failed to protect Sagratha..."); // and will need to start the quest again...");
setq1 HurnscaldQuest_Sagratha, 3;
setq3 HurnscaldQuest_Sagratha, 0;
percentheal -100, -100;
end;
OnSagrathaWin:
npctalk "Victory!";
unittalk(.SAGRATHA, "ERROR, could not open dialog");
mapannounce(.@m$, "##2"+l("You win!"), 0);
end;
OnError:
end;
OnInit:
.SAGRATHA=0;
end;
}
// Dummy NPC to fire #SaggyDungeonCore when you get close to battle scene
015-8-1,49,39,0 script #SaggyDungeonFire NPC_HIDDEN,1,0,{
end;
OnTouch:
if (instance_id() < 0)
end;
if (!getq3(HurnscaldQuest_Sagratha)) {
.@in=getq2(HurnscaldQuest_Sagratha);
doevent(instance_npcname("#SaggyDungeonCore", .@in)+"::OnBegin");
}
end;
OnInit:
.distance=0;
end;
}