PiratesAhoy! is a community for all fans of pirates and the Age of Sail, centred around games, books, and movies. We are best known for our 'New Horizons' mod for PotC and 'Gentlemen of Fortune' mod for AoP2:CoAS, and are currently developing 'New Horizons Remastered' as a standalone title.

Forum Thread
  Posts  
Improved Random Encounter Code (FIX) (Company : PiratesAhoy! Community : Forum : PotC Modding and Brainstorming : Improved Random Encounter Code (FIX)) Locked
Thread Options
Pieter_Boelen
Pieter_Boelen Third Officer
May 31 2011 Anchor

As per the discussion with Armada and Miklkit on the possibility of the player ship being generated in encounters, I have rewritten this code so that it returns a random period-correct ship instead as per Miklkit's suggestions. See here for the file:

Yousendit.com
Extract to PROGRAM\Ships

Please test and see if it works. If you want to REALLY test it thoroughly, find this line in there:
while(!finish && end < 200) // maximum of 100 loop should be enough
Change the "200" to a MUCH lower value, maybe even 1 or 2. In that case, the new code should be triggered relatively frequently.

Miklkit
Miklkit curmudgeon
May 31 2011 Anchor

Got it! I don't know how much of a tester I will be for this since I sail common ships. I'm currently sailing a pinnaceofwar40g because I'm re-rigging it. Will be for days. What a mess!

Pieter_Boelen
Pieter_Boelen Third Officer
May 31 2011 Anchor

Well, since I commented out the line that generates the player ship in encounters, that cannot possibly happen anymore. The only question is, does the replacement code work?

I just did a test and apparently my code does work. So no more player ships in encounters.

--

Pirates of the Caribbean: New Horizons News and Downloads
Latest Stable Release: Build 13 Final
Latest Playable Beta: Build 14 Beta 1 Patch 5

May 31 2011 Anchor

I've never seen my own ship in an encounter - that's a freaky bug ;) when did that creep in(must have been during Build Mod 13 - Build Mod 14?). But i'll test the code also. What exactly are you looking for, so that i know what to look out for!

And will it require a new char start?

Edited by: BlackBart

Pieter_Boelen
Pieter_Boelen Third Officer
May 31 2011 Anchor

No new start necessary. It's a rare occurrance, but I've seen it occasionally. It got more frequent in later Build release because we put more limits on the ships that can be generated. It's especially obvious when you're using a non-common ship, especially a quest ship such as the Black Pearl.

--

Pirates of the Caribbean: New Horizons News and Downloads
Latest Stable Release: Build 13 Final
Latest Playable Beta: Build 14 Beta 1 Patch 5

Miklkit
Miklkit curmudgeon
May 31 2011 Anchor

Why me.......:paranoid:

I just came from an encounter with a 4 ship pirate fleet. Two of them were the same ship I'm sailing, the pinnaceofwar40g.

Pieter_Boelen
Pieter_Boelen Third Officer
May 31 2011 Anchor

That's not impossible. There is no code in place to actively prevent the player ship from being used in random encounters. Now, the ships generated simply doesn't ever depend on the player ship anymore, so these two ships should've been chosen purely at random.

Basically, what the game tried to do is to select a ship from the list of all ships. If it fails on first try, it'll try again and again until it's tried 100 (or 200) times. If still no ship was found, originally the player ship was generated instead. With the new code as per your suggestions, instead of the player ship, one of your choice ships will show up instead. That'll prevent double Black Pearls at sea, for example.

--

Pirates of the Caribbean: New Horizons News and Downloads
Latest Stable Release: Build 13 Final
Latest Playable Beta: Build 14 Beta 1 Patch 5

Jun 1 2011 Anchor

Well so far everything seems ok, as far as i can tell ;) I get the log readout of the ships generated, and ok sometimes they might be a 'Lugger'(the start ship i'm still using during testing etc), but they never look or are named like mine(was that the bug, the exact same ship as the players?). But yeah i've seen about 50 or so ships generated since using your new Ships.c file Pieter and it seems ok to me?

Pieter_Boelen
Pieter_Boelen Third Officer
Jun 1 2011 Anchor

Thanks, mate. I reckon the problem should be solved now.

--

Pirates of the Caribbean: New Horizons News and Downloads
Latest Stable Release: Build 13 Final
Latest Playable Beta: Build 14 Beta 1 Patch 5

Jun 1 2011 Anchor

...and i never even got to see it :(

;)

Pieter_Boelen
Pieter_Boelen Third Officer
Jun 1 2011 Anchor

HA! Be happy. It was an uncommon problem anyway and it'd only be obvious if you used an uncommon ship, such as the Black Pearl.

--

Pirates of the Caribbean: New Horizons News and Downloads
Latest Stable Release: Build 13 Final
Latest Playable Beta: Build 14 Beta 1 Patch 5

Reply to thread
click to sign in and post

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.