Help - Search - Members - Calendar
Full Version: Has anyone seen the worldmap tutorial of SpellholdStudios?
The Black Wyrm's Lair - Forums > Mod development resources & discussion > Modder's Workshop
balduran
I saw several familiar topics, both here and on other forums, which pointed to this tutorial:
http://forums.spellholdstudios.net/index.p...=17269&st=0

The problem is that for some reason it's I'm forbidden from opening the html, so I can't see what's inside.
I also checked the tp2 of G3Anniversary mod, but so far I cannot figure what does what.

Anyway, what I need to achieve is to patch my town into the world map without making it incompatible with other mods which change the WMP, and I have no idea how to. I also need to find out what other files i need to edit - 2da, bam, etc... And I'm somewhat in a hurry to make it work, cause I need to finish the SofA portion of Azure NPC in a few days time, since I'll be going on a trip next week, and then again to the "back to work" routine.
Rabain
SHS was giving me errors this morning saying I do not have access to the server etc

It works fine now though.
CamDawg
SHS was a temporary outage; it appears to be back up now.

The G3 Anniversary may not be the best model from which to work as it creates a new area with only outgoing links, i.e. you have to be moved via script/spell to it and you can never go back. That being said, I'd be more than happy to walk you through the code and explain what the hell it's doing. smile.gif

balduran
QUOTE(CamDawg @ Aug 27 2006, 06:31 PM) *

SHS was a temporary outage; it appears to be back up now.

The G3 Anniversary may not be the best model from which to work as it creates a new area with only outgoing links, i.e. you have to be moved via script/spell to it and you can never go back. That being said, I'd be more than happy to walk you through the code and explain what the hell it's doing. smile.gif


Thanks about the offer to help smile.gif
The code on spellholdstudios finally managed to load. I'll try to make it work myself (like that's ever going to happen dry.gif ) and then post about what's not working. wink.gif
balduran
I'm totally and completely lost in this code. So far all I do is stare at the monitor and don't even understand what and where I am supposed to change, in order to fit my needs. I lost the whole sunday evening looking at the bytes in the worldmap and trying to understand what I am supposed to do, and the end result is that I didn't do anything else on the mod that day (for comparison the plane prison took me less than five hours of work on Saturday).

Can I convince any of you guys, who know how to do this, to tweak the code for me? I would really apreciate the help. The area files is "az1000.are" and is called "Kula". The coordinates on the world map should be x1292 and y402 (exactly west of Trademeet). It uses the Umar Hills animation in "mapicons.bam", and can be entered from all continental maps at will after it has been revealed in a Chapter 6 quest. The area itself can be exited from the east, south and west edges of the map.

Baronius
To sum up, once it has been revealed, should it be available from all other areas? In BG2, if I remember correctly, you cannot travel to most of these areas from Athkatla except from the City Gates district. Do you want this to be changed?

As for the rest of areas, will the following do: Trademeet, Temple Ruins, Umar Hills, D'Arnise Keep, Forest of Tethyr, North Forest, Small Teeth Pass, Windspear Hills, Druid Grove and City Gates. If I've forgotten anything and you want it to be added, please tell. (Or if you don't want certain areas from the above list.)

As for the outgoing links, I find it logical that the list could be the same as in case of incoming links.

Your area will be hidden by default, as you want to reveal it only in Chapter 6. In this case, the RevealAreaOnMap action must be used.
balduran
The links you've mentioned do sound like the most logical choice. smile.gif

As far as the map revealing goes, I added a few interjections to chief Brega's dialogue, so that he reveals the area after you talk to him with a Reputation higher than 13 and some other prerequisites, like Global("Chapter","GLOBAL",6) and a few other variables.

Baronius
So the earliest chapter you can visit that area is the 6th. That time, the player will have visited most wilderness areas, so there is no reason to add links from all those areas I listed. Trademeet and City Gates should have a link to Kula, but it would be illogical to provide a direct path from every wilderness area, as the adventurers reach many areas by passing already explored places. To sum up, the player will still be able to visit Kula practically from any other area, while you won't have redundant code in your TP2.

Anything that needs to be changed on this?
balduran
QUOTE(Baronius @ Aug 30 2006, 05:39 AM) *

So the earliest chapter you can visit that area is the 6th. That time, the player will have visited most wilderness areas, so there is no reason to add links from all those areas I listed. Trademeet and City Gates should have a link to Kula, but it would be illogical to provide a direct path from every wilderness area, as the adventurers reach many areas by passing already explored places. To sum up, the player will still be able to visit Kula practically from any other area, while you won't have redundant code in your TP2.


Exactly. There's no need to link every single area if the game uses such a method of travelling.

QUOTE

Anything that needs to be changed on this?


Not really. Everything sound right. Although I think I can make a new mapicons.bam with a special graphic for Kula, but the change in the animation number I can fix by myself later. That's about the only thing I know how to do about that code.
Baronius
I've written the code. I made only a short try in BG2, it seemed to work properly. This code will make your TP2 fatter, that's sure, but I think it's not hard to customize or extend it. I've attached it to this post.

Single-line comments such as // this in the code usually indicate lines where you can set attributes. The code is divided into several sections. I'll paste here the most important lines that you should change when you want to modify the code.

I've tried to add all those features we've discussed in the above posts, so the area names, coordinates, initial map icon etc. are already specified in the code.

These variables (from section 4) are very important, they're used in several calculations:

CODE
/* ALL area links, including the ones FROM the new area as well as all links you want to add from other areas */
SET "my-northlink"  = 0        // How many north links you'll add from your NEW area
SET "my-westlink"   = 2        // How many west links you'll add from your NEW area
SET "my-southlink"  = 2        // How many south links you'll add from your NEW area
SET "my-eastlink"   = 2        // How many east links you'll add from your NEW area
SET "ext-northlink" = 2        // How many total north links you'll add from other EXISTING areas
SET "ext-westlink"  = 1        // How many total west links you'll add from other EXISTING areas
SET "ext-southlink" = 2        // How many total south links you'll add from other EXISTING areas
SET "ext-eastlink"  = 2        // How many total east links you'll add from other EXISTING areas


I'm sure this part (from section 5) is obvious, so no explanation is needed:

CODE
WRITE_ASCII "%area-section-end%" ~AZ1000~            // Your area's filename
WRITE_ASCII "%area-section-end%" + 0x8 ~AZ1000~
WRITE_ASCII "%area-section-end%" + 0x10 ~AZ1000~
WRITE_LONG "%area-section-end%" + 0x34 10            // Icon index
WRITE_LONG "%area-section-end%" + 0x38 1292        // X coordinate on the worldmap
WRITE_LONG "%area-section-end%" + 0x3C 402        // Y coordinate on the worldmap
SAY "%area-section-end%" + 0x40 ~Kula~            // Worldmap caption of your area


If you want it to detect an existing game area, and add a link from it to your new area, you have to change the code at three points, basically. The first are the already mentioned variables in section 5, the second is pasted directly below, and the third (section 9) will be quoted in a later part of this post. The following code is from section 7:

CODE
PATCH_IF(
/* Specify the list of EXISTING areas you want links FROM */
// You can use the commented template below to include a new area. Substitute ARXXXX with the area filename.
/* ("%area-resref%" STRING_EQUAL "ARXXXX") OR    */
("%area-resref%" STRING_EQUAL "AR0020") OR     /* City Gates    */
("%area-resref%" STRING_EQUAL "AR2000")        /* Trademeet    */)
BEGIN
...
END


Though you probably won't have to modify it directly, it's important to mention the following code block. This is a typical statement inside the body of PATCH_IF (also in section 7):

CODE
READ_LONG ("%northlink-offset%" + 4) "north-count"  
WRITE_LONG ("%northlink-offset%" + 4) ("%north-count%" + 1)
"north-position" = "%link-offset%" + 216 * ("%north-current%" + "%north-count%")
INNER_PATCH_SAVE str "%str%" BEGIN
  FOR (j=8 * "%north-current%" + 2; j<=8*("%link-count%" - "%new-link-count%") + 6; j+=2) BEGIN
    READ_SHORT j "temp"
    WRITE_SHORT j ("%temp%" + 1)
  END
END
"actual-north" = "%actual-north%" + 1


So the above code creates (or rather just starts to create) one north link FROM an existing game area to your new area. It is applied on each detected area from those you've listed. If you don't want an area to have a north link to yours, exclude it. The following code snipeet, also from section 7, ensures that no west link will be added from City Gates to your area:

CODE
// You can specify conditions if you want. Here we won't add west link from City Gates to the new area.
  PATCH_IF !("%area-resref%" STRING_EQUAL "AR0020") BEGIN
   READ_LONG ("%northlink-offset%" + 12) "west-count"
   WRITE_LONG ("%northlink-offset%" + 12) ("%west-count%" + 1)
   "west-position" = "%link-offset%" + 216 * ("%west-current%" + "%west-count%")
   INNER_PATCH_SAVE str "%str%" BEGIN
    FOR (j=8 * "%west-current%" + 8; j<=8*("%link-count%" - "%new-link-count%") + 6; j+=2) BEGIN
     READ_SHORT j "temp"
     WRITE_SHORT j ("%temp%" + 1)
    END
   END
  "actual-west" = "%actual-west%" + 1
  END ELSE "west-position" = 0


The below lines are from section 9. Important: all area resrefs on your first list of existing game areas must also be added here:

CODE
// This is where you specify the structure of inserted links that come from EXISTING areas to your new area
/* In this example, we only have City Gates and Trademeet */
PATCH_IF (("%area-resref%" STRING_EQUAL "AR0020") OR
             ("%area-resref%" STRING_EQUAL "AR2000"))
BEGIN    
  // Travel time factor. You don't need PATCH_IF if you use the same time multiplier for all areas.
  PATCH_IF ("%area-resref%" STRING_EQUAL "AR2000") BEGIN
   SET "travel" = 1    // Journey (or a trip?) takes 4 hours to Trademeet from your new area
  END ELSE BEGIN
   SET "travel" = 5    // Otherwise 20 hours
  END
  // North link
  PATCH_IF ("north-position") BEGIN
   INNER_PATCH "%str%" BEGIN READ_SHORT (8 * "%north-current%") "shift" END
   SET "new-position" = "%north-position%" + (216 * shift)
   INSERT_BYTES "%new-position%" 216
   WRITE_LONG "%new-position%" ("%area-count%" - 1)
   WRITE_ASCII ("%new-position%" + 4) ~ExitSE~        // Entrance in new area. Non-existing entrance causes the game to crash.    
   WRITE_LONG ("%new-position%"+ 0x24) travel        // Travel time factor
   WRITE_LONG ("%new-position%"+ 0x28) 4
   /* WRITE_ASCII ("%new-position%"+ 0x2C) ~ARXXXX~ */    // Filename of random encounter area
   /* WRITE_LONG ("%new-position%"+ 0x54) 50        */    // Probability of random encounter
   "actual-north" = "%actual-north%" + 1
  END
  // East link
  ...
  // South link
  ...
  // West link


Very important: as the only direct connection between the ARE file and the worldmap is the entrance, make sure to specify an existing entrance name here. (I've added ExitSE, the entrance of the test area I quickly made.)

The only section that has a bigger chance to be modified by you in the future and I didn't mention it yet is section 12, which adds links FROM YOUR area to other existing game areas.

If you browse the code, you might notice three short sections, with "Check code consistency" as a title comment. It is recommended that you never remove these (unlike most of the comments and commented code), because they make the installation fail if anything is wrong. The installation won't fail in its current state, but if you modify it in the future, it is possible that you accidently make some mistakes in the code. In the latter case, without these lines, it is possible that WeiDU would happily inform the user about a successful install while the worldmap would become totally messed up, causing a crash in the game.

The player has to start a new game, or the worldmap change will not take effect. (The worldmap is stored in the savegame.)

The code is quite long, as I've already written. This is because it must be capable of adding links from theoretically any number of areas, not just from one. (And you needed Trademeet and City Gates.) Though since I've optimized it for your needs, you probably won't have to change anything except the bam icon stuff. Tell me how it works for you.
Vlad
Also, it's possible to add areas dynamically, the same way Watcher's Keep is added to the map. The only drawback of this approach is that the game should be started a new in order to update the map with a new area. If you wish the area being invisible you may hide area on the map in any initial script of the game and later on to reveal it via script or dialogue. So, take a look at two files XNEWAREA.2DA and XL3000.2DA. You'll need to APPEND XNEWAREA.2DA with your area entry, to APPEND MASTAREA.2DA, and to create your new file XL****.2DA. That is basically all.
Baronius
That only works if ToB is installed. If Azure requires Throne of Bhaal, the best solution is obviously the one you've told. smile.gif
balduran
Azure will require ToB, since I don't want to make two separate downloads for SofA and ToB.

Thanks for all the hard work on the code, Baronius smile.gif I'll try to make it work tonight and will post back with results.

Just one last question - the worldmap will use the name of the entrance, with which I replace ExitSE, right?
Baronius
Yes, that string will be written to the worldmap file, and when you click on the area icon in the game, it will search for an entrance of the same name in Kula's .ARE file.

By the way, please download the file again, because I've fixed a problem in the original code. I'm 100% sure it wouldn't have caused any anomaly for Azure, but I recommend that you download it again, as the fix might be important for future developments.
balduran
Thanks about that. I'll be sure to download it again. Though I still haven't test the code, sorry about that. Right now I'm "redecorating" my mother's house, and I didn't even have time to install my harddisk inside the computer (although I specifically brought it with me). I should be ready by Sunday and probably'll post results on Monday or Tuesday.
Once again appologies ofr the delay. sad.gif
Baronius
No need to apologise, it's your mod wink.gif And since you say it requires ToB, Vlad's suggestion appears to be a shorter solution code-wise. (I haven't been thinking on its realisation though.) However, I appreciate a lot that you test my code, because it will confirm that it works. (This is universal code, which can be made working with BG1, SoA, ToB and can deal with any number of area links.)
balduran
It took a while to test this one, but the code is working just fine. Three times cheers for Baronius' great work. beer.gif beer.gif beer.gif

Of course, as in any other mod, there's still some minor/major (plus one critical problem with the game not displaying a tis file propperly) issues to be resolved, but I guess it's nothing to be worried about.
jastey
I would appreciate very much if the knowledge collected in this thread would be turned into some general template / tutorial for the tutorial section. Baronius? balduran? smile.gif

(If you think this thread gives all needed information maybe some link could be given to it from the tutorial section.)
Baronius
I plan to make one, I plan. smile.gif (Though no idea exactly when. sad.gif)
balduran
I think Baronius should have the final word on that one, because the code is his, and I still have little idea what does what.
Baronius
It's now available:
http://www.blackwyrmlair.net/Tutorials/patchwmp.php
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.