• 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!

Ships Sailing in Port/Shore Scene

Pieter Boelen

Navigation Officer
Administrator
Storm Modder
Hearts of Oak Donator
Today I went to experiment with a simple virtual sailor's original idea of having ships sailing in port/shore mode.
In PROGRAM\Locations\locations_loader.c find:<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->        rCharacter.Ship.stopped = true;
        rCharacter.Ship.Speed.z = 0.0;<!--c2--></div><!--ec2-->And replace with:<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->        // ASVS -->
        if(CheckAttribute(rCharacter,"sailaway")
        {
            rCharacter.Ship.stopped = false;
            rCharacter.Ship.Speed.z = 1.5;
        }
        else
        {
            rCharacter.Ship.stopped = true;
            rCharacter.Ship.Speed.z = 0.0;
        }
        // ASVS <--<!--c2--></div><!--ec2-->
Now if you set, for example, <i>characters[GetCharacterIndex("CrCayman6")].sailaway = true;</i> through console,
that ship will end up sailing in the Cayman port scene when you anchor. Which makes it look like the ship is passing by.
This seems pretty cool for sure and I wonder if we can put that to use in random instances.

However, a couple of limitations apply to this mod:

- The ships do NOT do any land avoiding and if they're headed for shore, they WILL crash into it.

- The ship that goes sailing must be owned by a "qualified captain", eg. a captain who has already captained a ship in 3D sailing mode at some point.
Otherwise lots of error messages will occur, resulting in lag. <img src="style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" />
 
Here's a picture of the Cayman example:
<img src="http://piratesahoy.net/build/temp/CrCayman6.jpg" border="0" class="linked-image" />

Of course this can also be applied to the marooning of Jack Sparrow by Barbossa:
<img src="http://piratesahoy.net/build/temp/BPMutiny.jpg" border="0" class="linked-image" />
 
<!--quoteo(post=334612:date=Jul 2 2009, 03:42 PM:name=Pieter Boelen)--><div class='quotetop'>QUOTE (Pieter Boelen @ Jul 2 2009, 03:42 PM) <a href="index.php?act=findpost&pid=334612"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->- The ship that goes sailing must be owned by a "qualified captain", eg. a captain who has already captained a ship in 3D sailing mode at some point.
Otherwise lots of error messages will occur, resulting in lag. <img src="style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" /><!--QuoteEnd--></div><!--QuoteEEnd-->The above sounds pretty good, but I'm having some tremendous problems with this for the mutiny scene.
The problem comes from not having any definite "qualified captain". I was thinking of re-using a character that already has been your companion.
However, there IS no character who already has been your companion. At least sometimes there might not be.

Then I tried to add a companion to the player right before the mutiny, but couldn't get a reload-to-mutiny to happen right after the reload to sea.
Instead both reloads would happen sort-of at the same time.
So then I tried using one of the coastraiders, which works, but I don't know if that will mess anything up.
 
I hope it doesn't mess it up and you can get it working

It is really cool <img src="style_emoticons/<#EMO_DIR#>/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" />
 
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->        // 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 <--<!--c2--></div><!--ec2-->How do you like THEM apples? <img src="style_emoticons/<#EMO_DIR#>/w00t.gif" style="vertical-align:middle" emoid=":woot" border="0" alt="w00t.gif" />
Now you should be able to use ANY character and if he doesn't have the required attributes, they get added. No reload to sea required.
Hopefully this doesn't have any unintended side-effects. <img src="style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" />
 
You can't tell from the picture, but this was taken with the version that seems to work well:
<img src="http://piratesahoy.net/build/temp/BPMutiny_v2.jpg" border="0" class="linked-image" />

<b>Edit:</b> Tested some more and it seems to work.
Of course in this case I was testing with a character as "captain" who you will never encounter as captain again.
It is the random drunk from the tavern who is only there if ENABLE_CHEATMODE is on to provide shortcuts to various parts of the quest. <img src="style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
 
Congratulations <img src="style_emoticons/<#EMO_DIR#>/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" />
 
That is nice, should add a lot of atmosphere! <img src="style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
 
Wow! This opens up a lot of opportunities to create more life in general to the beaches and harbours. The event "sailaway" can probably be set to random and so can the speed for variety, right?

Adding temporal skills to a existing character is great, geniously figured out Pieter. Does cheatmode really have to be enabled in order to perform this "stunt"?
 
<!--quoteo(post=334746:date=Jul 3 2009, 07:20 PM:name=PeterWillemoes)--><div class='quotetop'>QUOTE (PeterWillemoes @ Jul 3 2009, 07:20 PM) <a href="index.php?act=findpost&pid=334746"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Wow! This opens up a lot of opportunities to create more life in general to the beaches and harbours. The event "sailaway" can probably be set to random and so can the speed for variety, right?

Adding temporal skills to a existing character is great, geniously figured out Pieter. Does cheatmode really have to be enabled in order to perform this "stunt"?<!--QuoteEnd--></div><!--QuoteEEnd-->
No Peter, Pieter was refering to the character "Random Drunk" who will only appear in the Jack Sparrow storyline if you have cheatmode on at the start <img src="style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />

It is possible to make a character to do this this "stunt" without cheatmode <img src="style_emoticons/<#EMO_DIR#>/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" />
 
Argh! <img src="style_emoticons/<#EMO_DIR#>/blush.gif" style="vertical-align:middle" emoid=":eek:ops" border="0" alt="blush.gif" /> Ok thank you Captain Maggae what a great idea anyway. The horizon is always so empty.
 
Captain Maggee is correct; you just need the cheatmode enabled to be able to instantly test the mutiny scene.

Theoretically we would indeed be able to make a random ship sail away and even adjust the speed, I think.
However, the ship will sail in a straight line from it's original position and course, so it won't always look right.

If we are going to randomize this, we have to do it in such a way that it doesn't look stupid.
Of course the current ships-moored-in-port mod ALSO sometimes looks stupid with Manowars moored next to the jetty and such.
That'll need changing somehow too at some point before the final Build 14 release.
I suppose we might be able to combine both efforts in a general "lively port" mod. If somebody cares to work on it. <img src="style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" />
 
The good:
<img src="http://www.piratesahoy.net/build/temp/the_good.jpg" border="0" class="linked-image" />

The bad:
<img src="http://www.piratesahoy.net/build/temp/the_bad.jpg" border="0" class="linked-image" />

We could go over all the ports and check which coast raiders are positioned for a proper sail-away and which ones would go through something.
However, if you have companions, I expect that the position of the coastraiders might change.
Eventually we'll need to figure out how to put a ship on a certain locator in port and then randomly have the ship from the correct locators sail away.
If we can put certain ships on certain locators, we can also ensure that too big ships do not end up moored at the jetty.
 
I'm not having any luck with sinking in port scene though:<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->        // PB -->
        if(CheckAttribute(rCharacter,"sink"))
        {
            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;
            // This code copied and adjusted from AIShip.c
            rCharacter.Ship.Sink = "";
            aref aSink; makearef(aSink, rCharacter.Ship.Sink);
            aSink.Speed.y = 0.35;    // speed of sink y
            aSink.Speed.x = 0.017 * (frnd() * 2.0 - 1.0);    // speed sink angle rotate around x
            aSink.Speed.z = 0.017 * (frnd() * 2.0 - 1.0);    // speed sink angle rotate around z
            rCharacter.Ship.stopped = false;
            Event(SHIP_DEAD, "l", sti(rCharacter.index));
        }
        // PB <--<!--c2--></div><!--ec2-->
Suggestions would be welcome. <img src="style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" />
 
Didn't. That last one shows the French ship sailing THROUGH the player ship.
 
Oops; sorry. I must've not been paying attention. <img src="style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" />

<b>Edit:</b> On second thought... the not-working sinking ship code is pretty ugly. <img src="style_emoticons/<#EMO_DIR#>/razz.gif" style="vertical-align:middle" emoid=":razz" border="0" alt="razz.gif" />
 
Hmm... I'm thinking tomorrow I could try to come up with some code that randomly makes one of the coastraiders sail away.
We can see what that ends up looking like. Maybe it won't be as bad as I fear... <img src="style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" />
 
And what about attacks?! I'm thinking about the The scene were the black pearl attacks port royal in COTBP?
 
Back
Top