Jump to content


Photo

Will Weidu-Ninja SConrad please step forward


  • Please log in to reply
31 replies to this topic

#1 Yovaneth

Yovaneth

    The newly-appointed Master Builder of Baldur's Gate

  • Modder
  • 3058 posts

Posted 25 September 2005 - 01:50 PM

Hi Seb :P

I haven't really stuffed it - of course I have a backup! :devil:

It's a good ol' worldmap.wmp question; I downloaded your weidu template and attempted to modify it to my needs but in truth, I don't really understand what's going on. I can see that my area has been added by using DLTCEP or NI, but when it's told to RevealAreaOnMap(<areaname>) it stays stubbornly hidden. In other words, I've shafted it.

Necessary info: area name is YSAR01 and it has two entrances, Exitne and Exite. For now, I'm quite happy to stay with your four links because in terms of my mod, they make sense. In the middle of your template there is a chunk of code relating to the Umar Hills, which I really, really couldn't make sense of why it was needed. Nor do I understand why the entrances to the area require three of the same (ARSC#A) and only one different (ARSC#E). For travelling to the new area, all four links currently need to come in to Exitne; I will add a link or two to Exite when I understand what's going on.

The bit you really don't want to see follows: my code:-

// Append mastarea.2da with the new area
APPEND ~MASTAREA.2da~ ~YSAR01  value~

COPY_EXISTING ~worldmap.wmp~ ~override~
 // Read offsets and stuff.
 READ_LONG  0x30 "area_num"
 READ_LONG  0x34 "area_off"
 READ_LONG  0x38 "link_off"
 READ_LONG  0x3c "link_num"
 READ_LONG  0xc "map_off"
 SET "entry"       = ("%map_off%" + 0xb8)
 SET "outer_check" = 0
 SET "inner_check" = 0
 SET "num_ent"     = 0
 // New offsets
 WRITE_LONG 0x30 ("%area_num%" + 1)
 WRITE_LONG 0x38 ("%link_off%" + 0xf0)
 WRITE_LONG 0x3c ("%link_num%" + 4)
 // Add area to worldmap
 INSERT_BYTES  ("%area_off%" +        (0xf0 * "%area_num%")) 0xf0
   WRITE_ASCII ("%area_off%" +        (0xf0 * "%area_num%")) ~YSAR01~ // AR-name
   WRITE_ASCII ("%area_off%" + 0x08 + (0xf0 * "%area_num%")) ~YSAR01~ // AR-name
   WRITE_ASCII ("%area_off%" + 0x10 + (0xf0 * "%area_num%")) ~YSAR01~ // AR-name
   WRITE_LONG  ("%area_off%" + 0x34 + (0xf0 * "%area_num%")) 13 // Map icon
   WRITE_LONG  ("%area_off%" + 0x38 + (0xf0 * "%area_num%")) 570 // X coordinate
   WRITE_LONG  ("%area_off%" + 0x3C + (0xf0 * "%area_num%")) 610 // Y coordinate
   SAY         ("%area_off%" + 0x40 + (0xf0 * "%area_num%")) ~Portpentyrch~ // Name of the area
   SAY         ("%area_off%" + 0x44 + (0xf0 * "%area_num%")) #-1 // Description
   // Now, we add four area links, all from east
   WRITE_SHORT ("%area_off%" + 0x50 + (0xf0 * "%area_num%")) ("%link_num%" + 4) // First N link
   WRITE_SHORT ("%area_off%" + 0x58 + (0xf0 * "%area_num%")) ("%link_num%" + 4) // First W link
   WRITE_SHORT ("%area_off%" + 0x60 + (0xf0 * "%area_num%")) ("%link_num%" + 4) // First S link
   WRITE_SHORT ("%area_off%" + 0x68 + (0xf0 * "%area_num%")) ("%link_num%") // First E link
   WRITE_SHORT ("%area_off%" + 0x6c + (0xf0 * "%area_num%")) 4 // Number of links from E
 // Add links from Umar Hills to the new area
 // We'll start by fixing the offsets
 WHILE ("%outer_check%" = 0) BEGIN
   READ_ASCII ("%entry%" + 0x8) "area" (2)
   READ_ASCII ("%entry%" + 0x8) "spec_area" (6)
   WHILE (("%spec_area%" STRING_COMPARE_CASE "AR1100" = 0) AND ("%inner_check%" = 0)) BEGIN
     READ_SHORT  ("%entry%" + 0x50)                         "nlink"
     READ_SHORT  ("%entry%" + 0x50 + 0x4)                   "#nlink"
     WRITE_SHORT ("%entry%" + 0x50 + 0x4)                   ("%#nlink%" + 1)
     READ_SHORT  ("%entry%" + 0x50 + 0x8)                   "wlink"
     WRITE_SHORT ("%entry%" + 0x50 + 0x8)                   ("%wlink%" + 3)
     READ_SHORT  ("%entry%" + 0x50 + 0x8)                   "wlink"
     READ_SHORT  ("%entry%" + 0x50 + 0x8 + 0x4)             "#wlink"
     WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x4)             ("%#wlink%" + 1)
     READ_SHORT  ("%entry%" + 0x50 + 0x8 + 0x8)             "slink"
     WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x8)             ("%slink%" + 2)
     READ_SHORT  ("%entry%" + 0x50 + 0x8 + 0x8)             "slink"
     READ_SHORT  ("%entry%" + 0x50 + 0x8 + 0x8 + 0x4)       "#slink"
     WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x4)       ("%#slink%" + 1)
     READ_SHORT  ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8)       "elink"
     WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8)       ("%elink%" + 1)
     READ_SHORT  ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8)       "elink"
     READ_SHORT  ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8 + 0x4) "#elink"
     WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8 + 0x4) ("%#elink%" + 1)
     SET "inner_check" = 1
   END
   PATCH_IF (("%area%" STRING_COMPARE_CASE "AR" = 0) OR ("%area%" STRING_COMPARE_CASE "G3" = 0)) BEGIN
     SET "num_ent" = ("%num_ent%" + 1)
   END ELSE
   PATCH_IF (("%area%" STRING_COMPARE_CASE "AR" != 0) AND ("%area%" STRING_COMPARE_CASE "G3" != 0)) BEGIN
     SET "outer_check" = 1
   END
   SET "entry" = ("%entry%" + 0xf0)
 END
 // Re-read offsets
 READ_LONG  0x30 "area_num"
 READ_LONG  0x38 "link_off"
 // Add link to ARSC#A
 INSERT_BYTES  ("%link_off%" - 0x01 + (0xd8 * "%nlink%")) 0xd8
   WRITE_LONG  ("%link_off%"        + (0xd8 * "%nlink%")) ("%area_num%" - 1) // Add the last entry
   WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%nlink%")) ~Exitne~ // Entrance
   WRITE_LONG  ("%link_off%" + 0x28 + (0xd8 * "%nlink%")) 4 // Unknown
   // If you want to add random encounters, travelling time, do so here
 // Add link to ARSC#A
 INSERT_BYTES  ("%link_off%" - 0x01 + (0xd8 * "%wlink%")) 0xd8
   WRITE_LONG  ("%link_off%"        + (0xd8 * "%wlink%")) ("%area_num%" - 1) // Add the last entry
   WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%wlink%")) ~Exitne~ // Entrance
   WRITE_LONG  ("%link_off%" + 0x28 + (0xd8 * "%wlink%")) 4 // Unknown
   // If you want to add random encounters, travelling time, do so here
 // Add link to ARSC#A
 INSERT_BYTES  ("%link_off%" - 0x01 + (0xd8 * "%slink%")) 0xd8
   WRITE_LONG  ("%link_off%"        + (0xd8 * "%slink%")) ("%area_num%" - 1) // Add the last entry
   WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%slink%")) ~Exite~ // Entrance
   WRITE_LONG  ("%link_off%" + 0x28 + (0xd8 * "%slink%")) 4 // Unknown
   // If you want to add random encounters, travelling time, do so here
 // Add link to ARSC#A
 INSERT_BYTES  ("%link_off%" - 0x01 + (0xd8 * "%elink%")) 0xd8
   WRITE_LONG  ("%link_off%"        + (0xd8 * "%elink%")) ("%area_num%" - 1) // Add the last entry
   WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%elink%")) ~Exitne~ // Entrance
   WRITE_LONG  ("%link_off%" + 0x28 + (0xd8 * "%elink%")) 4 // Unknown
   // If you want to add random encounters, travelling time, do so here
 // Check which link is largest
 PATCH_IF (("%nlink%" > "%wlink%") AND ("%nlink%" > "%slink%") AND ("%nlink%" > "%elink%")) BEGIN
   SET "link" = "%nlink%"
 END
 PATCH_IF (("%wlink%" > "%nlink%") AND ("%wlink%" > "%slink%") AND ("%wlink%" > "%elink%")) BEGIN
   SET "link" = "%wlink%"
 END
 PATCH_IF (("%slink%" > "%wlink%") AND ("%slink%" > "%nlink%") AND ("%slink%" > "%elink%")) BEGIN
   SET "link" = "%slink%"
 END
 PATCH_IF (("%elink%" > "%wlink%") AND ("%elink%" > "%slink%") AND ("%elink%" > "%nlink%")) BEGIN
   SET "link" = "%elink%"
 END
 // Correct ALL other links after elink
 // New variables
 SET "entry"       = ("%map_off%" + 0xb8)
 SET "outer_c"      = 0
 // Let's WHILE a bit and search for area-links
 WHILE ("%outer_c%" = 0) BEGIN
   READ_ASCII ("%entry%" + 0x8) "area" (2)
   PATCH_IF (("%area%" STRING_COMPARE_CASE "AR" = 0) OR ("%area%" STRING_COMPARE_CASE "G3" = 0)) BEGIN
     READ_SHORT ("%entry%" + 0x50)                   "nlink"
     READ_SHORT ("%entry%" + 0x50 + 0x8)             "wlink"
     READ_SHORT ("%entry%" + 0x50 + 0x8 + 0x8)       "slink"
     READ_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8) "elink"
     // And if they are larger, let's patch 'em
     PATCH_IF ("%nlink%" > "%link%") BEGIN
       WRITE_SHORT ("%entry%" + 0x50) ("%nlink%" + 4)
     END
     PATCH_IF ("%wlink%" > "%link%") BEGIN
       WRITE_SHORT ("%entry%" + 0x50 + 0x8) ("%wlink%" + 4)
     END
     PATCH_IF ("%slink%" > "%link%") BEGIN
       WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x8) ("%slink%" + 4)
     END
     PATCH_IF ("%elink%" > "%link%") BEGIN
       WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8) ("%elink%" + 4)
     END
   END ELSE
   PATCH_IF (("%area%" STRING_COMPARE_CASE "AR" != 0) AND ("%area%" STRING_COMPARE_CASE "G3" != 0)) BEGIN
     SET "outer_c" = 1
   END
   SET "entry" = ("%entry%" + 0xf0)
 END
 // Add four new links from the new area
 // Re-read offsets
 READ_LONG  0x38 "link_off"
 READ_LONG  0x3c "link_num"
 // New offset
 WRITE_LONG 0x3c ("%link_num%" + 4)
 // Add link to City Gates
 INSERT_BYTES  ("%link_off%" - 0x01 + (0xd8 * "%link_num%")) 0xd8
   WRITE_LONG  ("%link_off%"        + (0xd8 * "%link_num%")) 11 // City Gates
   WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%link_num%")) ~ExitNE~ // Entrance
   WRITE_LONG  ("%link_off%" + 0x28 + (0xd8 * "%link_num%")) 4 // Unknown
   // If you want to add random encounters, travelling time, do so here
 // Add link to Umar Hills
 INSERT_BYTES  ("%link_off%" - 0x01 + (0xd8 * "%link_num%")) 0xd8
   WRITE_LONG  ("%link_off%"        + (0xd8 * "%link_num%")) 7 // Umar Hills
   WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%link_num%")) ~ExitNW~ // Entrance
   WRITE_LONG  ("%link_off%" + 0x28 + (0xd8 * "%link_num%")) 4 // Unknown
   // If you want to add random encounters, travelling time, do so here
 // Add link to Trademeet
 INSERT_BYTES  ("%link_off%" - 0x01 + (0xd8 * "%link_num%")) 0xd8
   WRITE_LONG  ("%link_off%"        + (0xd8 * "%link_num%")) 14 // Trademeet
   WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%link_num%")) ~ExitNW~ // Entrance
   WRITE_LONG  ("%link_off%" + 0x28 + (0xd8 * "%link_num%")) 4 // Unknown
   // If you want to add random encounters, travelling time, do so here
 // Add link to de'Arnise Hold
 INSERT_BYTES  ("%link_off%" - 0x01 + (0xd8 * "%link_num%")) 0xd8
   WRITE_LONG  ("%link_off%"        + (0xd8 * "%link_num%")) 9 // de'Arnise
   WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%link_num%")) ~ExitSE~ // Entrance
   WRITE_LONG  ("%link_off%" + 0x28 + (0xd8 * "%link_num%")) 4 // Unknown
   // If you want to add random encounters, travelling time, do so here
BUT_ONLY_IF_IT_CHANGES

So the bottom line is: what did I do wrong? Oh - and you can guarantee follow-up questions, that I'm sure of!

-Y-

#2 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11148 posts

Posted 26 September 2005 - 12:58 PM

I'll look into this tomorrow. :)

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#3 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11148 posts

Posted 29 September 2005 - 10:16 AM

Note to self: Always include more comments, to make it easier for yourself to follow your own code months after writing it.

The Umar Hills-stuff in the middle adds an area link from Umar Hills to the new area, while the other links added are from the new area to other areas.

Now, you said you can see the area being added in NI or DLTCEP - and I don't really see any problem either when looking in NI. It's not corrupted or anything...

You could try to make it visible from the start, and see if it shows up then. If it doesn't, we'll need to dig a little deeper, but if it does, the problem is how you reveal it.

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#4 Yovaneth

Yovaneth

    The newly-appointed Master Builder of Baldur's Gate

  • Modder
  • 3058 posts

Posted 29 September 2005 - 02:10 PM

Note to self: Always include more comments, to make it easier for yourself to follow your own code months after writing it.


:ROFL: With me it's usually the quick'n'dirty VB or C utility I threw together ages ago to do a specific job and now I find that it needs extending for some reason.....

The Umar Hills-stuff in the middle adds an area link from Umar Hills to the new area, while the other links added are from the new area to other areas.


So you only have links to the new area FROM the Umar Hills but leaving the new area you can go TO Umar, Tradement, De'Arnise and the City Gates? If that is so, why do you need what appears to be two incoming links (ARSC#A, ARSC#E) with one repeated three times (ARSC#A)? And what exactly is the structure of that Umar Hills loop doing?

I know this is a PITA but once I have a working code example - and more importantly, I understand what is happening and why - I can always extend that example to do other things. It's why I keep asking questions.... :devil:

There is a way that we might be able to bypass the majority of the questions but only if you think it would be easier and that is if I gave you my area name, entrances and required links. Effectively I'm asking you to do the work for me :blush: but then I know what I'm looking at for the other one (possibly two) areas I want to add. The last time I bugged you about Weidu was for adding entrances on the fly - I got that one dead easily and I've added three/four entances since then, but this worldmap problem is currently waaaayyy over my head.

Now, you said you can see the area being added in NI or DLTCEP - and I don't really see any problem either when looking in NI. It's not corrupted or anything...

You could try to make it visible from the start, and see if it shows up then. If it doesn't, we'll need to dig a little deeper, but if it does, the problem is how you reveal it.


You can see this coming, can't you? <sigh>. How do I declare it as already visible?

-Y-

#5 hlidskialf

hlidskialf

    Incarnation of the Eternal Ale Warrior

  • Modder
  • 2510 posts

Posted 29 September 2005 - 02:48 PM

You can see this coming, can't you? <sigh>. How do I declare it as already visible?

-Y-

View Post


Open the worldmap, select the area in question. Tick off the flags you want. (visible, visible from adjacent, reachable, already visited)

The great wolf Fenrir gapes ever at the dwelling of the gods.


#6 Yovaneth

Yovaneth

    The newly-appointed Master Builder of Baldur's Gate

  • Modder
  • 3058 posts

Posted 30 September 2005 - 01:03 AM

Thanks Hlid - I thought it was going to be a Weidu-trick, not something quite as simple as that!

-Y-

#7 Avenger_teambg

Avenger_teambg
  • Member
  • 604 posts

Posted 03 October 2005 - 12:06 AM

If you are there, check the area name fields too.
There are at least 3 fields containing the area name.
Best if you set all the same as the area's resref :)
Avenger

#8 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11148 posts

Posted 07 October 2005 - 02:10 AM

Did you have any luck with this, Yovaneth?

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#9 Yovaneth

Yovaneth

    The newly-appointed Master Builder of Baldur's Gate

  • Modder
  • 3058 posts

Posted 07 October 2005 - 04:19 AM

I got distracted by other parts of the mod, Seb - I'll have another push at it this weekend. Many thanks for asking about it.

-Y-

#10 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11148 posts

Posted 07 October 2005 - 04:31 AM

Let me know if you still have problems with it. ;)

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#11 Yovaneth

Yovaneth

    The newly-appointed Master Builder of Baldur's Gate

  • Modder
  • 3058 posts

Posted 08 October 2005 - 12:23 PM

Hi Seb

Well, I've had another poke at it with same results. What I did find was that according to both DLTCEP and NI, the new area has been added in the correct place (as before); so I followed both Hlid's and Avenger's advice re. the area flags but got nowhere.

To be sure, I modded the worldmap with the visited/accessible flags for my area and I re-entered the area that has the expose-map encounter as if I'd never been there before, so that wasn't the problem.

I saved the game after that and opened it in NI. That's where it got interesting; the new area was not in the savegame but it had saved something; an additional Small Teeth Pass icon with the title "So it's come to this, has it?!"

Basically, I haven't got a <pick-a-swearword> clue what I'm doing wrong.

-Y-

#12 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11148 posts

Posted 08 October 2005 - 12:26 PM

Have you tried with a new savegame?

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#13 Yovaneth

Yovaneth

    The newly-appointed Master Builder of Baldur's Gate

  • Modder
  • 3058 posts

Posted 08 October 2005 - 04:34 PM

Yup - para 2 in my last reply. After I'd installed the mod and altered the area flags in DLTCEP, I then entered the trigger area for the first time. Or did I misunderstand your question?

-Y-

#14 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11148 posts

Posted 09 October 2005 - 02:49 AM

I meant with an entirely new game from scratch. :)

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#15 Yovaneth

Yovaneth

    The newly-appointed Master Builder of Baldur's Gate

  • Modder
  • 3058 posts

Posted 09 October 2005 - 03:14 PM

<places forehead carefully on desk, lifts it six inches and slams it down, once for each new party member that has to be created> Probably be a day or two - or even a week - before I can have a go at it. I don't finish at work till midnight this week, which usually means it's 1.00am before I get home.

-Y-

<makes a seventh dent because he's just remembered that he can export his current party [I think]>

#16 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11148 posts

Posted 09 October 2005 - 03:35 PM

If I'm not completely mistaken, the worldmap is stored in the savegame. That might contribute to the issue, although I'm not sure.

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#17 hlidskialf

hlidskialf

    Incarnation of the Eternal Ale Warrior

  • Modder
  • 2510 posts

Posted 09 October 2005 - 10:43 PM

The worldmap is stored in the savegame. *Places a pillow between head and desk.* To test if your changes worked, just start a new game with a pregen or exported character, and crack it open in NI. OR you can use NI to replace the worldmap in your current savegame. Just make sure that you have a backup of the save in case things fubar.

The great wolf Fenrir gapes ever at the dwelling of the gods.


#18 Yovaneth

Yovaneth

    The newly-appointed Master Builder of Baldur's Gate

  • Modder
  • 3058 posts

Posted 17 October 2005 - 12:53 PM

Hi Seb/Hlid

Doncha hate it when you see this topic get bumped up again? :D :D

Well, Hlid scores a strike. It did need a new game to show the new area, a fact I wasn't best please about; I really didn't want to be another 'you've got to start from scratch' mod but if the IE insists..... :crying:

Seb; I need to pick your brains on how to modify the 'add area' code, now we've established that it does actually work after I've near-nuked it. Currently you have links in from the Umar Hills only; I tried adding links from Trademeet but although Weidu didn't barf, it didn't work in the game either. I would be very grateful if you could show me how to add links in from Trademeet that drop the party in ExitNE and also links in from the Forest of Tethyr that drop the party in ExitE. These are not the only links I need by any stretch of the imagination but they do cover all the approaches (literally! :) )

-Y-

#19 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11148 posts

Posted 17 October 2005 - 01:42 PM

You'll need to copy quite a large chunk of code and modify it here and there. Can you show me what you tried with, and what the problem ingame was. :)

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#20 Yovaneth

Yovaneth

    The newly-appointed Master Builder of Baldur's Gate

  • Modder
  • 3058 posts

Posted 18 October 2005 - 02:03 PM

Hi Seb: many thanks for the offer to check. This is the bit I cut and modified to link from Trademeet (ar2000) to the new area (ysar01):-

  

// Now, we add four area links, all from east
   WRITE_SHORT ("%area_off%" + 0x50 + (0xf0 * "%area_num%")) ("%link_num%" + 4) // First N link
   WRITE_SHORT ("%area_off%" + 0x58 + (0xf0 * "%area_num%")) ("%link_num%" + 4) // First W link
   WRITE_SHORT ("%area_off%" + 0x60 + (0xf0 * "%area_num%")) ("%link_num%" + 4) // First S link
   WRITE_SHORT ("%area_off%" + 0x68 + (0xf0 * "%area_num%")) ("%link_num%") // First E link
   WRITE_SHORT ("%area_off%" + 0x6c + (0xf0 * "%area_num%")) 4 // Number of links from E
 // Add links from Trademeet to the new area
 // We'll start by fixing the offsets
 WHILE ("%outer_check%" = 0) BEGIN
   READ_ASCII ("%entry%" + 0x8) "area" (2)
   READ_ASCII ("%entry%" + 0x8) "spec_area" (6)
   WHILE (("%spec_area%" STRING_COMPARE_CASE "AR2000" = 0) AND ("%inner_check%" = 0)) BEGIN
     READ_SHORT  ("%entry%" + 0x50)                         "nlink"
     READ_SHORT  ("%entry%" + 0x50 + 0x4)                   "#nlink"
     WRITE_SHORT ("%entry%" + 0x50 + 0x4)                   ("%#nlink%" + 1)
     READ_SHORT  ("%entry%" + 0x50 + 0x8)                   "wlink"
     WRITE_SHORT ("%entry%" + 0x50 + 0x8)                   ("%wlink%" + 3)
     READ_SHORT  ("%entry%" + 0x50 + 0x8)                   "wlink"
     READ_SHORT  ("%entry%" + 0x50 + 0x8 + 0x4)             "#wlink"
     WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x4)             ("%#wlink%" + 1)
     READ_SHORT  ("%entry%" + 0x50 + 0x8 + 0x8)             "slink"
     WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x8)             ("%slink%" + 2)
     READ_SHORT  ("%entry%" + 0x50 + 0x8 + 0x8)             "slink"
     READ_SHORT  ("%entry%" + 0x50 + 0x8 + 0x8 + 0x4)       "#slink"
     WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x4)       ("%#slink%" + 1)
     READ_SHORT  ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8)       "elink"
     WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8)       ("%elink%" + 1)
     READ_SHORT  ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8)       "elink"
     READ_SHORT  ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8 + 0x4) "#elink"
     WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8 + 0x4) ("%#elink%" + 1)
     SET "inner_check" = 1
   END
   PATCH_IF (("%area%" STRING_COMPARE_CASE "AR" = 0) OR ("%area%" STRING_COMPARE_CASE "G3" = 0)) BEGIN
     SET "num_ent" = ("%num_ent%" + 1)
   END ELSE
   PATCH_IF (("%area%" STRING_COMPARE_CASE "AR" != 0) AND ("%area%" STRING_COMPARE_CASE "G3" != 0)) BEGIN
     SET "outer_check" = 1
   END
   SET "entry" = ("%entry%" + 0xf0)
 END
 // Re-read offsets
 READ_LONG  0x30 "area_num"
 READ_LONG  0x38 "link_off"
 // Add link to ARSC#A
 INSERT_BYTES  ("%link_off%" - 0x01 + (0xd8 * "%nlink%")) 0xd8
   WRITE_LONG  ("%link_off%"        + (0xd8 * "%nlink%")) ("%area_num%" - 1) // Add the last entry
   WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%nlink%")) ~Exitne~ // Entrance
   WRITE_LONG  ("%link_off%" + 0x28 + (0xd8 * "%nlink%")) 4 // Unknown
   // If you want to add random encounters, travelling time, do so here
 // Add link to ARSC#A
 INSERT_BYTES  ("%link_off%" - 0x01 + (0xd8 * "%wlink%")) 0xd8
   WRITE_LONG  ("%link_off%"        + (0xd8 * "%wlink%")) ("%area_num%" - 1) // Add the last entry
   WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%wlink%")) ~Exitne~ // Entrance
   WRITE_LONG  ("%link_off%" + 0x28 + (0xd8 * "%wlink%")) 4 // Unknown
   // If you want to add random encounters, travelling time, do so here
 // Add link to ARSC#A
 INSERT_BYTES  ("%link_off%" - 0x01 + (0xd8 * "%slink%")) 0xd8
   WRITE_LONG  ("%link_off%"        + (0xd8 * "%slink%")) ("%area_num%" - 1) // Add the last entry
   WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%slink%")) ~Exite~ // Entrance
   WRITE_LONG  ("%link_off%" + 0x28 + (0xd8 * "%slink%")) 4 // Unknown
   // If you want to add random encounters, travelling time, do so here
 // Add link to ARSC#A
 INSERT_BYTES  ("%link_off%" - 0x01 + (0xd8 * "%elink%")) 0xd8
   WRITE_LONG  ("%link_off%"        + (0xd8 * "%elink%")) ("%area_num%" - 1) // Add the last entry
   WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%elink%")) ~Exitne~ // Entrance
   WRITE_LONG  ("%link_off%" + 0x28 + (0xd8 * "%elink%")) 4 // Unknown
   // If you want to add random encounters, travelling time, do so here
 // Check which link is largest
 PATCH_IF (("%nlink%" > "%wlink%") AND ("%nlink%" > "%slink%") AND ("%nlink%" > "%elink%")) BEGIN
   SET "link" = "%nlink%"
 END
 PATCH_IF (("%wlink%" > "%nlink%") AND ("%wlink%" > "%slink%") AND ("%wlink%" > "%elink%")) BEGIN
   SET "link" = "%wlink%"
 END
 PATCH_IF (("%slink%" > "%wlink%") AND ("%slink%" > "%nlink%") AND ("%slink%" > "%elink%")) BEGIN
   SET "link" = "%slink%"
 END
 PATCH_IF (("%elink%" > "%wlink%") AND ("%elink%" > "%slink%") AND ("%elink%" > "%nlink%")) BEGIN
   SET "link" = "%elink%"
 END  
 // Correct ALL other links after elink
 // New variables
 SET "entry"       = ("%map_off%" + 0xb8)
 SET "outer_c"      = 0
 // Let's WHILE a bit and search for area-links
 WHILE ("%outer_c%" = 0) BEGIN
   READ_ASCII ("%entry%" + 0x8) "area" (2)
   PATCH_IF (("%area%" STRING_COMPARE_CASE "AR" = 0) OR ("%area%" STRING_COMPARE_CASE "G3" = 0)) BEGIN
     READ_SHORT ("%entry%" + 0x50)                   "nlink"
     READ_SHORT ("%entry%" + 0x50 + 0x8)             "wlink"
     READ_SHORT ("%entry%" + 0x50 + 0x8 + 0x8)       "slink"
     READ_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8) "elink"
     // And if they are larger, let's patch 'em
     PATCH_IF ("%nlink%" > "%link%") BEGIN
       WRITE_SHORT ("%entry%" + 0x50) ("%nlink%" + 4)
     END
     PATCH_IF ("%wlink%" > "%link%") BEGIN
       WRITE_SHORT ("%entry%" + 0x50 + 0x8) ("%wlink%" + 4)
     END
     PATCH_IF ("%slink%" > "%link%") BEGIN
       WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x8) ("%slink%" + 4)
     END
     PATCH_IF ("%elink%" > "%link%") BEGIN
       WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8) ("%elink%" + 4)
     END
   END ELSE
   PATCH_IF (("%area%" STRING_COMPARE_CASE "AR" != 0) AND ("%area%" STRING_COMPARE_CASE "G3" != 0)) BEGIN
     SET "outer_c" = 1
   END
   SET "entry" = ("%entry%" + 0xf0)
 END

Okay - a couple of things. I didn't fully understand the map division description into NESW areas - in fact, I can't even remember where I read it - so I made the assumption that Trademeet being in the same general area as the Umar Hills (sort-of :P ), it too had east links. I opened DLTCEP and made the new area Visible and Accessible, then started a new game (again! boo-hoo). I Teleported Without Error to Trademeet and tried to access Porthpentyrch. It showed up correctly on the map - grey icon with a blue outline - but gave me an 'area inaccessible' error. From Trademeet I Dimension-Doored to the Umar Hills where I was able to get to the new area with no problem.

At this point I run out of stupid CLUAConsole descriptions because I can't think of any more....

The other thing that defeats me is why we need four links from (say) the Umar Hills into a new area?

-Y-