int SpawnDutchman()
{
int iChar = GetCharacterIndex("Davy Jones");
if(iChar < 0) { //New
iChar = GenerateCharacter(PIRATE, WITH_SHIP, "officer", MAN, 1, BOSS);
characters[iChar].id = "Davy Jones";
characters[iChar].name = "Davy";
characters[iChar].location = "Grenada";
characters[iChar].lastname = "Jones";
characters[iChar].model = "pirate_5";
characters[iChar].Ship.Type = GenerateShip(SHIP_DUTCHMAN, 1);
characters[iChar].Ship.Cannons.Type = CANNON_TYPE_CANNON_LBS48;
characters[iChar].ship.name = "The Flying Dutchman";
characters[iChar].skill.cannons = 5;
characters[iChar].skill.grappling = 5;
characters[iChar].skill.accuracy = 5;
characters[iChar].skill.defense = 10;
characters[iChar].rank = 20;
characters[iChar].skill.Fencing = 10;
characters[iChar].skill.Gun = 10;
characters[iChar].cannotsurrender = 1;
FaceMaker(&characters[iChar]);
trace("Davy new = " + iChar);
}
else { //Reset ship attributes (restock HP, ammo, etc.)
trace("Davy exist = " + iChar);
SetBaseShipData(GetCharacter(iChar));
}
DeleteAttribute(&characters[iChar], "seaai");
Group_CreateGroup("FlyingDutchman");
Group_AddCharacter("FlyingDutchman", "Davy Jones");
Group_SetGroupCommander("FlyingDutchman", "Davy Jones");
Group_SetPursuitGroup("FlyingDutchman", PLAYER_GROUP);
string sLocator = "Grenada_locators" + (rand(2)+2);
Group_SetAddress("FlyingDutchman", "Grenada", "quest_ships", sLocator);
SetCharacterRelationBoth(nMainCharacterIndex, iChar, RELATION_ENEMY);
Group_SetTaskAttack("FlyingDutchman", PLAYER_GROUP);
Group_LockTask("FlyingDutchman");
UpdateRelations();
trace("*** Davy Jones login successful");
trace("returning iChar = " + iChar);
return iChar;
}