The Black Wyrm Lair Forums
The Black Wyrm's Lair Terms of Use Help Search Members Calendar

Welcome Guest ( Log In | Register )

> Please, help with an area
Riojano2002
post Oct 18 2006, 12:02 AM
Post #1





Forum Member
Posts: 6
Joined: 17-October 06





Hi everybody:

Im Riojano2002, a spanish modder. Our mod, "Lord of Darkness" its near to it conclusion, but we are

having some problems adding the new area to the worldmap.

This new area does appear in the worldmap, and you can travel there without any error. After that, the

group can't travel from this new area anywhere. I couldnt tell where the error is in: code, area... Can

anyone help us?

This is the code in the .tp2 file



APPEND ~MASTAREA.2da~ ~ARMEJ5 value~

COPY_EXISTING ~worldmap.wmp~ ~override~
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
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 // inserting new area to wmp
WRITE_ASCII ("%area_off%" + (0xf0 * "%area_num%")) ~ARMEJ5~
WRITE_ASCII ("%area_off%" + 0x08 + (0xf0 * "%area_num%")) ~ARMEJ5~
WRITE_ASCII ("%area_off%" + 0x10 + (0xf0 * "%area_num%")) ~ARMEJ5~
WRITE_LONG ("%area_off%" + 0x34 + (0xf0 * "%area_num%")) 19 // mapicon number
WRITE_LONG ("%area_off%" + 0x38 + (0xf0 * "%area_num%")) 1063 // x coordinate
WRITE_LONG ("%area_off%" + 0x3C + (0xf0 * "%area_num%")) 39 // y coordinate
SAY ("%area_off%" + 0x40 + (0xf0 * "%area_num%")) ~Nido de Estrellas~
SAY ("%area_off%" + 0x44 + (0xf0 * "%area_num%")) #-1
WRITE_SHORT ("%area_off%" + 0x50 + (0xf0 * "%area_num%")) ("%link_num%" + 4) // N link index
WRITE_SHORT ("%area_off%" + 0x58 + (0xf0 * "%area_num%")) ("%link_num%" + 4) // W link index
WRITE_SHORT ("%area_off%" + 0x60 + (0xf0 * "%area_num%")) ("%link_num%" + 4) // S link index
WRITE_SHORT ("%area_off%" + 0x68 + (0xf0 * "%area_num%")) ("%link_num%") // E link index
WRITE_SHORT ("%area_off%" + 0x6c + (0xf0 * "%area_num%")) 4 // one link E
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 + 0x4) "#nlink2"
READ_SHORT ("%entry%" + 0x50 + 0x8) "wlink"
WRITE_SHORT ("%entry%" + 0x50 + 0x8) ("%wlink%" + 3)
READ_SHORT ("%entry%" + 0x50 + 0x8) "wlink2"
READ_SHORT ("%entry%" + 0x50 + 0x8 + 0x4) "#wlink"
WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x4) ("%#wlink%" + 1)
READ_SHORT ("%entry%" + 0x50 + 0x8 + 0x4) "#wlink2"
READ_SHORT ("%entry%" + 0x50 + 0x8 + 0x8) "slink"
WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x8) ("%slink%" + 2)
READ_SHORT ("%entry%" + 0x50 + 0x8 + 0x8) "slink2"
READ_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x4) "#slink"
WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x4) ("%#slink%" + 1)
READ_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x4) "#slink2"
READ_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8) "elink"
WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8) ("%elink%" + 1)
READ_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8) "elink2"
READ_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8 + 0x4) "#elink"
WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8 + 0x4) ("%#elink%" + 1)
READ_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8 + 0x4) "#elink2"
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" = 1) BEGIN
SET "outer_check" = 1
END
SET "entry" = ("%entry%" + 0xf0)
END
READ_LONG 0x30 "area_num2"
READ_LONG 0x38 "link_off2"

// Add link to ARMEJ5
INSERT_BYTES ("%link_off2%" - 0x01 + (0xd8 * "%nlink%")) 0xd8 // inserting one byte before eof to

avoid errors
WRITE_LONG ("%link_off2%" + (0xd8 * "%nlink%")) ("%area_num2%" - 1) // target ARMEJ5
WRITE_ASCII ("%link_off2%" + 0x04 + (0xd8 * "%nlink%")) ~RRMEJ5~ // entry point
WRITE_LONG ("%link_off2%" + 0x28 + (0xd8 * "%nlink%")) 4 // unknown value--matching other links just

in case

// Add link to ARMEJ5
INSERT_BYTES ("%link_off2%" - 0x01 + (0xd8 * "%wlink2%")) 0xd8 // inserting one byte before eof to

avoid errors
WRITE_LONG ("%link_off2%" + (0xd8 * "%wlink2%")) ("%area_num2%" - 1) // target ARMEJ5
WRITE_ASCII ("%link_off2%" + 0x04 + (0xd8 * "%wlink2%")) ~RRMEJ5~ // entry point
WRITE_LONG ("%link_off2%" + 0x28 + (0xd8 * "%wlink2%")) 4 // unknown value--matching other links

just in case

// Add link to ARMEJ5
INSERT_BYTES ("%link_off2%" - 0x01 + (0xd8 * "%slink2%")) 0xd8 // inserting one byte before eof to

avoid errors
WRITE_LONG ("%link_off2%" + (0xd8 * "%slink2%")) ("%area_num2%" - 1) // target ARMEJ5
WRITE_ASCII ("%link_off2%" + 0x04 + (0xd8 * "%slink2%")) ~RRMEJ5~ // entry point
WRITE_LONG ("%link_off2%" + 0x28 + (0xd8 * "%slink2%")) 4 // unknown value--matching other links

just in case

// Add link to ARMEJ5
INSERT_BYTES ("%link_off2%" - 0x01 + (0xd8 * "%elink2%")) 0xd8 // inserting one byte before eof to

avoid errors
WRITE_LONG ("%link_off2%" + (0xd8 * "%elink2%")) ("%area_num2%" - 1) // target ARMEJ5
WRITE_ASCII ("%link_off2%" + 0x04 + (0xd8 * "%elink2%")) ~RRMEJ5~ // entry point
WRITE_LONG ("%link_off2%" + 0x28 + (0xd8 * "%elink2%")) 4 // unknown value--matching other links

just in case

// Correct ALL other links after elink
SET "entryy" = ("%map_off%" + 0xb8)
SET "outer_c" = 0
SET "num_entt" = 0
WHILE ("%outer_c%" = 0) BEGIN
READ_ASCII ("%entryy%" + 0x8) "areaa" (2)
PATCH_IF (("%areaa%" STRING_COMPARE_CASE "AR" = 0) OR ("%areaa%" STRING_COMPARE_CASE "G3" = 0)) BEGIN
READ_SHORT ("%entryy%" + 0x50) "nllink"
READ_SHORT ("%entryy%" + 0x50 + 0x8) "wllink"
READ_SHORT ("%entryy%" + 0x50 + 0x8 + 0x8) "sllink"
READ_SHORT ("%entryy%" + 0x50 + 0x8 + 0x8 + 0x8) "ellink"
PATCH_IF ("%nllink%" > "%wlink2%") BEGIN
WRITE_SHORT ("%entryy%" + 0x50) ("%nllink%" + 4)
END
PATCH_IF ("%wllink%" > "%wlink2%") BEGIN
WRITE_SHORT ("%entryy%" + 0x50 + 0x8) ("%wllink%" + 4)
END
PATCH_IF ("%sllink%" > "%wlink2%") BEGIN
WRITE_SHORT ("%entryy%" + 0x50 + 0x8 + 0x8) ("%sllink%" + 4)
END
PATCH_IF ("%ellink%" > "%wlink2%") BEGIN
WRITE_SHORT ("%entryy%" + 0x50 + 0x8 + 0x8 + 0x8) ("%ellink%" + 4)
END
END ELSE
PATCH_IF (("%area%" STRING_COMPARE_CASE "AR" = 1) AND ("%areaa%" STRING_COMPARE_CASE "G3" = 1)) BEGIN
SET "outer_c" = 1
END
SET "entryy" = ("%entryy%" + 0xf0)
END
READ_LONG 0x30 "area_num"
READ_LONG 0x34 "area_off"
READ_LONG 0x38 "link_off"
READ_LONG 0x3c "link_num"
WRITE_LONG 0x3c ("%link_num%" + 4)

// Add link to City Gates
INSERT_BYTES ("%link_off%" - 0x01 + (0xd8 * "%link_num%")) 0xd8 // inserting one byte before eof to

avoid errors
WRITE_LONG ("%link_off%" + (0xd8 * "%link_num%")) 11 // target city gates
WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%link_num%")) ~ExitNE~ // slums entry point
WRITE_LONG ("%link_off%" + 0x28 + (0xd8 * "%link_num%")) 4 // unknown value--matching other links

just in case


// Add link to Umar Hills
INSERT_BYTES ("%link_off%" - 0x01 + (0xd8 * "%link_num%")) 0xd8 // inserting one byte before eof to

avoid errors
WRITE_LONG ("%link_off%" + (0xd8 * "%link_num%")) 7 // target umar hills
WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%link_num%")) ~ExitNW~ // slums entry point
WRITE_LONG ("%link_off%" + 0x28 + (0xd8 * "%link_num%")) 4 // unknown value--matching other links

just in case


// Add link to Trademeet
INSERT_BYTES ("%link_off%" - 0x01 + (0xd8 * "%link_num%")) 0xd8 // inserting one byte before eof to

avoid errors
WRITE_LONG ("%link_off%" + (0xd8 * "%link_num%")) 14 // target trademeet
WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%link_num%")) ~ExitNW~ // slums entry point
WRITE_LONG ("%link_off%" + 0x28 + (0xd8 * "%link_num%")) 4 // unknown value--matching other links

just in case


// Add link to De'Arnise Hold
INSERT_BYTES ("%link_off%" - 0x01 + (0xd8 * "%link_num%")) 0xd8 // inserting one byte before eof to

avoid errors
WRITE_LONG ("%link_off%" + (0xd8 * "%link_num%")) 9 // target de'arnise
WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%link_num%")) ~ExitSE~ // slums entry point
WRITE_LONG ("%link_off%" + 0x28 + (0xd8 * "%link_num%")) 4 // unknown value--matching other links

just in case
BUT_ONLY_IF_IT_CHANGES
Go to the top of the page
 
Quote Post
 
Start new topic
Replies
Baronius
post Oct 20 2006, 04:11 PM
Post #2


Master of energies
Group Icon

Council Member
Posts: 3325
Joined: 9-July 04
From: Magyarország




Yeah, a newer version of WeiDU is needed. It's because str is not marked explicitly as a variable, which causes a problem for older WeiDU versions.

However, two major changes in the code are probably needed (They're no big deal). They are as follows:

If I interpret your settings correctly, you want only East links from your area, 18 of them (And 4*18 links from other areas, but the code for this seems to be OK). In section which starts with /** 12. Add links that go FROM the new area to other existing areas **/, go to the East links section (/* Add east links */ ). The first two links are OK (Docks and Slums), but you need to change the first line of the other ones. As you can see, the first link has:

CODE
SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%" + "%my-northlink%")

while the second link starts with:

CODE
SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%" + "%my-northlink%" + 1)

In a similar way, the code of the third link should start with:

CODE
SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%" + "%my-northlink%" + 2)

Then +3 for the fourth link, +4 for the fifth link, and so on...

The other thing is that at the end of section 12, you seem to have two links to City Gates, one West link and one South link. This contradicts your initializations:

CODE
SET "my-westlink" = 0 // This is how many west links you will add from your NEW area
SET "my-southlink" = 0 // This is how many south links you will add from your NEW area


If you actually want to have these links, you need to replace the zero values by 1 in the above lines.

The code blocks in question at the end of Section 12 are the following:

CODE
/* Add south links */
SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-westlink%" - "%my-southlink%")
INSERT_BYTES "%current-link%" 216
WRITE_LONG "%current-link%" 11 /* City Gates */
WRITE_ASCII ("%current-link%" + 4) ~ExitNE~ // Name of an EXISTING entrance of the area
WRITE_LONG ("%current-link%"+ 0x24) 5
WRITE_LONG ("%current-link%"+ 0x28) 4
/* WRITE_ASCII ("%current-link%"+ 0x2C) ~ARXXXX~ */ // Filename of random encounter area
/* WRITE_LONG ("%current-link%"+ 0x54) 25 */ // Probability of random encounter
SET "actual-south" = "%actual-south%" + 1

/* Add west links */
SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-westlink%")
INSERT_BYTES "%current-link%" 216
WRITE_LONG "%current-link%" 11 /* City Gates */
WRITE_ASCII ("%current-link%" + 4) ~ExitNE~ // Name of an EXISTING entrance of the area
WRITE_LONG ("%current-link%"+ 0x24) 5
WRITE_LONG ("%current-link%"+ 0x28) 4
/* WRITE_ASCII ("%current-link%"+ 0x2C) ~ARXXXX~ */ // Filename of random encounter area
/* WRITE_LONG ("%current-link%"+ 0x54) 25 */ // Probability of random encounter
SET "actual-west" = "%actual-west%" + 1


Otherwise, great job with the customization!

Please do let me know how it works and if you have any problems.


--------------------
Mental harmony dispels the darkness.
Go to the top of the page
 
Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:



- Lo-Fi Version Time is now: 29th August 2025 - 07:28 AM