bool KrakenAttackEnabled()
{
ref pchar = GetMainCharacter();
ref ch;
if(CheckAttribute(pchar, "KrakenAttack")) return false; // No Kraken attack is available until a set time after the previous attack
if(CheckAttribute(pchar, "ship.SubmergeDutchman")) return false; // No Kraken attack is available while the Dutchman is submerged
for (int i = 0; i <= GetCompanionQuantity(PChar); i++) {
ch = GetCharacter(GetCompanionIndex(pchar, sti(i)));
if(GetAttribute(ch, "ship.type") == "CursedDutchman") return true; // Only the CURSED Flying Dutchman can call upon the Kraken
}
return false;
void KrakenAttack(aref rCharacter, int iSwimQuantity)
// Character and number of tentacles
{
if (!bSeaActive) return;
ref pchar = GetMainCharacter();
int delay = 0;
for (int i=0; i < iSwimQuantity; i++)
{
PostEvent("CreateKrakenTentacle", delay, "i", rCharacter);
delay = delay + rand(1000);
}
if(IsMainCharacter(rCharacter)) LogIt("Captain, we're being attacked by the Kraken!");
else
{
LogIt("Captain, the " + rCharacter.ship.name + " is under attack by the Kraken!");
pchar.KrakenAttack = true;
}
PostEvent("KrakenAttackFinished", delay, "i", rCharacter);
}
#event_handler("KrakenAttackFinished", "FinishKrakenAttack");
void FinishKrakenAttack()
{
ref pchar = GetMainCharacter();
aref rCharacter = GetEventData();
LogIt("Captain, the Kraken has finished its attack on the " + rCharacter.ship.name + "!");
if(CheckAttribute(pchar, "KrakenAttack")) PostEvent("EnableKraken", 5*60*1000);
}
#event_handler("EnableKraken", "KrakenEnabled");
void KrakenEnabled()
{
ref pchar = GetMainCharacter();
DeleteAttribute(pchar, "KrakenAttack");
if(KrakenAttackEnabled()) LogIt("Captain, the Kraken is ready for another attack!"); // Just in case you swap ships
}
#event_handler("CreateKrakenTentacle", "KrakenTentacle");
void KrakenTentacle()
{
if (!bSeaActive) return;
aref rCharacter = GetEventData();
if(CheckAttribute(rCharacter,"Ship"))
{
switch(rand(15))
{
case 0: Direct_AddGood(rCharacter, "Oil", "tentacle1_0", 0.0,105,10+rand(40),Degree2Radian(rand(20)-10)+Degree2Radian(135.0)-stf(rCharacter.Ship.Ang.y)); break;
case 1: Direct_AddGood(rCharacter, "Oil", "tentacle1_90", 0.0,105,10+rand(40),Degree2Radian(rand(20)-10)+Degree2Radian(225.0)-stf(rCharacter.Ship.Ang.y)); break;
case 2: Direct_AddGood(rCharacter, "Oil", "tentacle1_180",0.0,105,10+rand(40),Degree2Radian(rand(20)-10)+Degree2Radian(315.0)-stf(rCharacter.Ship.Ang.y)); break;
case 3: Direct_AddGood(rCharacter, "Oil", "tentacle1_270",0.0,105,10+rand(40),Degree2Radian(rand(20)-10)+Degree2Radian(45.0) -stf(rCharacter.Ship.Ang.y)); break;
case 4: Direct_AddGood(rCharacter, "Oil", "tentacle2_0", 0.0,105, 5+rand(40),Degree2Radian(rand(20)-10)+Degree2Radian(70.0) -stf(rCharacter.Ship.Ang.y)); break;
case 5: Direct_AddGood(rCharacter, "Oil", "tentacle2_90", 0.0,105, 5+rand(40),Degree2Radian(rand(20)-10)+Degree2Radian(160.0)-stf(rCharacter.Ship.Ang.y)); break;
case 6: Direct_AddGood(rCharacter, "Oil", "tentacle2_180",0.0,105, 5+rand(40),Degree2Radian(rand(20)-10)+Degree2Radian(250.0)-stf(rCharacter.Ship.Ang.y)); break;
case 7: Direct_AddGood(rCharacter, "Oil", "tentacle2_270",0.0,105, 5+rand(40),Degree2Radian(rand(20)-10)+Degree2Radian(340.0)-stf(rCharacter.Ship.Ang.y)); break;
case 8: Direct_AddGood(rCharacter, "Oil", "tentacle3_0", 0.0,105,10+rand(20),Degree2Radian(rand(20)-10)+Degree2Radian(90.0) -stf(rCharacter.Ship.Ang.y)); break;
case 9: Direct_AddGood(rCharacter, "Oil", "tentacle3_90", 0.0,105,10+rand(20),Degree2Radian(rand(20)-10)+Degree2Radian(180.0)-stf(rCharacter.Ship.Ang.y)); break;
case 10: Direct_AddGood(rCharacter, "Oil", "tentacle3_180",0.0,105,10+rand(20),Degree2Radian(rand(20)-10)+Degree2Radian(270.0)-stf(rCharacter.Ship.Ang.y)); break;
case 11: Direct_AddGood(rCharacter, "Oil", "tentacle3_270",0.0,105,10+rand(20),Degree2Radian(rand(20)-10)+Degree2Radian(0.0) -stf(rCharacter.Ship.Ang.y)); break;
case 12: Direct_AddGood(rCharacter, "Oil", "tentacle4_0", 0.0,105, 5+rand(20),Degree2Radian(rand(20)-10)+Degree2Radian(90.0) -stf(rCharacter.Ship.Ang.y)); break;
case 13: Direct_AddGood(rCharacter, "Oil", "tentacle4_90", 0.0,105, 5+rand(20),Degree2Radian(rand(20)-10)+Degree2Radian(180.0)-stf(rCharacter.Ship.Ang.y)); break;
case 14: Direct_AddGood(rCharacter, "Oil", "tentacle4_180",0.0,105, 5+rand(20),Degree2Radian(rand(20)-10)+Degree2Radian(270.0)-stf(rCharacter.Ship.Ang.y)); break;
case 15: Direct_AddGood(rCharacter, "Oil", "tentacle4_270",0.0,105, 5+rand(20),Degree2Radian(rand(20)-10)+Degree2Radian(0.0) -stf(rCharacter.Ship.Ang.y)); break;
}
}
}
#event_handler("UpdateDutchmanSubmersion", "SubmergeDutchman");
void SubmergeDutchman()
{
aref rCharacter = GetEventData();
if(CheckAttribute(rCharacter, "ship.SubmergeDutchman"))
{
float fX, fY, fZ, fAY, gX, gY, gZ;
fX = 0; fY = 0; fZ = 0;
if(CheckAttribute(rCharacter,"Ship.pos.x")) fX=stf(rCharacter.Ship.pos.x);
else return;
if(CheckAttribute(rCharacter,"Ship.pos.y")) fY=stf(rCharacter.Ship.pos.y);
else return;
if(CheckAttribute(rCharacter,"Ship.pos.z")) fZ=stf(rCharacter.Ship.pos.z);
else return;
if(CheckAttribute(rCharacter,"Ship.Ang.y")) fAY=stf(rCharacter.Ship.Ang.y);
else return;
rCharacter.firedrill = true;
if(!CheckAttribute(rCharacter, "ship.EmergeDutchman"))
{
rCharacter.ship.SubmergeDutchman = makefloat(rCharacter.ship.SubmergeDutchman) + 0.35;
if(!CheckAttribute(rCharacter, "ship.PlayedSplash"))
{
rCharacter.ship.PlayedSplash = 1;
gX = 0; gY = 0; gZ = 30;
CreateParticleSystemX("dutchman_submerge",fX - gX*cos(fAY) + gZ*sin(fAY), fY + gY, fZ + gX*sin(fAY) + gZ*cos(fAY), 0.0, 3.0, 0.0, 2);
gX = 5; gY = 0; gZ = 20;
CreateParticleSystemX("dutchman_submerge",fX - gX*cos(fAY) + gZ*sin(fAY), fY + gY, fZ + gX*sin(fAY) + gZ*cos(fAY), 0.0, 3.0, 0.0, 2);
gX = -5; gY = 0; gZ = 20;
CreateParticleSystemX("dutchman_submerge",fX - gX*cos(fAY) + gZ*sin(fAY), fY + gY, fZ + gX*sin(fAY) + gZ*cos(fAY), 0.0, 3.0, 0.0, 2);
gX = 5; gY = 0; gZ = 10;
CreateParticleSystemX("dutchman_submerge",fX - gX*cos(fAY) + gZ*sin(fAY), fY + gY, fZ + gX*sin(fAY) + gZ*cos(fAY), 0.0, 3.0, 0.0, 2);
gX = -5; gY = 0; gZ = 10;
CreateParticleSystemX("dutchman_submerge",fX - gX*cos(fAY) + gZ*sin(fAY), fY + gY, fZ + gX*sin(fAY) + gZ*cos(fAY), 0.0, 3.0, 0.0, 2);
gX = 5; gY = 0; gZ = 0;
CreateParticleSystemX("dutchman_submerge",fX - gX*cos(fAY) + gZ*sin(fAY), fY + gY, fZ + gX*sin(fAY) + gZ*cos(fAY), 0.0, 3.0, 0.0, 2);
gX = -5; gY = 0; gZ = 0;
CreateParticleSystemX("dutchman_submerge",fX - gX*cos(fAY) + gZ*sin(fAY), fY + gY, fZ + gX*sin(fAY) + gZ*cos(fAY), 0.0, 3.0, 0.0, 2);
gX = 5; gY = 0; gZ = -10;
CreateParticleSystemX("dutchman_submerge",fX - gX*cos(fAY) + gZ*sin(fAY), fY + gY, fZ + gX*sin(fAY) + gZ*cos(fAY), 0.0, 3.0, 0.0, 2);
gX = -5; gY = 0; gZ = -10;
CreateParticleSystemX("dutchman_submerge",fX - gX*cos(fAY) + gZ*sin(fAY), fY + gY, fZ + gX*sin(fAY) + gZ*cos(fAY), 0.0, 3.0, 0.0, 2);
gX = 5; gY = 0; gZ = -20;
CreateParticleSystemX("dutchman_submerge",fX - gX*cos(fAY) + gZ*sin(fAY), fY + gY, fZ + gX*sin(fAY) + gZ*cos(fAY), 0.0, 3.0, 0.0, 2);
gX = -5; gY = 0; gZ = -20;
CreateParticleSystemX("dutchman_submerge",fX - gX*cos(fAY) + gZ*sin(fAY), fY + gY, fZ + gX*sin(fAY) + gZ*cos(fAY), 0.0, 3.0, 0.0, 2);
gX = 0; gY = 0; gZ = -30;
CreateParticleSystemX("dutchman_submerge",fX - gX*cos(fAY) + gZ*sin(fAY), fY + gY, fZ + gX*sin(fAY) + gZ*cos(fAY), 0.0, 3.0, 0.0, 2);
PlayStereoSound("objects\shipcharge\take_prey.wav");
}
if(stf(rCharacter.ship.SubmergeDutchman) >= 53)
{
rCharacter.ship.SubmergeDutchman = 53;
}
rCharacter.ship.immersion = rCharacter.ship.SubmergeDutchman;
}
else
{
rCharacter.ship.SubmergeDutchman = makefloat(rCharacter.ship.SubmergeDutchman) - 0.30;
if(stf(rCharacter.ship.SubmergeDutchman)-50 <= stf(rCharacter.ship.CorrectImmersion) && !CheckAttribute(rCharacter, "ship.PlayedSplash"))
This is what i had found in nk.c about the kraken and flying dutchman special abilieties