Jump to content


Photo

How to add travel point to existing area


  • Please log in to reply
9 replies to this topic

#1 Roberciiik

Roberciiik
  • Member
  • 39 posts

Posted 21 June 2020 - 10:10 AM

Hi,

 

I would like to create my first small mod for BGT so I'm sorry for being such newbe. I want to add new area travel reference to the south from Nashkel Mines. Natively AR4400 does not have south traveling border (cursor is blocked rather than travel wheel). Can I patch the original location to add such travel point or need I to edit original location file? 

 

I have already added worldmap links so I can travel between these two areas if they are visited before.

 

I found that there is WeiDU fj_are_structure macro to add travel region, however it looks like enabling direct travel to new location instead of opening the worldmap to choose the area. I don't know if this macro handles opening the worldmap at all.

 

Let me know if there are mods which extend Nashkel Mines with south area exit, I could check them before install and not adding the same exit. 

 

Thanks for help,

Robert



#2 Miloch

Miloch

    Barbarian

  • Modder
  • 6554 posts

Posted 21 June 2020 - 06:12 PM

You are correct in that fj_are_structure will not do everything you want. You may need to use it in conjunction with sc#addWmpAre and/or ADD_WORLDMAP_LINKS. It's been a while since I've worked with these, so I can't provide more concrete help, but the WeiDU doc has examples.

 

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#3 Roberciiik

Roberciiik
  • Member
  • 39 posts

Posted 22 June 2020 - 08:10 AM

As I understand correctly, Function sc#addWmpAre will add new area to the game. But I have already added area to worldmap, and it is visible when traveling. My issue is with missing "search map exit" in the south border of Nashkel Mines. Do I really need to patch Nashkel Mines' BMP file or I can do this programmatically? 



#4 Miloch

Miloch

    Barbarian

  • Modder
  • 6554 posts

Posted 27 June 2020 - 08:54 PM

Do I really need to patch Nashkel Mines' BMP file or I can do this programmatically? 

Yes to both: you can patch a search bitmap programmatically (via WeiDU), but there aren't any handy macros. Basically, you want to diff the two files, the original and your change with the new exit, using WinDiff or another such utility. That gives you the differences you can patch, which really shouldn't amount to a whole lot of code. Here is an example of that from the Aurora's Shoes code. The first block patches the area (.are) file itself to add a travel area, an entrance, and an animation for a new interior subarea. The second block patches the search bitmap so that the party can approach the entrance that was otherwise in impassable terrain. The relevant code amounts to only 10 lines.

COPY_EXISTING ~%nnsh%.are~ override //North Nashkel Road entrance
  PATCH_IF SOURCE_SIZE > 0x28f BEGIN
    LPF fj_add_are_structure
      INT_VAR
      fj_type         = 2    //travel
      fj_box_left     = 3602
      fj_box_top      = 627
      fj_box_right    = 3674
      fj_box_bottom   = 721
      fj_cursor_index = 30   //door
      fj_vertex_0     = 3602 + (703 << 16)
      fj_vertex_1     = 3674 + (721 << 16)
      fj_vertex_2     = 3674 + (643 << 16)
      fj_vertex_3     = 3616 + (627 << 16)
      STR_VAR
      fj_structure_type   = region
      fj_name             = Door4301
      fj_destination_area = ag4301
      fj_destination_name = Exit4300
    END
    LPF fj_add_are_structure
      INT_VAR
      fj_loc_x       = 3690
      fj_loc_y       = 764
      fj_orientation = 1   //SSW
      STR_VAR
      fj_structure_type = entrance
      fj_name           = Exit4301
      RET
      some_unknown_offset = fj_return_offset
    END
    WRITE_SHORT some_unknown_offset + 0x28 64
    LPF fj_add_are_structure
      INT_VAR
      fj_loc_x       = 3609
      fj_loc_y       = 674
      fj_flags       = 0b00000000000000000001000110000101
      //visible, not illuminated, invisible in dark, covered by actors, shown in combat
      STR_VAR
      fj_structure_type = animation
      fj_name           = Cave1
      fj_bam_resref     = ag4300c1
    END
  END
BUT_ONLY

COPY_EXISTING ~%nnsh%sr.bmp~ ~override~ //Search map
  PATCH_IF SOURCE_SIZE > 0xa5e8 BEGIN
    WRITE_BYTE  0xa2c7 0x1f
    WRITE_SHORT 0xa367 0x1111
    WRITE_BYTE  0xa369 0x18
    WRITE_SHORT 0xa407 0x1111
    WRITE_BYTE  0xa409 0x18
    WRITE_SHORT 0xa4a7 0x1111
    WRITE_BYTE  0xa4a9 0x18
    WRITE_SHORT 0xa547 0x1111
    WRITE_BYTE  0xa549 0x18
    WRITE_SHORT 0xa5e7 0x1181
  END
BUT_ONLY

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#5 Roberciiik

Roberciiik
  • Member
  • 39 posts

Posted 28 June 2020 - 12:39 AM

Thanks a lot, I will try and give a feedback :)



#6 jastey

jastey
  • Staff
  • 2359 posts

Posted 28 June 2020 - 01:04 AM

Is there more than one thread about this? I could have sworn I linked you to Weigo's function for search map bitwise changes:

https://www.gibberli...&comment=279093

 

Just to prevent you doing work that's already done.



#7 Roberciiik

Roberciiik
  • Member
  • 39 posts

Posted 28 June 2020 - 01:32 AM

Is there more than one thread about this?

 

Yeah, sorry about that. I opened second thread later, as there was a silance. I will not do this again.



#8 jastey

jastey
  • Staff
  • 2359 posts

Posted 28 June 2020 - 06:46 AM

Ah, ok, no, that's not what I meant. I felt like having dementia.



#9 Miloch

Miloch

    Barbarian

  • Modder
  • 6554 posts

Posted 29 June 2020 - 05:55 PM

Speaking of dementia and preventing extra work, I forgot WeiDU has (and has had like forever) an inbuilt command-line option to generate a searchmap patch, which is almost certainly what I used for the Aurora code above. The only difference is I added a SOURCE_SIZE check (not strictly necessary) and concatenated adjacent WRITE_BYTEs into WRITE_SHORTs for the sake of brevity.

 

So basically, you put the original searchmap and your version (edited with DLTCEP or NI) in the same folder with WeiDU and type something like this from the command line:

weidu.exe --cmp-from orig.bmp --cmp-to new.bmp --out patch.tpa

And it generates a patch to turn the one file into the other. Although I haven't looked at it, weigo's function seems a bit redundant given the relative ease of this. Maybe it does something beyond this, but 2da files seem unnecessary if all you want to do is alter a searchmap.


Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#10 Roberciiik

Roberciiik
  • Member
  • 39 posts

Posted 30 June 2020 - 01:24 PM

Hi,

 

Patching with weidu-generated patch file works excellent. I will consider using Weigo's macro in case of incompatibility in the future of my mod.

 

Thank you!