summaryrefslogtreecommitdiff
path: root/npc/018-5-4
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-10-19 01:10:09 -0300
committerJesusaves <cpntb1@ymail.com>2020-10-19 01:10:09 -0300
commitdf58da7c168780fe5705edb5f2bb56fd4b7d09ac (patch)
tree0038b0fa8279e7f617788740704c1871d0ed7d09 /npc/018-5-4
parent87839a2a2a69fa728e04f5642a331779973df29f (diff)
downloadserverdata-df58da7c168780fe5705edb5f2bb56fd4b7d09ac.tar.gz
serverdata-df58da7c168780fe5705edb5f2bb56fd4b7d09ac.tar.bz2
serverdata-df58da7c168780fe5705edb5f2bb56fd4b7d09ac.tar.xz
serverdata-df58da7c168780fe5705edb5f2bb56fd4b7d09ac.zip
Pirates of Sarah is still totally buggy
Diffstat (limited to 'npc/018-5-4')
-rw-r--r--npc/018-5-4/elder.txt106
1 files changed, 62 insertions, 44 deletions
diff --git a/npc/018-5-4/elder.txt b/npc/018-5-4/elder.txt
index 2088a5bd7..ad5f93a2e 100644
--- a/npc/018-5-4/elder.txt
+++ b/npc/018-5-4/elder.txt
@@ -184,9 +184,10 @@ function elderPirateAttack {
if (askyesno() == ASK_NO)
return;
+ .@mapn$="duck@"+getcharid(0);
+
// Build instance if it doesn't exists or has been reallocated
if (instanceowner(@duckinst) != getcharid(3)) {
- .@mapn$="duck@"+getcharid(0);
@duckinst = instance_create("duck@a"+getcharid(0), getcharid(3), IOT_CHAR);
instance_attachmap("018-5-4", @duckinst, false, .@mapn$);
// Instance lasts 6 minutes
@@ -198,21 +199,26 @@ function elderPirateAttack {
}
getmapxy(.@m$, .@x, .@y, 0);
warp .@mapn$, .@x, .@y;
- addtimer(300, instance_npcname(.name$, @duckinst)+"::OnBegin");
+ //debugmes "Warp successful";
+ //debugmes "Prepare timer, target: %s in %d - aka. %s", .name$, @duckinst, instance_npcname(.name$, @duckinst);
+ addtimer(300, .name$+"::OnBegin");
closeclientdialog;
close;
return;
}
OnBegin:
+ //debugmes "BEGIN NPC %s, char %s. Map %s", instance_npcname(.name$, @duckinst), strcharinfo(0), getmap();
+ .@n$=instance_npcname(.name$, @duckinst);
+ .@m$=getmap();
killmonsterall(getmap());
- .pLvl = BaseLevel;
- .pirate_killed = 0;
- .duck_killed = 0;
- .total_pirates = 0;
- .total_ducks = 0;
- setnpcdisplay .name$, NPC_NO_SPRITE;
+ @pLvl = BaseLevel;
+ @pirate_killed = 0;
+ @duck_killed = 0;
+ @total_pirates = 0;
+ @total_ducks = 0;
+ setnpcdisplay .@n$, NPC_NO_SPRITE;
sleep2(1000);
mapannounce(getmap(), "Duck Elder : Here they come...", bc_map);
sleep2(1000);
@@ -224,59 +230,69 @@ OnBegin:
// Spawn Monsters
// FIXME MIGHT NOT WORK WITH COORDINATES ZERO (for several reasons)
// PLEASE PREFER AREAMONSTER
- monster("018-5-4", 0, 0, "Ocean Pirate", OceanPirate, .pLvl, "Duck Elder::OnPirateKilled");
- .total_pirates+=.pLvl;
- monster("018-5-4", 0, 0, "Pirate Captain", OceanPirate, (.pLvl/10), "Duck Elder::OnPirateKilled"); // FIXME
- .total_pirates+=(.pLvl/10);
- monster("018-5-4", 0, 0, "Desert Pirate", DesertBandit, (.pLvl/2), "Duck Elder::OnPirateKilled");
- .total_pirates+=(.pLvl/2);
- monster("018-5-4", 0, 0, "Marsh Pirate", Bandit, (.pLvl/2), "Duck Elder::OnPirateKilled");
- .total_pirates+=(.pLvl/2);
- monster("018-5-4", 0, 0, "Buccaneer", Sarracenus, (.pLvl/5), "Duck Elder::OnPirateKilled");
- .total_pirates+=(.pLvl/5);
- monster("018-5-4", 0, 0, "Corsair", RobinBandit, (.pLvl/5), "Duck Elder::OnPirateKilled");
- .total_pirates+=(.pLvl/5);
- monster("018-5-4", 0, 0, "Pirate Lord", BanditLord, (.pLvl/10), "Duck Elder::OnPirateKilled");
- .total_pirates+=(.pLvl/10);
- monster("018-5-4", 0, 0, "Pirate Assassin", HoodedAssassin, (.pLvl/25), "Duck Elder::OnPirateKilled");
- .total_pirates+=(.pLvl/25);
+ monster(.@m$, 0, 0, "Ocean Pirate", OceanPirate, @pLvl, "Duck Elder::OnPirateKilled");
+ @total_pirates+=@pLvl;
+ monster(.@m$, 0, 0, "Pirate Captain", OceanPirate, (@pLvl/10), "Duck Elder::OnPirateKilled"); // FIXME
+ @total_pirates+=(@pLvl/10);
+ monster(.@m$, 0, 0, "Desert Pirate", DesertBandit, (@pLvl/3), "Duck Elder::OnPirateKilled");
+ @total_pirates+=(@pLvl/3);
+ monster(.@m$, 0, 0, "Marsh Pirate", Bandit, (@pLvl/3), "Duck Elder::OnPirateKilled");
+ @total_pirates+=(@pLvl/3);
+ monster(.@m$, 0, 0, "Buccaneer", Sarracenus, (@pLvl/6), "Duck Elder::OnPirateKilled");
+ @total_pirates+=(@pLvl/6);
+ monster(.@m$, 0, 0, "Corsair", RobinBandit, (@pLvl/5), "Duck Elder::OnPirateKilled");
+ @total_pirates+=(@pLvl/5);
+ monster(.@m$, 0, 0, "Pirate Lord", BanditLord, (@pLvl/11), "Duck Elder::OnPirateKilled");
+ @total_pirates+=(@pLvl/11);
+ monster(.@m$, 0, 0, "Pirate Assassin", HoodedAssassin, (@pLvl/25), "Duck Elder::OnPirateKilled");
+ @total_pirates+=(@pLvl/25);
+ debugmes "Pirates of SARAH, \"%s\" - Total: %d (Lv %d)", strcharinfo(0), @total_pirates, @pLvl;
// Reinforcements
// FIXME: We might not want summon() here (summon is immune to AOE)
// We probably want bg_monster (blame Jesusalva) or monster w/ alchemy flag
- for(.@i = 0; .@i < min(10, .pLvl/5); ++.@i) {
+ for(.@i = 0; .@i < min(10, @pLvl/5); ++.@i) {
.@sd=summon("Duck Soldier", Duck, 300000, "Duck Elder::OnDuckKilled");
.@bhp=getunitdata(.@sd, UDT_MAXHP);
// Abizit makes bonus HP vary (like AdjustSpellpower)
.@lvx = .@bhp * (80 + abizit() * rand2(5,10)) / 100;
- setunitdata(.@mids, UDT_MAXHP, .@lvx);
- setunitdata(.@mids, UDT_HP, .@lvx);
- .total_duck++;
+ setunitdata(.@sd, UDT_MAXHP, .@lvx);
+ setunitdata(.@sd, UDT_HP, .@lvx);
+ @total_duck++;
}
- for(.@i = 0; .@i < min(5, .pLvl/20); ++.@i) {
+ for(.@i = 0; .@i < min(5, @pLvl/20); ++.@i) {
.@sd=summon("Duck Initiate", EliteDuck, 300000, "Duck Elder::OnDuckKilled");
.@bhp=getunitdata(.@sd, UDT_MAXHP);
// Abizit makes bonus HP vary (like AdjustSpellpower)
.@lvx = .@bhp * (80 + abizit() * rand2(5,10)) / 100;
- setunitdata(.@mids, UDT_MAXHP, .@lvx);
- setunitdata(.@mids, UDT_HP, .@lvx);
- .total_duck++;
+ setunitdata(.@sd, UDT_MAXHP, .@lvx);
+ setunitdata(.@sd, UDT_HP, .@lvx);
+ @total_duck++;
}
// Begin timer
- initnpctimer();
+ //initnpctimer();
+ addtimer 300000, "Duck Elder::OnTimerQuit";
end;
OnPirateKilled:
- .pirate_killed++;
- if (.pirate_killed >= .total_pirates) {
+ @pirate_killed++;
+ .@mia=@total_ducks-@duck_killed;
+ if (.@mia < mobcount(getmap(), "Duck Elder::OnDuckKilled"))
+ @duck_killed=@total_ducks-mobcount(getmap(), "Duck Elder::OnDuckKilled");
+ if (@duck_killed >= @total_ducks) {
+ elderPirateDefeat();
+ }
+ if (@pirate_killed >= @total_pirates) {
elderPirateVictory();
}
end;
OnDuckKilled:
- .duck_killed++;
- if (.duck_killed >= .total_ducks) {
+ if (!playerattached())
+ end;
+ @duck_killed++;
+ if (@duck_killed >= @total_ducks) {
elderPirateDefeat();
}
end;
@@ -292,10 +308,11 @@ OnTimerQuit:
function elderPirateVictory {
stopnpctimer();
- .pirate_killed = 0;
- .duck_killed = -50; // Set to -50 to make sure defeat doesn't trigger when monsters are killed
+ @pirate_killed = 0;
+ @duck_killed = -50; // Set to -50 to make sure defeat doesn't trigger when monsters are killed
announce("Duck Elder : Success! The pirates have been thwarted.", bc_self);
- setnpcdisplay .name$, NPC_DUCK_ELDER;
+ .@n$=instance_npcname(.name$, @duckinst);
+ setnpcdisplay .@n$, NPC_DUCK_ELDER;
setq(LilitQuest_PiratesOfSARAH, 3);
getmapxy(.@m$, .@x, .@y, 0);
killmonsterall(.@m$);
@@ -306,11 +323,12 @@ function elderPirateVictory {
}
function elderPirateDefeat {
- stopnpctimer();
- .pirate_killed = -50; // Set to -50 to make sure victory doesn't trigger when monsters are killed
- .duck_killed = -50;
+ //stopnpctimer();
+ @pirate_killed = -50; // Set to -50 to make sure victory doesn't trigger when monsters are killed
+ @duck_killed = -50;
announce("Duck Elder : We have failed. The pirates will regroup and replenish their fallen. They will strike again, until we are defeated.", bc_self);
- setnpcdisplay .name$, NPC_DUCK_ELDER;
+ .@n$=instance_npcname(.name$, @duckinst);
+ setnpcdisplay .@n$, NPC_DUCK_ELDER;
getmapxy(.@m$, .@x, .@y, 0);
killmonsterall(.@m$);
warp "018-5-4", .@x, .@y;