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.

Fix in Progress Receive "The Art of War" Book Again Upon Each Promotion

Discussion in 'Bug Archive' started by Grey Roger, Sep 9, 2016.

  1. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,415
    When you first get a LoM, you get a free copy of "The Art of War". You also get one each time you're promoted if you're not carrying it already.

    Being a tidy person, you don't carry books around with you, you put them in your ship's locker. So when you get your next promotion, you get another copy, which duly goes into the locker. And so on.

    So you end up with rather a lot of copies of "The Art of War", especially if you're a privateer with multiple LoM's.

    Can the price be raised from 1 so we can sell them? xD
     
  2. Levis

    Levis Find(Rum) = false; Staff Member Programmer Creative Support Storm Modder

    Joined:
    Oct 6, 2013
    Messages:
    6,707
    Gender:
    Male
    Occupation:
    ICT
    Location:
    University Twente (Netherlands)
    why would you need multiple copies each time you promote ..
    @Pieter Boelen ?
     
  3. Pieter Boelen

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

    Joined:
    Nov 11, 2004
    Messages:
    66,623
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    You don't!

    I think an if(!CheckCharacterItem(pchar, "Relation_Book") statement might help.
    Though come to think of it.... I probably already added that for this very reason!
    But if you can put the book in your chest, then you don't actually have it, that check returns 'true' and you get it. Again.

    If that is indeed the case, I can think of two options:
    1. Set the price to 0 so that you cannot put it in a chest
    2. Not just check the player for that item, but check the ship chest as well
     
  4. Levis

    Levis Find(Rum) = false; Staff Member Programmer Creative Support Storm Modder

    Joined:
    Oct 6, 2013
    Messages:
    6,707
    Gender:
    Male
    Occupation:
    ICT
    Location:
    University Twente (Netherlands)
    Or set an attribute (probably one is set already) and check this attribute
     
  5. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,415
    1 is bad. You don't want to be carrying unnecessary items in case you end up being unable to carry any more, not to mention the minro problem of having to scroll through an unnecessarily large inventory.
    2 is alright. Or why not set an attribute to note the fact that you've had the book, then not give it if that attribute is set?
    (Looks like @Levis had the same idea at the same time. xD)
     
  6. Pieter Boelen

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

    Joined:
    Nov 11, 2004
    Messages:
    66,623
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    That should work too. Maybe there is already something being set at that time which can be checked.

    Relevant files are PROGRAM\QUESTS\quests_common.c and probably PROGRAM\Characters\CharacterUtilite.c .

    One of you guys is welcome to try doing it.
    I am also willing to do it, but of course it'll have to wait a bit longer then.
    As a temporary fix, you could set the price to 2 just so you can get rid of them in the meantime (just do a Reinit and you should be good).

    I'm moving this to the Bug Tracker, because it does sound like an actual error.

    Agreed. :cheeky
    I suggested it as possible solution. Not necessarily the best one. ;)
     
  7. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,415
    It's not exactly high priority. Owners of "The Art of War" can just do what I've been doing, which is store them in the ship's locker and see how many you can collect. For added value, every time you get a promotion, hand it to your nearest officer. That way, if you have built up lots of relation points by attacking enemies and can collect several promotions at once, you can get all the books without having to go back and forth between the townhall and your ship. :D

    I just thought it would be nice to be able to do something with them. Selling them is the obvious choice. Or, if someone is feeling ambitious, maybe a library would be willing to offer something in return for a copy of the book. ;)
     
    Pieter Boelen likes this.
  8. Pieter Boelen

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

    Joined:
    Nov 11, 2004
    Messages:
    66,623
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    The one thing that makes me a bit uncomfortable about allowing players to get sell them is:
    What is the chance of a player getting the book, not bothering to read it (having no clue about the contents),
    selling it for some quick cash and then when they find out they do need to know about the contents, they can longer have it and can no longer get it.
    Based on past experiences, I can pretty much guarantee that players will be doing that. :facepalm

    That could potentially be a solution, in one of two ways:
    1. Make sure it can ONLY be sold to the library (through dialog) and make sure the dialog asks the player if they're absolutely sure they're done with the book and will no longer need it
    2. Similar, but have the sale through Interface, then make sure the Library NEVER gets new items so that, if you are really in need, you can buy it back
     
  9. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,415
    I wasn't thinking of a sale. Sale is for quick and easy disposal - since they're freely available to any privateer, the market is probably saturated, so set the price to 2 (minimum that actually allows them to be sold) and let them be sold to any store or trader.

    The library might offer something else. Maybe trade them directly for other books, with a 1:1 swap for "Under the Jolly Roger" and lots:1 for other books - give the library five "Art of War" in exchange for one skill book of your choice, perhaps. Or some sort of side quest. Or whatever someone else fancies writing up. ;)
     
    Pieter Boelen likes this.
  10. Levis

    Levis Find(Rum) = false; Staff Member Programmer Creative Support Storm Modder

    Joined:
    Oct 6, 2013
    Messages:
    6,707
    Gender:
    Male
    Occupation:
    ICT
    Location:
    University Twente (Netherlands)
    @Pieter Boelen can I leave this one for you? Shouldn't be hard to fix right? But I think you know best when or when not to add the book to the character.
     
  11. Pieter Boelen

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

    Joined:
    Nov 11, 2004
    Messages:
    66,623
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    No worries; I'll get to it eventually. Should be relatively simple.

    Easiest is probably what @Grey Roger suggested: Add a character attribute when the book is first given, then never give it again.
    After that, it is up to the player what to do with that one book he's got.
     
    Levis likes this.
  12. Pieter Boelen

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

    Joined:
    Nov 11, 2004
    Messages:
    66,623
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    I think attached files should fix this. Based on the 28 July 2016 code.
    For newer versions, be sure to WinMerge these files!

    governor.c goes into PROGRAM\DIALOGS
    quests_common.c goes into PROGRAM\QUESTS
    NK.c goes into PROGRAM
     

    Attached Files:

  13. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,415
    Having received a promotion from Silehard, then bought LoM's from Kralendijk and Sao Jorge, I noticed that I now had four copies of "Art of War". Something isn't working. ;)

    The code to give you the book checks for the presence of attribute "PChar.Got_Relation_Book", which is set at case "Got_Relation_Book" in "quests_common.c", which is activated when you read the book. You know me - that's never going to happen. :p The quest case is never activated, the attribute is never set, and now I keep collecting books even if I'm carrying them...

    In these versions of "governor.c" and "NK.c", the attribute is set when you are given the book. Or, to put it another way, the game notes "Got_Relation_Book" when you have got "relationbook", not just when you've used it. ;) I've tested this by using 'dumpattributes' before and after buying the LoM at Sao Jorge, and also by reporting back to Silehard - it's been some time since I last saw him and I have a couple of promotions to cash in. Both buying a LoM and getting a promotion now set the attribute, which means I get one more book and then that's the last one. And if you start a new game with these files in place, you'll only ever receive one, so try not to lose it. xD
     

    Attached Files:

    • governor.c
      File size:
      15.8 KB
      Views:
      19
    • NK.c
      File size:
      197.7 KB
      Views:
      17
  14. Pieter Boelen

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

    Joined:
    Nov 11, 2004
    Messages:
    66,623
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Agh, did I put the line of code in the wrong spot? Oops!
    Thanks for catching. :onya
     
  15. Pieter Boelen

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

    Joined:
    Nov 11, 2004
    Messages:
    66,623
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    I am excluding that change from my game version, because it should not be necessary.
    That case should already be executed when you GET the book, not when you READ it:
    Code:
       ch.quest.Got_Relation_Book.win_condition.l1 = "item";
       ch.quest.Got_Relation_Book.win_condition.l1.character = ch.id;
       ch.quest.Got_Relation_Book.win_condition.l1.item = "relationbook";
       ch.quest.Got_Relation_Book.win_condition = "Got_Relation_Book";
    
    So I'm not sure why you had to make that change. :shock
     
  16. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,415
    Nevertheless, until I added those lines, I was able to get multiple copies of the book. With the lines added, I did not.
     
  17. Pieter Boelen

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

    Joined:
    Nov 11, 2004
    Messages:
    66,623
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    For my fix to work as intended, you did need to start a New Game after the fix was added.
    If so, then it should work. But if you still had a savegame from prior to that, then it might indeed not have worked.

    To be sure, you can use the savegame that was affected by it, then execute this through console:
    Code:
      pchar.quest.Got_Relation_Book.win_condition.l1 = "item";
      pchar.quest.Got_Relation_Book.win_condition.l1.pchararacter = pchar.id;
      pchar.quest.Got_Relation_Book.win_condition.l1.item = "relationbook";
      pchar.quest.Got_Relation_Book.win_condition = "Got_Relation_Book";
    
    That sets the attributes that would have been added on a New Game, so you can check if that indeed explains it.
     

Share This Page