1. Dismiss Notice
  2. GOG.com logo

    Thanks to YOUR votes, GOG.com now sells:
    - Sea Dogs - Sea Dogs: Caribbean Tales
    - Sea Dogs: City of Abandoned Ships

    Vote now to add Pirates of the Caribbean to the list!

    Dismiss Notice
  3. Under the Crossbones Podcast

    A Pirate Podcast with Interviews
    Music, Comedy and all things Pirate!

    - Episode Guide - About - Subscribe -
    - Twitter - Facebook - iTunes - Android -
    - Youtube - Fill the Coffers -

    Dismiss Notice
  4. New Horizons logo

    Quick links for PotC: New Horizons
    - Download latest version
    - Wiki - FAQ - Report bugs here
    - ModDB profile

  5. GOF logo

    Quick links for AoP2: Gentlemen of Fortune 2
    - Downloads and info
    - Historical Immersion Supermod
    - ModDB Profile

Dismiss Notice
New to the forum?
Please take a moment to read our Welcome Message and Forum Rules.

Change ships cabins in an existing game

Discussion in 'Storm Coding' started by Alloppatalle, Jan 31, 2016.

  1. Alloppatalle

    Alloppatalle Landlubber

    Joined:
    Jan 26, 2016
    Messages:
    24
    I am trying to see if it is possible to change the ships cabins in a game that is already started (from a first preliminary test, I managed to change them in a new game).

    Looking through the code, cabins are assigned to ships in Ships_init.c, and all the properties of these cabins are in boarding.c (there are actually 2 copies of this file, but from my tests only editing the one in "Locations\init" worked).

    Now, what I have done using console.c, is:
    • Reinit ships
    • Reinit boarding locations

    But this wasn’t enough, because the cabin of my ship didn’t change. I finally managed to change it regenerating my ship with pchar.Ship.Type = GenerateShip(SHIP_Name, true); in console.c.

    I am not a programmer, and I have no knowledge of Storm Engine coding, so I’d like to know if it safe to change cabins like this.
    And what happens to other ships of the same type? I regenerated the ship only for the main character, right (the pchar in the code)? So the others generated before the ships reinit still have the old cabins?
     
  2. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,628
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Specifically which game are you talking about?
    The answer is different for different games.
     
  3. Alloppatalle

    Alloppatalle Landlubber

    Joined:
    Jan 26, 2016
    Messages:
    24
    Oh yes sorry, I forgot to specify it. :oops:
    It's Age of Pirates 2 CoAS
     
  4. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,628
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    In that case, I am not entirely sure.
    Does that game have the cabins per ship specified in ships_init.c?
    And does it have a reinitialize functionality?
     
  5. Alloppatalle

    Alloppatalle Landlubber

    Joined:
    Jan 26, 2016
    Messages:
    24
    In ships_init.c there are the ship-cabin associations in the form of refship.CabinType = "Cabin_Small";.
    In boarding.c there is a block of code for every cabin that defines the paths to models, to locators, etc.

    There is a reinit button in the mod options (it's GoF), but I successfully did a reinit of ships and boarding locations using console.c (I printed some of the updated values in game to be sure the reinit worked).

    But my problem was that - even though I did a reinit of those 2 files - whenever I entered my cabin, the game still used the old one. From what I understood, my ship still had the old attributes (like name, cabin type, etc.), that don't get updated automatically after a reinit. So I had to regenerate my ship to see the new cabin.

    Now I don't know if regenerating my ship is safe... it works, but will there be strange bugs? What I'm asking is if I can use the GenerateShip function to regenerate every ship I change the cabin to without problems...
     
  6. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,628
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    I cannot vouch for that CoAS function, but I'll describe how it goes in PotC.
    When you do a reinit, all newly generated ships get the new stats, but the ships that were generated already keep their old ones.
    To update those too, you indeed need to regenerate those ships.
    In PotC, I use a function that we wrote Isles for that named GiveShip2Character. That is probably functionally equivalent to that CoAS function you mention.
    I think it works fine in PotC.

    So I'd say: try that GenerateShip function in CoAS and see what happens.
    With a bit of luck, it also works fine. And in the worst case, at least you'll know for sure that it doesn't.
     
  7. Hylie Pistof

    Hylie Pistof Curmudgeon Staff Member QA Tester Storm Modder

    Joined:
    Jan 15, 2010
    Messages:
    13,768
    Gender:
    Male
    In COAS when you make a change to a ship's stats a new game is required.

    I get around that by starting a game where all ships are in the shipyard and the character has like $5,000,000 and then save. I make my changes and start a new game. Go buy the ship and outfit it and then go sailing to see how it does.

    Rinse and repeat as needed.
     
  8. Alloppatalle

    Alloppatalle Landlubber

    Joined:
    Jan 26, 2016
    Messages:
    24
    I saw that GenerateShip is used to assign the ships to characters, so probably is similar to that GiveShip2Character in PotC...
    Anyway, I will see what happens, as you suggested.

    Yea, I noticed that with this experiment of cabins. But I was able to change the stats anyway (at least, the CabinType) regenerating the ship; I just hope not to bug the game!
     
    Pieter Boelen likes this.

Share This Page