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

PTBR Translation

The way I did it initially, the code flow does not go through the "agree fetch" block (tailor.c/shipyard.c file etc.) so it does not configure the input characteristics in QB.
The entry is left without a title and without the first descriptive paragraph (text.t1 of fetch.txt).
The solution I adopted for my use is a new code block ("config the fetch") with the instructions from the "agree fetch" block. I didn't know how to make a block or routine without a dialog, so it's an adjusted code duplicate.
Better would probably to not have a questbook at all. You don't need to be told what to fetch, to where, by what date, if you already have the goods! In the version of "tailor.c" which I found in your zip file, if you have the goods already then the dialog proceeds straight to case "fetch quest complete". Copy that instead, and leave out these lines:
Code:
            questbookname = "fetch&number="+NPChar.fetch_quest.cargoid+NPChar.index; //Set a questname
            AddQuestRecord(questbookname, 3);
            CloseQuestHeader(questbookname);
Code:
            PChar.quest.(questbookname).over = "yes"; // GR: cancel quest fail timer

What I know about the syntax and functions of these scripts is very scarce so I have to use trial and error.
a_map.c items.c

This snippet looks to me like displaying details from the inventory.

View attachment 45095
The line in "a_map.c" is for when you are looking at the archipelago map and you click on an island, which brings up a map of the island provided you have a map of the island. The line in "items.c" is for when you examine a map in your inventory and is at the bottom of a long function called "I_ExamineItem()". An important pair of lines in both files, before the line you found, is:
Code:
    aref itmRef;
    if (Items_FindItem(itmName, &itmRef) >= 0 && CheckAttribute(itmRef, "index")) GameInterface.ItemIdx = itmRef.index;
You probably want to look more at the one in "a_map.c" because that is the one which checks that you have the map before trying to show it. "items.c" does not need to do that because you've been scrolling through your inventory - if you've found the map to examine then obviously you have it!

Here in my BNH game, the mission "Help the church", I entered the crypt labyrinth before taking on the mission, I picked up a cross, a rifle and a book.
And when I took on the mission, I couldn't finish it. I noticed that pchar.quest.telescope_quest.foundbook didn't assume the value true (although there is a fix for this in case you didn't take on the mission), I don't know if it's something I did or a code bug, if you want to check, send Sabegame immediately before picking up these items.
If I have time, I'll look into that, but again I have a couple of other projects in progress.
 
Better would probably to not have a questbook at all. You don't need to be told what to fetch, to where, by what date, if you already have the goods! In the version of "tailor.c" which I found in your
Good idea.
The line in "a_map.c" is for when you are looking at the archipelago map and you click on an island, which brings up a map of the island provided you have a map of the island. The line in "items.c" is for when you examine a map in your inventory and is at the bottom of a long function called "I_ExamineItem()". An important pair of lines in both files, before the line you found, is:
Yes, i see it.
But what would an instruction be like to open the cave map without accessing the inventory?
I already understood how to check if I'm in the cave before.
If I have time, I'll look into that, but again I have a couple of other projects in progress.
No stress.
 
Yes, i see it.
But what would an instruction be like to open the cave map without accessing the inventory?
I already understood how to check if I'm in the cave before.
I'm not sure. There are still quite a few areas of code which I don't fully understand, and that's one of them. In any case, unless you want to do this for all dungeons, not just the Maltese crypt, there's little point. Players will still need to examine dungeon maps using the inventory, so that's what they'll expect to do in the crypt as well.

As for fetch dialogs, it occurs to me that you might not need to copy anything. If the player already has the goods then you're bypassing case "agree fetch", which is where the questbook is started. So, in case "agree fetch", add:
Code:
NPChar.quest.book_started = true;
Then, in case "fetch quest complete", replace this:
Code:
questbookname = "fetch&number="+NPChar.fetch_quest.cargoid+NPChar.index; //Set a questname
AddQuestRecord(questbookname, 3);
CloseQuestHeader(questbookname);
... with this:
Code:
if (CheckAttribute(NPChar, "quest.book_started"))
{
        DeleteAttribute(NPChar, "quest.book_started");
        questbookname = "fetch&number="+NPChar.fetch_quest.cargoid+NPChar.index; //Set a questname
        AddQuestRecord(questbookname, 3);
        CloseQuestHeader(questbookname);
        PChar.quest.(questbookname).over = "yes"; // GR: cancel quest fail timer
}
That last line is currently at the end of case "fetch quest complete", so it can be deleted from there if it's being copied into this condition.

Incidentally, one of those other projects involves the "Bellona" class ship of the line. Start any new game and run this version of "console.c". Then look at your "Ship" interface. You'll probably have a "Bellona class 3rd Rate" named Bellona class 3rd Rate.

Then edit "PROGRAM\Ships\Ships_init.c". Find this line:
Code:
refShip.SName                = "Bellona";
Change it to:
Code:
refShip.SName                = "BellonaClass";
Also edit your version of "common.ini", find this line:
Code:
string = Bellona,"Bellona class 3rd Rate"
Change it to:
Code:
string = BellonaClass,"Bellona class 3rd Rate"
If you're editing your Portuguese version, "Bellona class 3rd Rate" will be whatever you have. That can stay unchanged. The important part is the part before the comma, which must match what is in "Ships_init.c". At the moment it is 'Bellona', which is why, if you have been given a ship named Bellona, the name will be translated into the class name.

Start another new game, run that console again, and this time you should have a "Bellona class 3rd Rate" named Bellona.
 

Attachments

  • console.c
    35.3 KB · Views: 12
I'm not sure. There are still quite a few areas of code which I don't fully understand, and that's one of them. In any case, unless you want to do this for all dungeons, not just the Maltese crypt, there's little point. Players will still need to examine dungeon maps using the inventory, so that's what they'll expect to do in the crypt as well.
Yes, it´s the idea.
A swtich with a case for each location, dungeon cave etc.
only miss de statment to opem the map.
 
As I said, I don't fully understand the code for opening the map myself. So, you'll need to learn how to read log files "system.log" and "error.log" because you will get this wrong at first and those files will give clues as to what is wrong. Expect the game to either crash out, hang, or do something silly.

That said:
There seem to be some variables needed in both "a_map.c" and "items.c" for this to work. In "a_map.c":
Code:
string itmName = "map" + isIsland;
Code:
            aref itmRef;
            if (Items_FindItem(itmName, &itmRef) >= 0 && CheckAttribute(itmRef, "index")) GameInterface.ItemIdx = itmRef.index;
So "itmName" is being set to the map of an island whose name is in "isIsland". "itmRef" is then set by function 'Items_FindItem' to the map item, from which "itmRef.index" is its index within the "Items" array. This is then put into "GameInterface.ItemIdx", which seems to be used by "LaunchIAfterFrame".

In "items.c", at the top of function "I_ExamineItem()":
Code:
    string itmName = GetItemIDByOrder(nCurScroll);
    aref itmRef;
    if (Items_FindItem(itmName, &itmRef) >= 0 && CheckAttribute(itmRef, "index")) GameInterface.ItemIdx = itmRef.index;
This one takes "itmName" from the inventory scroll, then uses the same code to find the item, then put its index into "GameInterface.ItemIdx".

So my guess is that you'll need to declare string "itmName", assign the correct map name to it in that switch based on location, then use the same code to put the map item's index into "GameInterface.ItemIdx".

How do you detect that "M" has been pressed?
 
As I said, I don't fully understand the code for opening the map myself. So, you'll need to learn how to read log files "system.log" and "error.log" because you will get this wrong at first and those files will give clues as to what is wrong. Expect the game to either crash out, hang, or do something silly.
I will try to understand this..

How do you detect that "M" has been pressed?
file seadogs.c line 2134

switch(interfaceResultCommand) this should contain all commands

I didn't detected it, I looked with notepad++ for possible instructions that would do such a thing.
I found LaunchPelagoMap();
At first I tested with console:
LaunchPelagoMap(mapname/filename);

So I did more research from this and I got to the files a_map b_map etc., in one of these I found the code point that detects the M key, it is at this point that I should insert the modifications.
___________________________________________________________________________________________________

console does not accept definition: string isIsland = Islands[isIdx].id;

above open mapOxbay_Dungeon of your inventory when closing it displays inventary map, I'm close.
aref itmRef;
if (Items_FindItem("mapOxbay_Dungeon", &itmRef) >= 0 && CheckAttribute(itmRef, "index")) GameInterface.ItemIdx = itmRef.index;
PostEvent("LaunchIAfterFrame",1,"sl", "I_MAP", 2);

OR

aref itmRef;
if (Items_FindItem("mapOxbay_Dungeon", &itmRef) >= 0 && CheckAttribute(itmRef, "index")) GameInterface.ItemIdx = itmRef.index;
LaunchMap(sti(GameInterface.ItemIdx));
 
Last edited:
console does not accept definition: string isIsland = Islands[isIdx].id;
What does "error.log" say when you try to run console including that command?

above open mapOxbay_Dungeon of your inventory when closing it displays inventary map, I'm close.
aref itmRef;
if (Items_FindItem("mapOxbay_Dungeon", &itmRef) >= 0 && CheckAttribute(itmRef, "index")) GameInterface.ItemIdx = itmRef.index;
PostEvent("LaunchIAfterFrame",1,"sl", "I_MAP", 2);

OR

aref itmRef;
if (Items_FindItem("mapOxbay_Dungeon", &itmRef) >= 0 && CheckAttribute(itmRef, "index")) GameInterface.ItemIdx = itmRef.index;
LaunchMap(sti(GameInterface.ItemIdx));
In "a_map.c", function "ShowIslandInfo", there is this:
Code:
PChar.from_map = true;
This part of the function is the code which shows the island map when you click on the island on the archipelago map, which should not return to the inventory when you release the click. Perhaps you need that line as well?
 
In "a_map.c", function "ShowIslandInfo", there is this:
Code:
PChar.from_map = true;
This part of the function is the code which shows the island map when you click on the island on the archipelago map, which should not return to the inventory when you release the click. Perhaps you need that line as well?
The script just doesn't run, I didn't look in the log, I get around the problem using pchar.tmp.anyname
This part of the function is the code which shows the island map when you click on the island on the archipelago map, which should not return to the inventory when you release the click. Perhaps you need that line as well?
I saw that I clicked on anything and returned to the world map. Could this be it?
_________________________________________________________________________
I wrote the attached code script, inserted it at the end of interface.c and replaced the call in the seagods.c file, line 2134.
When running, it correctly shows the map according to location. When exiting the map, it displays the map inventory, but it does not open, displaying the world map.
I noticed that any void that I include in interface.c, regardless of what is in the code, causes LaunchPelagoMap(); to stop working. This seems to me to be some limitation due to the number of voids declared in the file. Is that right? Or does it need some other declaration somewhere else that I couldn't find.
I understand that LaunchMap(sti(GameInterface.ItemIdx)) or PostEvent("LaunchIAfterFrame",1,"sl", "I_MAP", 2); They are requiring an interface for return, so it might be possible to register a new interface for this new resource.
I think you can also change the behavior of the inventory interface according to what calls this interface and make an automatic exit, Hammie also thought so, but I think the background image that displays the map, as it is in the inventory, does not look very good for this resource, which would justify a new interface.
Pieter B. suggested asking for help from @Jack Rackham
 

Attachments

  • Untitled-1.c
    2.1 KB · Views: 14
This is also something I do not fully understand. It's probably best to just let the player find the dungeon maps in the inventory as usual and leave the code for the archipelago map alone. Players have been quite happily looting dungeons for years, so there's no particular reason to change it now. And the Maltese crypt is supposed to be tough! Players are already getting help by having the new map; no need to make it even easier for them.
 
This is also something I do not fully understand. It's probably best to just let the player find the dungeon maps in the inventory as usual and leave the code for the archipelago map alone. Players have been quite happily looting dungeons for years, so there's no particular reason to change it now. And the Maltese crypt is supposed to be tough! Players are already getting help by having the new map; no need to make it even easier for them.
Try this. It's not very professional to insert the code like this, but it worked as expected. All that's left is to make sure that the map inventory is not shown at the output.
 

Attachments

  • seadogs.c
    94.3 KB · Views: 24
Not being sure how this works, I'd really prefer to leave the map code as it is. I'm not concerned about "professional" code but I am concerned about introducing something which could still cause trouble to normal map operations, just to make things easier in dungeons which by their nature should be a challenge for players.

If someone is attacking you, looking at the map is probably not your highest priority! If nobody is attacking you, use the inventory in the normal way.
 
Not being sure how this works, I'd really prefer to leave the map code as it is. I'm not concerned about "professional" code but I am concerned about introducing something which could still cause trouble to normal map operations, just to make things easier in dungeons which by their nature should be a challenge for players.

If someone is attacking you, looking at the map is probably not your highest priority! If nobody is attacking you, use the inventory in the normal way.
ok, but Hamie did the missing part, he inserted 1 flag that is checked in the map output and does not display the inventory. It´s work fine now.
 
Check out the changes here.
As far as I can tell, that's what I already have to put the map into the game, with some adaptations for BNH such as using "items_maps.png" instead of "items_maps.tga", and some extra code in "PROGRAM\INTERFACE\map.c" to check for .jpg map textures which I don't need because I converted the map to .tga.tx and to the same dimensions as the others.

Problem is that my files are usually not compatible with the old engine/B14

Once I have committed something I'll share it here, but you'll have to figure out the merging
I should be able to do that. If it's been fully tested in B15 then I'll compare your version to @Peter Norton's version in post #156 and if there are any differences, figure out if they're just due to B14 vs. B15.
 
@Grey Roger
I cleanup up the code a bit, this is how it is going into BNH
Thanks! :cheers

Several other locations are going to need 'Locations[n].map' lines added, starting with "Redmond.c" - find the section for "Redmond_Dungeon_2" and add 'Locations[n].map = "mapRedmond_Dungeon";'. Some other places have copies of these dungeons, such as Antigua and Cayman. The text on the map will be wrong for these places, but then it's wrong anyway because the maps still use the stock game names such as "Cave of Douwesen".

@Jack Rackham: would you like your map for Cartagena Library to get the same treatment?
 
Back
Top