• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Mooring ships at the jetty

Yo, i cant download the file, is it still available to download anywhere?
Also, do it work in the Build 13 Final?
 
It's included in the Build 14 Alpha, but it doesn't always look good. Especially not with Manowars moored alongside the jetties. They tend to be moored through the jetties instead, especially at Douwesen. <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" />
 
I installed the Build 14 Alpha 6 now and i am testing it, discovering what is new and what isnt.

And dont worry, im not a fan of giant ships like the <i>men o'war</i>, i prefer the little and fast ones, the frigate is the most balanced, so i prefer that one (reason why i love the Surprise, it is fast and has lots of cannons).

The problem is that i cant download the file in the very first page of the thread. You meant that the mod is already included in the Build 14 Alpha or do you mean that it works in the Build 14 Alpha?
 
It's included in the Alpha 8 WIP versions, but not the others. Unfortunately sometimes a Manowar will appear in port even if you don't use one yourself. We still need to figure out a way of circumventing that problem.
 
Does anyone have any ideas how to change the code so that whether a ship is moored alongside the jetty depends on the size of the ship?
Alternatively, would it be possible to switch locator files if there's big ships present in the port scene?
 
As I mentioned earlier, we could try ro rewrite function <i>LocLoadShips</i> from PROGRAM\Locations\locations_loader.c so it would check <i>boxsize</i> attributes for all ships compared to predefined earlier distances of the locator to jetty and coast first and judging which ship should be put at jetty. Then, the rest of (bigger and those which would be too many to fit at piers) ships would be put on more distant locators. A good thing would be also to add functionality of deciding which ship would be located at which locator - for quest writing purposes, i.e.

pirate_kk
 
Both those ideas indeed sound very good. At the moment there's one point in the Jack Sparrow quest where we needed to place ships at certain locators.
This is working at the moment but only because I modified the locator file to work correctly for that instance.
It isn't really feasable to always do it like that, so being able to add one line of code to place a ship at a certain locator would be brilliant! <img src="style_emoticons/<#EMO_DIR#>/w00t.gif" style="vertical-align:middle" emoid=":woot" border="0" alt="w00t.gif" />
 
Eventually we'll need to come up with a more sophisticated way of doing this.
It just doesn't work well for big ships. :facepalm
 
Another thought...

At the moment, it's the island's coast raiders that are generated in the port.
This results in possibly weird-nation ships appearing there.
This didn't use to be a problem before, because ship were moored far away anyway. But not anymore...
Also, you'd have the same ships in all the ports on the same island.

So that leads me wondering... could we generate some port ships for each town seperately?
And make those ships change every now and then? That way, they could all be of the correct nation.
And that way we could also ensure that, apart from the player and companion ships,
there wouldn't be any huge ships moored in the port.

We could also maybe join this with the Ships Sailing in Port/Shore Scene mod,
so that the sailing around is no longer random, but it'll make sense.
When a ship sails away from the port, she might join the coastraiders around the island.
Then her spot in port could remain empty until another small coastraider joins.
And maybe we could add some ships randomly sailing past on shores too?

But all the above might be getting rather complex for a mod that does give some nice atmoshere, but not much else. :facepalm
 
I do too. But not the prospect of doing a lot of complicated coding for it. :razz
Especially since I haven't got much of a clue how to. :facepalm
 
Just to let you know I have fixed the Ships_other being used by player character ships.
The Player characters ships now use the Ships locators only, and the NPC's use the Ships_other locators :D

A good thing would be also to add functionality of deciding which ship would be located at which locator - for quest writing purposes, i.e.
In the process I have managed this as well ;)
The Ships_other, ship_1 will always be a ship that is set by using
Code:
SetCharacterShipLocation(characterfromID("*random*"), "Redmond_port");
unless it is the pchar or one of his companions ;)

Now for the fix ;)
Change
Code:
void LocLoadShips(ref Location)
{
int		i, j;
int		iShipsType[MAX_SHIPS_IN_LOCATION];
int		iShipType, iMainCharacterShipType;
aref	locator_ships,locator_otherships;
aref	locator;

// KK -->
for (i = 0; i < locNumShips; i++)
{
DeleteClass(locShips[i]);
}
// <-- KK

locNumShips = 0;

bool bMainCharacterHere = LocIsEntryLocation(Location);

ref rPlayer = GetMainCharacter();

if (!CheckAttribute(Location, "locators")) 
{
if(Location.environment.sea=="true" && !bDeckEnter) traceif("LocLoadShips: Can't find Location.locators in location: " + Location.id); // MAXIMUS 28.07.2006
return;
}

int iMCI = GetMainCharacterIndex();
ref MC = GetMainCharacter(); // KK

if (!CheckAttribute(Location, "locators.ships"))
{
if(Location.environment.sea=="true" && !bDeckEnter) traceif("LocLoadShips: Can't find Location.locators.ships in location: " + Location.id); // MAXIMUS 28.07.2006
return;
}
if (!CheckAttribute(Location, "locators.ships_other"))
{
if(Location.environment.sea=="true" && !bDeckEnter) traceif("LocLoadShips: Can't find Location.locators.ships_other in location: " + Location.id); // MAXIMUS 28.07.2006
return;
}
makearef(locator_ships, location.locators.ships);
makearef(locator_otherships, location.locators.ships_other);

iMainCharacterShipType = GetCharacterShipType(MC); // PS

If(CheckAttribute(MC,"fallen")) // Screwface : Need to restore the fallen mast(s) to avoid crashes with set flags
{
DeleteAttribute(MC,"ship.sails");
DeleteAttribute(MC,"ship.masts");
DeleteAttribute(MC,"fallen");
Trace("Player mast restored");
}

// create our characters ships
if (bMainCharacterHere)
{
for (i=0;i<COMPANION_MAX;i++)
{
if (locNumShips >= MAX_SHIPS_IN_LOCATION) continue;
int iCompanionIndex = GetCompanionIndex(MC, i);
if (iCompanionIndex==-1) continue;
ref rCompanion = GetCharacter(iCompanionIndex); // KK
If(CheckAttribute(rCompanion,"fallen")) // Screwface : Need to restore the fallen mast(s) to avoid crashes with set flags
{
DeleteAttribute(rCompanion,"ship.sails");
DeleteAttribute(rCompanion,"ship.masts");
DeleteAttribute(rCompanion,"fallen");
Trace("Companion mast restored");
}
iShipType = GetCharacterShipType(rCompanion); // PS
if (iShipType == SHIP_NOTUSED) continue;
SetCharacterShipLocation(rCompanion, Location.id); // KK
iShips[locNumShips] = iCompanionIndex;
iShipsType[locNumShips] = 0;
rCompanion.curshipnum = locNumShips; // KK
locNumShips++;
}
}

// create other quest characters ships
for (i=0;i<CHARACTERS_QUANTITY;i++) // NK 05-04-05 use CHARACTERS_QUANTITY
{
//		ref theChar = &Characters[i]; traceif("Character[" + i + "] index = " + theChar.index);	// keep this around to test for bad characters
if (i == iMCI) continue;
if (locNumShips >= MAX_SHIPS_IN_LOCATION) continue;
if (!CheckAttribute(&Characters[i], "index")) continue;	// LDH 04Sep06 prune characters who were deleted in boarding code
if (!Character_LocIsEntryLocation(&Characters[i],Location)) continue;
bool bExist = false;
for (j=0;j<locNumShips;j++) 
{
if (i == iShips[j]) 
{
bExist = true; break;
}
}
if (bExist) continue;
iShipType = GetCharacterShipType(GetCharacter(i)); // PS
if (iShipType == SHIP_NOTUSED) continue;
if (LAi_IsDead(&Characters[i])) continue; // NK 04-09-12 if char is dead, skip. Needed for pruning ships of dead coast captains.

iShips[locNumShips] = i;
Characters[i].curshipnum = locNumShips; // KK
locNumShips++;
iShipsType[locNumShips] = 1;
}

//	traceif("CHARACTERS_QUANTITY = " + CHARACTERS_QUANTITY + ", locNumShips = " + locNumShips);	// 1118, 28
//	DumpAttributes(locator_ships);	// LDH test, 4 ships, I only had 2 companions
//	DumpAttributes(locator_otherships);	// LDH test, max is 8 always

int iNumShips = GetAttributesNum(locator_ships);
int iNumOtherShips = GetAttributesNum(locator_otherships);
int iCurNumShips = 0;
int iCurNumOtherShips = 0;
ref rCharacter; // PS
ref rShip; // PS
for(int n = 0; n < locNumShips; n++)
{
switch(iShipsType[locNumShips])
{
case 0:
if (iCurNumShips >= iNumShips) 
{ 
traceif("LocLoadShips: need (ships): " + iCurNumShips + ", but max_num_ships: " + iNumShips);
iCurNumShips++;		// LDH added for trace 03Sep06
continue;
};
locator = GetAttributeN(locator_ships, iCurNumShips);
iCurNumShips++;
break;
case 1:
if (iCurNumOtherShips >= iNumOtherShips) 
{ 
traceif("LocLoadShips: need (ships_other): " + iCurNumOtherShips + ", but max_num_ships_other: " + iNumOtherShips);
iCurNumOtherShips++;		// LDH added for trace
continue;
};
locator = GetAttributeN(locator_otherships, iCurNumOtherShips);
iCurNumOtherShips++;
break;
}
ShipModelrList[n] = GetCurrentModelrNumber(); // KK
if (CreateEntity(&locShips[n], "ship") == 0) break;
rCharacter = GetCharacter(iShips[n]); // PS
rShip = GetShipByType(GetCharacterShipType(rCharacter)); // PS
// Screwface : save the sea pos of player ship to avoid be reload nowhere when we go on worldmap just after sea loading
if(rcharacter.index == GetMainCharacterIndex() && !CheckAttribute(rCharacter,"Ship.Pos.save"))
{
rCharacter.Ship.Pos.save.x = rCharacter.Ship.Pos.x;
rCharacter.Ship.Pos.save.z = rCharacter.Ship.Pos.z;
}
// Screwface :end
rCharacter.Ship.Pos.x = stf(locator.x);
rCharacter.Ship.Pos.z = stf(locator.z);
// KK -->
if (CheckAttribute(locator, "vZ")) {
rCharacter.Ship.Ang.y = GetAngleY(stf(locator.vZ.x),stf(locator.vZ.z));
} else {
rCharacter.Ship.Ang.y = stf(locator.ay);
}
// <-- KK

// PB: Sailing Ships -->
ref lcn = &Locations[FindLocation(rPlayer.location)];
if(CheckAttribute(lcn, "island"))
{
string islandstr = lcn.island;
if(GetAttribute(Islands[FindIsland(islandstr)], "skipCR") != true)
{
for(j = 1; j < 7; j++)
{
DeleteAttribute(characterFromID("Cr" + islandstr + j),"sailaway");
if(rand(2) == 0) characters[GetCharacterIndex("Cr" + islandstr + j)].sailaway = true;
}
}
}
// PB: Sailing Ships <--

// ASVS -->
if(CheckAttribute(rCharacter,"sailaway"))
{
if(!CheckAttribute(rCharacter,"Ship.Strand"))					rCharacter.Ship.Strand = false;
if(!CheckAttribute(SeaCameras,"camera"))						SeaCameras.Camera = "SeaShipCamera";
if(!CheckAttribute(rCharacter,"ship.cannons.Charge"))			rCharacter.ship.cannons.Charge.Type = GOOD_BALLS;
if(!CheckAttribute(rCharacter,"TmpPerks.LongRangeShoot"))		rCharacter.TmpPerks.LongRangeShoot = false;
if(!CheckAttribute(rCharacter,"TmpPerks.shipspeedup"))			rCharacter.TmpPerks.shipspeedup = false;
if(!CheckAttribute(rCharacter,"TmpPerks.shipturnrateup"))		rCharacter.TmpPerks.shipturnrateup = false;
if(!CheckAttribute(rCharacter,"TmpPerks.sailingprofessional"))	rCharacter.TmpPerks.sailingprofessional = false;
if(!CheckAttribute(rCharacter,"TmpPerks.stormprofessional"))	rCharacter.TmpPerks.stormprofessional = false;
if(!CheckAttribute(rCharacter,"TmpPerks.turn"))					rCharacter.TmpPerks.turn = false;
rCharacter.Ship.stopped = false;
rCharacter.Ship.Speed.z = 1.5;
}
else
{
rCharacter.Ship.stopped = true;
rCharacter.Ship.Speed.z = 0.0;
}
// ASVS <--
Ship_PrepareShipForLocation(rCharacter);
// Screwface : section to send to setshipflag function the real number of ships who are physically in port and avoid CTD in some ports
if(!Checkattribute(rPlayer,"numcoastalindocks")){rPlayer.numcoastalindocks = 0;}
if(iCurNumOtherShips >= iCurNumShips)
rPlayer.numcoastalindocks = iCurNumOtherShips;
else
rPlayer.numcoastalindocks = iCurNumShips;

If(CheckAttribute(rCharacter,"fallen")) // Restore the fallen mast(s) to avoid crashes
{
DeleteAttribute(rCharacter,"ship.sails");
DeleteAttribute(rCharacter,"ship.masts");
DeleteAttribute(rCharacter,"fallen");
}
//If(CheckAttribute(GetMainCharacter(),"avoidflagsRe")){DeleteAttribute(GetMainCharacter(),"avoidflagsRe");}
// Screwface : end
SendMessage(&locShips[n],"laa",MSG_SHIP_CREATE,&rCharacter,&rShip);
}

// load boat 2 location
if (CheckAttribute(Location, "locators.reload.boat"))
{
if (bMainCharacterHere && iMainCharacterShipType != SHIP_NOTUSED)
{
if (CreateEntity(&locShips[n], "ship"))
{
makearef(locator,Location.locators.reload.boat);

rCharacter = GetCharacter(MAX_CHARACTERS+BOAT_CHARACTER);
rShip = GetShipByType(GetCharacterShipType(&rCharacter)); // PS
rCharacter.Ship.Pos.x = stf(locator.x);
rCharacter.Ship.Pos.z = stf(locator.z);
rCharacter.Ship.Ang.y = GetAngleY(stf(locator.vZ.x),stf(locator.vZ.z));
rCharacter.Ship.stopped = true;
rCharacter.Ship.Speed.z = 0.0;
Ship_PrepareShipForLocation(rCharacter);
SendMessage(&locShips[n],"laa",MSG_SHIP_CREATE,&rCharacter,&rShip);
locNumShips++;
}
}
}
else 
{
if (bMainCharacterHere)
{
traceif("LocLoadShips: Can't find boat locator in location: " + Location.id);
}
}
}
with
Code:
void LocLoadShips(ref Location)
{
int		i, j;
int		iShipsType[MAX_SHIPS_IN_LOCATION];
int		iShipType, iMainCharacterShipType;
aref	locator_ships,locator_otherships;
aref	locator;

// KK -->
for (i = 0; i < locNumShips; i++)
{
DeleteClass(locShips[i]);
}
// <-- KK

locNumShips = 0;

bool bMainCharacterHere = LocIsEntryLocation(Location);

ref rPlayer = GetMainCharacter();

if (!CheckAttribute(Location, "locators")) 
{
if(Location.environment.sea=="true" && !bDeckEnter) traceif("LocLoadShips: Can't find Location.locators in location: " + Location.id); // MAXIMUS 28.07.2006
return;
}

int iMCI = GetMainCharacterIndex();
ref MC = GetMainCharacter(); // KK

if (!CheckAttribute(Location, "locators.ships"))
{
if(Location.environment.sea=="true" && !bDeckEnter) traceif("LocLoadShips: Can't find Location.locators.ships in location: " + Location.id); // MAXIMUS 28.07.2006
return;
}
if (!CheckAttribute(Location, "locators.ships_other"))
{
if(Location.environment.sea=="true" && !bDeckEnter) traceif("LocLoadShips: Can't find Location.locators.ships_other in location: " + Location.id); // MAXIMUS 28.07.2006
return;
}
makearef(locator_ships, location.locators.ships);
makearef(locator_otherships, location.locators.ships_other);
iMainCharacterShipType = GetCharacterShipType(MC); // PS

If(CheckAttribute(MC,"fallen")) // Screwface : Need to restore the fallen mast(s) to avoid crashes with set flags
{
DeleteAttribute(MC,"ship.sails");
DeleteAttribute(MC,"ship.masts");
DeleteAttribute(MC,"fallen");
Trace("Player mast restored");
}

// create our characters ships
if (bMainCharacterHere)
{	
for (i=0;i<COMPANION_MAX;i++)
{
if (locNumShips >= MAX_SHIPS_IN_LOCATION) continue;
int iCompanionIndex = GetCompanionIndex(MC, i);
if (iCompanionIndex==-1) continue;
ref rCompanion = GetCharacter(iCompanionIndex); // KK
If(CheckAttribute(rCompanion,"fallen")) // Screwface : Need to restore the fallen mast(s) to avoid crashes with set flags
{
DeleteAttribute(rCompanion,"ship.sails");
DeleteAttribute(rCompanion,"ship.masts");
DeleteAttribute(rCompanion,"fallen");
Trace("Companion mast restored");
}
iShipType = GetCharacterShipType(rCompanion); // PS
if (iShipType == SHIP_NOTUSED) continue;
SetCharacterShipLocation(rCompanion, Location.id); // KK
iShips[locNumShips] = iCompanionIndex;
iShipsType[locNumShips] = 0;
rCompanion.curshipnum = locNumShips; // KK
locNumShips++;
}
}

// create other quest characters ships
for (i=0;i<CHARACTERS_QUANTITY;i++) // NK 05-04-05 use CHARACTERS_QUANTITY
{
//		ref theChar = &Characters[i]; traceif("Character[" + i + "] index = " + theChar.index);	// keep this around to test for bad characters
if (i == iMCI) continue;
if (locNumShips >= MAX_SHIPS_IN_LOCATION) continue;
if (!CheckAttribute(&Characters[i], "index")) continue;	// LDH 04Sep06 prune characters who were deleted in boarding code
if (!Character_LocIsEntryLocation(&Characters[i],Location)) continue;
bool bExist = false;
for (j=0;j<locNumShips;j++) 
{
if (i == iShips[j]) 
{
bExist = true; break;
}
}
if (bExist) continue;
iShipType = GetCharacterShipType(GetCharacter(i)); // PS
if (iShipType == SHIP_NOTUSED) continue;
if (LAi_IsDead(&Characters[i])) continue; // NK 04-09-12 if char is dead, skip. Needed for pruning ships of dead coast captains.

iShips[locNumShips] = i;
Characters[i].curshipnum = locNumShips; // KK
iShipsType[locNumShips] = 1;
locNumShips++;
}

//	traceif("CHARACTERS_QUANTITY = " + CHARACTERS_QUANTITY + ", locNumShips = " + locNumShips);	// 1118, 28
//	DumpAttributes(locator_ships);	// LDH test, 4 ships, I only had 2 companions
//	DumpAttributes(locator_otherships);	// LDH test, max is 8 always

int iNumShips = GetAttributesNum(locator_ships);
int iNumOtherShips = GetAttributesNum(locator_otherships);
int iCurNumShips = 0;
int iCurNumOtherShips = 0;
ref rCharacter; // PS
ref rShip; // PS
for(int n = 0; n < locNumShips; n++)
{
switch(iShipsType[n])
{
case 0:
if (iCurNumShips >= iNumShips) 
{ 
traceif("LocLoadShips: need (ships): " + iCurNumShips + ", but max_num_ships: " + iNumShips);
iCurNumShips++;		// LDH added for trace 03Sep06
continue;
};
locator = GetAttributeN(locator_ships, iCurNumShips);
iCurNumShips++;
break;
case 1:
if (iCurNumOtherShips >= iNumOtherShips) 
{ 
traceif("LocLoadShips: need (ships_other): " + iCurNumOtherShips + ", but max_num_ships_other: " + iNumOtherShips);
iCurNumOtherShips++;		// LDH added for trace
continue;
};
locator = GetAttributeN(locator_otherships, iCurNumOtherShips);
iCurNumOtherShips++;
break;
}
ShipModelrList[n] = GetCurrentModelrNumber(); // KK
if (CreateEntity(&locShips[n], "ship") == 0) break;
rCharacter = GetCharacter(iShips[n]); // PS
rShip = GetShipByType(GetCharacterShipType(rCharacter)); // PS
// Screwface : save the sea pos of player ship to avoid be reload nowhere when we go on worldmap just after sea loading
if(rcharacter.index == GetMainCharacterIndex() && !CheckAttribute(rCharacter,"Ship.Pos.save"))
{
rCharacter.Ship.Pos.save.x = rCharacter.Ship.Pos.x;
rCharacter.Ship.Pos.save.z = rCharacter.Ship.Pos.z;
}
// Screwface :end
rCharacter.Ship.Pos.x = stf(locator.x);
rCharacter.Ship.Pos.z = stf(locator.z);
// KK -->
if (CheckAttribute(locator, "vZ")) {
rCharacter.Ship.Ang.y = GetAngleY(stf(locator.vZ.x),stf(locator.vZ.z));
} else {
rCharacter.Ship.Ang.y = stf(locator.ay);
}
// <-- KK

// PB: Sailing Ships -->
ref lcn = &Locations[FindLocation(rPlayer.location)];
if(CheckAttribute(lcn, "island"))
{
string islandstr = lcn.island;
if(GetAttribute(Islands[FindIsland(islandstr)], "skipCR") != true)
{
for(j = 1; j < 7; j++)
{
DeleteAttribute(characterFromID("Cr" + islandstr + j),"sailaway");
if(rand(2) == 0) characters[GetCharacterIndex("Cr" + islandstr + j)].sailaway = true;
}
}
}
// PB: Sailing Ships <--

// ASVS -->
if(CheckAttribute(rCharacter,"sailaway"))
{
if(!CheckAttribute(rCharacter,"Ship.Strand"))					rCharacter.Ship.Strand = false;
if(!CheckAttribute(SeaCameras,"camera"))						SeaCameras.Camera = "SeaShipCamera";
if(!CheckAttribute(rCharacter,"ship.cannons.Charge"))			rCharacter.ship.cannons.Charge.Type = GOOD_BALLS;
if(!CheckAttribute(rCharacter,"TmpPerks.LongRangeShoot"))		rCharacter.TmpPerks.LongRangeShoot = false;
if(!CheckAttribute(rCharacter,"TmpPerks.shipspeedup"))			rCharacter.TmpPerks.shipspeedup = false;
if(!CheckAttribute(rCharacter,"TmpPerks.shipturnrateup"))		rCharacter.TmpPerks.shipturnrateup = false;
if(!CheckAttribute(rCharacter,"TmpPerks.sailingprofessional"))	rCharacter.TmpPerks.sailingprofessional = false;
if(!CheckAttribute(rCharacter,"TmpPerks.stormprofessional"))	rCharacter.TmpPerks.stormprofessional = false;
if(!CheckAttribute(rCharacter,"TmpPerks.turn"))					rCharacter.TmpPerks.turn = false;
rCharacter.Ship.stopped = false;
rCharacter.Ship.Speed.z = 1.5;
}
else
{
rCharacter.Ship.stopped = true;
rCharacter.Ship.Speed.z = 0.0;
}
// ASVS <--
Ship_PrepareShipForLocation(rCharacter);
// Screwface : section to send to setshipflag function the real number of ships who are physically in port and avoid CTD in some ports
if(!Checkattribute(rPlayer,"numcoastalindocks")){rPlayer.numcoastalindocks = 0;}
if(iCurNumOtherShips >= iCurNumShips)
rPlayer.numcoastalindocks = iCurNumOtherShips;
else
rPlayer.numcoastalindocks = iCurNumShips;

If(CheckAttribute(rCharacter,"fallen")) // Restore the fallen mast(s) to avoid crashes
{
DeleteAttribute(rCharacter,"ship.sails");
DeleteAttribute(rCharacter,"ship.masts");
DeleteAttribute(rCharacter,"fallen");
}
//If(CheckAttribute(GetMainCharacter(),"avoidflagsRe")){DeleteAttribute(GetMainCharacter(),"avoidflagsRe");}
// Screwface : end
SendMessage(&locShips[n],"laa",MSG_SHIP_CREATE,&rCharacter,&rShip);
}

// load boat 2 location
if (CheckAttribute(Location, "locators.reload.boat"))
{
if (bMainCharacterHere && iMainCharacterShipType != SHIP_NOTUSED)
{
if (CreateEntity(&locShips[n], "ship"))
{
makearef(locator,Location.locators.reload.boat);

rCharacter = GetCharacter(MAX_CHARACTERS+BOAT_CHARACTER);
rShip = GetShipByType(GetCharacterShipType(&rCharacter)); // PS
rCharacter.Ship.Pos.x = stf(locator.x);
rCharacter.Ship.Pos.z = stf(locator.z);
rCharacter.Ship.Ang.y = GetAngleY(stf(locator.vZ.x),stf(locator.vZ.z));
rCharacter.Ship.stopped = true;
rCharacter.Ship.Speed.z = 0.0;
Ship_PrepareShipForLocation(rCharacter);
SendMessage(&locShips[n],"laa",MSG_SHIP_CREATE,&rCharacter,&rShip);
locNumShips++;
}
}
}
else 
{
if (bMainCharacterHere)
{
traceif("LocLoadShips: Can't find boat locator in location: " + Location.id);
}
}
}
 
Does this look right as a switch? :?

Code:
switch(pchar.location)
{
case "Redmond_port":
if (o > 4)
{
iShipsType[locNumShips] = 2;
}
break;
case "Douwesen_port":
if (o > 3)
{
iShipsType[locNumShips] = 2;
}
break;
case "IslaMuelle_port":
if (o > 2)
{
iShipsType[locNumShips] = 2;
}
break;
iShipsType[locNumShips] = 1;
}
 
It seems that Captain Maggee's code is properly in place, but Doober's Realistic Ships mod is interfering with it.
There was a ship that was cearly too big for the Douwesen port model, but was still only class 5.
We'd need to figure out a simple way to decide which ships are too big to moor next to a jetty.
Maybe use number of cannons, cargo space, crewmember values or something?
If the worst comes to the worst, we might just have to add .jetty attributes to all ships that CAN moor alongside.

And for everyone who doesn't know, Captain Maggee added another ship locator type.
There is three locations (Redmond, Douwesen and Isla Muelle port) where ships can be moored alongside the jetty.
In those locations, there is now three types of locators:
- Ship: used for player and companion ships
- Ship_other: jetty locators
- Ship_big: locators out at sea

Captain Maggee's code checks if a ship is too big to be anchored alongside (currently based on ship class)
and puts it on a ship_big locator if so. If all ship_other locators are filled,
the rest of the ships are positioned on ship_big too.

One modification of Captain Maggee's that DOES apply to ALL ports is that player and companion ships now use ship locators
and no longer ship_other as before (in Build 13 the ship locators were seemingly unused).
This means that quest cases where ships are intended to be moored at a certain spot might need to be re-checked.
 
I would recommend doing it by crew size, that is the strongest correlation with ship size. There are some large ships with very few guns and cargo space is all over the place. If you tell me what the code would be for the jetty, I could add it into the appropriate ships in the ship_init.c file if that would be easier for you.
 
Thanks Doober! :doff

To Captain Maggee; I think you could try replacing this:
Code:
			switch(rplayer.location)
{
case "Redmond_port":
if (o >= 4)
{
iShipsType[locNumShips] = 2;
Logit("ship #" + locNumShips + ":   Ships Big: " + b + "   " + "ship class: " + GetCharacterShipClass(Characters[i]) + "   ship name: " + Characters[i].ship.name)
b++
}
else
{
iShipsType[locNumShips] = 1;
Logit("ship #" + locNumShips + ":   Ships Other: " + o + "   " + "ship class: " + GetCharacterShipClass(Characters[i]) + "   ship name: " + Characters[i].ship.name)
o++
}
break;
case "Douwesen_port":
if (o >= 3)
{
iShipsType[locNumShips] = 2;
Logit("ship #" + locNumShips + ":   Ships Big: " + b + "   " + "ship class: " + GetCharacterShipClass(Characters[i]) + "   ship name: " + Characters[i].ship.name)
b++
}
else
{
iShipsType[locNumShips] = 1;
Logit("ship #" + locNumShips + ":   Ships Other: " + o + "   " + "ship class: " + GetCharacterShipClass(Characters[i]) + "   ship name: " + Characters[i].ship.name)
o++
}
break;
case "Muelle_port":
if (o >= 2)
{
iShipsType[locNumShips] = 2;
Logit("ship #" + locNumShips + ":   Ships Big: " + b + "   " + "ship class: " + GetCharacterShipClass(Characters[i]) + "   ship name: " + Characters[i].ship.name)
b++
}
else
{
iShipsType[locNumShips] = 1;
Logit("ship #" + locNumShips + ":   Ships Other: " + o + "   " + "ship class: " + GetCharacterShipClass(Characters[i]) + "   ship name: " + Characters[i].ship.name)
o++
}
break;
iShipsType[locNumShips] = 1;
Logit("ship #" + locNumShips + ":   Ships Other: " + o + "   " + "ship class: " + GetCharacterShipClass(Characters[i]) + "   ship name: " + Characters[i].ship.name)
o++
}
With this:
Code:
			if (o >= GetAttributesNum(locator_otherships))
{
iShipsType[locNumShips] = 2;
Logit("ship #" + locNumShips + ":   Ships Big: " + b + "   " + "ship class: " + GetCharacterShipClass(Characters[i]) + "   ship name: " + Characters[i].ship.name)
b++
}
else
{
iShipsType[locNumShips] = 1;
Logit("ship #" + locNumShips + ":   Ships Other: " + o + "   " + "ship class: " + GetCharacterShipClass(Characters[i]) + "   ship name: " + Characters[i].ship.name)
o++
}
 
What would you say to this, Captain Maggee?
Code:
		if (b < iNumJettyShips && JettyShip(Characters[i]))
{
iShipsType[locNumShips] = 2;
Logit("ship #" + locNumShips + ":   Ships Jetty: " + b + "   " + "ship class: " + GetCharacterShipClass(Characters[i]) + "   ship name: " + Characters[i].ship.name);
b++
}
else
{
iShipsType[locNumShips] = 1;
Logit("ship #" + locNumShips + ":   Ships Other: " + o + "   " + "ship class: " + GetCharacterShipClass(Characters[i]) + "   ship name: " + Characters[i].ship.name);
o++
}
 
Back
Top