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

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

Grey Roger

Sea Dog
Staff member
Administrator
Storm Modder
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
 
why would you need multiple copies each time you promote ..
@Pieter Boelen ?
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
 
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
Or set an attribute (probably one is set already) and check this attribute
 
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)
 
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.

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.
Agreed. :cheeky
I suggested it as possible solution. Not necessarily the best one. ;)
 
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. ;)
 
I just thought it would be nice to be able to do something with them. Selling them is the obvious choice.
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

Or, if someone is feeling ambitious, maybe a library would be willing to offer something in return for a copy of the book. ;)
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
 
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 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.
 
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.
 
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
 

Attachments

  • governor.c
    15.7 KB · Views: 150
  • NK.c
    197.7 KB · Views: 133
  • quests_common.c
    221.6 KB · Views: 137
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
 

Attachments

  • governor.c
    15.8 KB · Views: 144
  • NK.c
    197.7 KB · Views: 136
Agh, did I put the line of code in the wrong spot? Oops!
Thanks for catching. :onya
 
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...
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
 
Nevertheless, until I added those lines, I was able to get multiple copies of the book. With the lines added, I did not.
 
Nevertheless, until I added those lines, I was able to get multiple copies of the book. With the lines added, I did not.
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.
 
Back
Top