Help - Search - Members - Calendar
Full Version: Please, help with an area
The Black Wyrm's Lair - Forums > Mod development resources & discussion > Modder's Workshop
Riojano2002

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
Baronius
The code you're using is not too consequent, and contains limitations (one of them is totally unnecessary).

Do you know how area links work? Here is my post which explains how to use a more universal code. It's longer, but I think its use and modification is much easier. You can also download it from that thread. Please do ask if you have any questions/problems when customizing it.
balduran
QUOTE(Baronius @ Oct 18 2006, 03:27 AM) *
The code you're using is not too consequent, and contains limitations (one of them is totally unnecessary).

Do you know how area links work? Here is my post which explains how to use a more universal code. It's longer, but I think its use and modification is much easier. You can also download it from that thread. Please do ask if you have any questions/problems when customizing it.


They probably couldn't travel back from the area, because they forgot to color the edges of the search map in light blue. But that's just a wild guess, since I myself had that problem untill Sir Kill told me where I was wrong.
Baronius
It is quite possible, you are right. On the other hand, the code they use (which seems to be the same code from SHS that you also wanted to use first) has problems as I've said, e.g. if the game has areas installed by other mods which filenames don't start with "AR" or "G3", the code might mess up the whole wmp. It has little chance that a mod will have such area filenames, but we can't know what future mods will use.

Of course if the search map proves to the problem (which is very likely), I understand that they will use the shorter code in order to be able to release the mod earlier. (In the long run, it might not be a wise choice.)
Riojano2002
Hi everybody

Im changed the search map and now I cant travel from this area... Thank you!!

Also, Im trying change the code I had and use Baronius´ code () in order to put more links in WMP... but there is a error in the TP2 code:


ERROR:
======

[AREAS.TP2]PARSE ERROR at line 107 collumn 18-20
Near Text: str
syntax error

[AREAS.TP2]PARSE ERROR at line 107 collumn 18-20
Near Text: str
Parsing.Parse_error
ERROR: parsing [AREAS.TP2]: Parsing.Parse_error
ERROR: problem parsing TP file [AREAS.TP2]: Parsing.Parse_error

FATAL ERROR: Parsing.Parse_error



NEW CODE:
=========

APPEND ~MASTAREA.2da~ ~ARMEJ5 value~

COPY_EXISTING ~worldmap.wmp~ ~override~

/** 1. Read file header **/
/* READ_ASCII 0x0 "wmap-marker" (8) */
READ_LONG 0x8 "wmap-count"
READ_LONG 0xC "wmap-offset"
INNER_ACTION BEGIN
/* ACTION_IF !("%wmap-marker%" STRING_EQUAL_CASE "WMAPV1.0") THEN BEGIN FAIL ~Cannot add area to worldmap: your wmap file is

invalid~ END */
ACTION_IF ("%wmap-count%" != 1) THEN BEGIN FAIL ~Cannot add area to worldmap: you've a non-standard SoA wmap file~ END
ACTION_IF ("%wmap-offset%" != 16) THEN BEGIN FAIL ~Cannot add area to worldmap: you've a non-standard SoA wmap file~ END
END

/** 2. Read worldmap entry data **/
READ_LONG 0x30 "area-count"
READ_LONG 0x34 "area-offset"
READ_LONG 0x38 "link-offset"
READ_LONG 0x3C "link-count"

/** 3. Check file consistency **/
INNER_ACTION BEGIN
ACTION_IF ("%link-offset%" != "%area-offset%" + (240 * "%area-count%")) THEN BEGIN FAIL ~Cannot add area to worldmap: fatal

inconsistency in wmap file~ END
END

/** 4. Update worldmap entry with necessary values **/
SET "area-count" = "%area-count%" + 1
SET "link-offset" = "%link-offset%" + 240
/* 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 // This is how many north links you will add from your NEW area
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
SET "my-eastlink" = 18 // This is how many east links you will add from your NEW area
SET "ext-northlink" = 18 // This is how many total north links you will add from other EXISTING areas
SET "ext-westlink" = 18 // This is how many total west links you will add from other EXISTING areas
SET "ext-southlink" = 18 // This is how many total south links you will add from other EXISTING areas
SET "ext-eastlink" = 18 // This is how many total east links you will add from other EXISTING areas
SET "my-link-count" = "%my-northlink%" + "%my-westlink%" + "%my-southlink%" + "%my-eastlink%"
SET "ext-link-count" = "%ext-northlink%" + "%ext-westlink%" + "%ext-southlink%" + "%ext-eastlink%"
SET "new-link-count" = "%my-link-count%" + "%ext-link-count%"
SET "link-count" = "%link-count%" + "%new-link-count%"
WRITE_LONG 0x30 "%area-count%"
WRITE_LONG 0x38 "%link-offset%"
WRITE_LONG 0x3C "%link-count%"

/** 5. Add a new area to the end of the areas section **/
SET "area-section-end" = "%area-offset%" + 240 * ("%area-count%" - 1)
INSERT_BYTES area-section-end 240
WRITE_ASCII "%area-section-end%" ~ARMEJ5~ // Your area's filename
WRITE_ASCII "%area-section-end%" + 0x8 ~ARMEJ5~ // Your area's filename
WRITE_ASCII "%area-section-end%" + 0x10 ~ARMEJ5~ // Your area's filename
WRITE_LONG "%area-section-end%" + 0x34 14 // Icon index
WRITE_LONG "%area-section-end%" + 0x38 1063 // X coordinate on the worldmap
WRITE_LONG "%area-section-end%" + 0x3C 39 // Y coordinate on the worldmap
SAY "%area-section-end%" + 0x40 ~Nido de Estrellas~ // Worldmap caption of your area
WRITE_LONG "%area-section-end%" + 0x44 (BNOT 0x0)

/** 6. Update position and number of links FROM this area to other areas **/
WRITE_LONG "%area-section-end%" + 0x50 ("%link-count%" - "%my-link-count%")
WRITE_LONG "%area-section-end%" + 0x54 "%my-northlink%"
WRITE_LONG "%area-section-end%" + 0x58 ("%link-count%" - "%my-westlink%")
WRITE_LONG "%area-section-end%" + 0x5C "%my-westlink%"
WRITE_LONG "%area-section-end%" + 0x60 ("%link-count%" - "%my-westlink%" - "%my-southlink%")
WRITE_LONG "%area-section-end%" + 0x64 "%my-southlink%"
WRITE_LONG "%area-section-end%" + 0x68 ("%link-count%" - "%my-link-count%" + "%my-northlink%")
WRITE_LONG "%area-section-end%" + 0x6C "%my-eastlink%"

/** 7. Gather information and update link count in EXISTING areas **/
SPRINT str ""
SPRINT off ""
SET "size" = 0
SET "actual-north" = 0
SET "actual-west" = 0
SET "actual-south" = 0
SET "actual-east" = 0
SET "north-position" = 0
SET "west-position" = 0
SET "south-position" = 0
SET "east-position" = 0
INNER_PATCH_SAVE str "%str%" BEGIN INSERT_BYTES 0 (8 * ("%link-count%" - "%new-link-count%" + 1)) END
FOR (i=0; i<"%area-count%"-1; i+=1) BEGIN
SET "northlink-offset" = ("%area-offset%" + 240*i + 80)
READ_ASCII ("%area-offset%" + 240*i) "area-resref" (6)
READ_LONG "%northlink-offset%" "north-current"
READ_LONG ("%northlink-offset%" + 8) "west-current"
READ_LONG ("%northlink-offset%" + 16) "south-current"
READ_LONG ("%northlink-offset%" + 24) "east-current"
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 "AR0700") OR
("%area-resref%" STRING_EQUAL "AR0400") OR
("%area-resref%" STRING_EQUAL "AR1300") OR
("%area-resref%" STRING_EQUAL "AR1200") OR
("%area-resref%" STRING_EQUAL "AR0800") OR
("%area-resref%" STRING_EQUAL "AR0020") OR
("%area-resref%" STRING_EQUAL "AR0500") OR
("%area-resref%" STRING_EQUAL "AR1000") OR
("%area-resref%" STRING_EQUAL "AR1100") OR
("%area-resref%" STRING_EQUAL "AR1404") OR
("%area-resref%" STRING_EQUAL "AR0900") OR
("%area-resref%" STRING_EQUAL "AR0300") OR
("%area-resref%" STRING_EQUAL "AR2000") OR
("%area-resref%" STRING_EQUAL "AR2600") OR
("%area-resref%" STRING_EQUAL "AR2800") OR
("%area-resref%" STRING_EQUAL "AR1304") OR
("%area-resref%" STRING_EQUAL "AR1400") OR
("%area-resref%" STRING_EQUAL "AR1900") )
BEGIN
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
// You can specify conditions if you want. Here we won't add west link from City Gates to the new area.
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

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

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

INNER_PATCH_SAVE off "%off%" BEGIN
INSERT_BYTES size 30
WRITE_EVALUATED_ASCII size "%area-resref%" #6
WRITE_LONG (size+6) "%north-position%"
WRITE_LONG (size+10) "%east-position%"
WRITE_LONG (size+14) "%south-position%"
WRITE_LONG (size+18) "%west-position%"
WRITE_SHORT (size+22) "%north-current%"
WRITE_SHORT (size+24) "%east-current%"
WRITE_SHORT (size+26) "%south-current%"
WRITE_SHORT (size+28) "%west-current%"
END
"size" = "%size%" + 30
END
END

/** 8. Check code consistency **/
INNER_ACTION BEGIN
ACTION_IF ("%actual-north%" != "%ext-northlink%") THEN BEGIN FAIL ~Semantic error in TP2 code (first ext-north-link check

failed)~ END
ACTION_IF ("%actual-west%" != "%ext-westlink%") THEN BEGIN FAIL ~Semantic error in TP2 code (first ext-west-link check

failed)~ END
ACTION_IF ("%actual-south%" != "%ext-southlink%") THEN BEGIN FAIL ~Semantic error in TP2 code (first ext-south-link check

failed)~ END
ACTION_IF ("%actual-east%" != "%ext-eastlink%") THEN BEGIN FAIL ~Semantic error in TP2 code (first ext-east-link check

failed)~ END
END

/** 9. Insert the area links that come from other EXISTING areas **/
SET "actual-north" = 0
SET "actual-west" = 0
SET "actual-south" = 0
SET "actual-east" = 0
FOR (i=0; i<size; i+=30) BEGIN
INNER_PATCH "%off%" BEGIN
READ_ASCII i "area-resref" (6)
READ_LONG (i+6) "north-position"
READ_LONG (i+10) "east-position"
READ_LONG (i+14) "south-position"
READ_LONG (i+18) "west-position"
READ_SHORT (i+22) "north-current"
READ_SHORT (i+24) "east-current"
READ_SHORT (i+26) "south-current"
READ_SHORT (i+28) "west-current"
END
// 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 "AR0700") OR
("%area-resref%" STRING_EQUAL "AR0400") OR
("%area-resref%" STRING_EQUAL "AR1300") OR
("%area-resref%" STRING_EQUAL "AR1200") OR
("%area-resref%" STRING_EQUAL "AR0800") OR
("%area-resref%" STRING_EQUAL "AR0020") OR
("%area-resref%" STRING_EQUAL "AR0500") OR
("%area-resref%" STRING_EQUAL "AR1000") OR
("%area-resref%" STRING_EQUAL "AR1100") OR
("%area-resref%" STRING_EQUAL "AR1404") OR
("%area-resref%" STRING_EQUAL "AR0900") OR
("%area-resref%" STRING_EQUAL "AR0300") OR
("%area-resref%" STRING_EQUAL "AR2000") OR
("%area-resref%" STRING_EQUAL "AR2600") OR
("%area-resref%" STRING_EQUAL "AR2800") OR
("%area-resref%" STRING_EQUAL "AR1304") OR
("%area-resref%" STRING_EQUAL "AR1400") OR
("%area-resref%" STRING_EQUAL "AR1900"))
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 "AR1200") 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) ~RRMEJ5~ // 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) 25 */ // Probability of random encounter
"actual-north" = "%actual-north%" + 1
END
// East link
PATCH_IF ("east-position") BEGIN
INNER_PATCH "%str%" BEGIN READ_SHORT (8 * "%east-current%" + 2) "shift" END
SET "new-position" = "%east-position%" + (216 * shift)
INSERT_BYTES "%new-position%" 216
WRITE_LONG "%new-position%" ("%area-count%" - 1)
WRITE_ASCII ("%new-position%" + 4) ~RRMEJ5~ // 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) 25 */ // Probability of random encounter
"actual-east" = "%actual-east%" + 1
END
// South link
PATCH_IF ("south-position") BEGIN
INNER_PATCH "%str%" BEGIN READ_SHORT (8 * "%south-current%" + 4) "shift" END
SET "new-position" = "%south-position%" + (216 * shift)
INSERT_BYTES "%new-position%" 216
WRITE_LONG "%new-position%" ("%area-count%" - 1)
WRITE_ASCII ("%new-position%" + 4) ~RRMEJ5~ // 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) 25 */ // Probability of random encounter
"actual-south" = "%actual-south%" + 1
END
// West link
PATCH_IF ("west-position") BEGIN
INNER_PATCH "%str%" BEGIN READ_SHORT (8 * "%west-current%" + 6) "shift" END
SET "new-position" = "%west-position%" + (216 * shift)
INSERT_BYTES "%new-position%" 216
WRITE_LONG "%new-position%" ("%area-count%" - 1)
WRITE_ASCII ("%new-position%" + 4) ~RRMEJ5~ // 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) 25 */ // Probability of random encounter
"actual-west" = "%actual-west%" + 1
END
END
END

/** 10. Check code consistency **/
INNER_ACTION BEGIN
ACTION_IF ("%actual-north%" != "%ext-northlink%") THEN BEGIN FAIL ~Semantic error in TP2 code (second ext-north-link check

failed)~ END
ACTION_IF ("%actual-west%" != "%ext-westlink%") THEN BEGIN FAIL ~Semantic error in TP2 code (second ext-west-link check

failed)~ END
ACTION_IF ("%actual-south%" != "%ext-southlink%") THEN BEGIN FAIL ~Semantic error in TP2 code (second ext-south-link check

failed)~ END
ACTION_IF ("%actual-east%" != "%ext-eastlink%") THEN BEGIN FAIL ~Semantic error in TP2 code (second ext-east-link check

failed)~ END
END

/** 11. Fix link references in original area entries **/
FOR (i=0; i<"%area-count%"-1; i+=1) BEGIN
SET "northlink-offset" = ("%area-offset%" + 240*i + 80)
READ_LONG "%northlink-offset%" "north-current"
READ_LONG ("%northlink-offset%" + 8) "west-current"
READ_LONG ("%northlink-offset%" + 16) "south-current"
READ_LONG ("%northlink-offset%" + 24) "east-current"
INNER_PATCH "%str%" BEGIN READ_SHORT (8 * "%north-current%") "shift" END
WRITE_LONG "%northlink-offset%" ("%north-current%" + shift)
INNER_PATCH "%str%" BEGIN READ_SHORT (8 * "%west-current%" + 6) "shift" END
WRITE_LONG ("%northlink-offset%" + 8) ("%west-current%" + shift)
INNER_PATCH "%str%" BEGIN READ_SHORT (8 * "%south-current%" + 4) "shift" END
WRITE_LONG ("%northlink-offset%" + 16) ("%south-current%" + shift)
INNER_PATCH "%str%" BEGIN READ_SHORT (8 * "%east-current%" + 2) "shift" END
WRITE_LONG ("%northlink-offset%" + 24) ("%east-current%" + shift)
END

/** 12. Add links that go FROM the new area to other existing areas **/
SET "actual-north" = 0
SET "actual-west" = 0
SET "actual-south" = 0
SET "actual-east" = 0
/* We don't add any north links. If you uncomment and customize the commented code below, don't forget to change
the value of the "my-northlink" variable in section 4 ("Update worldmap entry with necessary values") */
/*
/* Add north links */
SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%")
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-north" = "%actual-north%" + 1
*/
/* Add east links */
SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%" + "%my-northlink%")
INSERT_BYTES "%current-link%" 216
WRITE_LONG "%current-link%" 2 /* Dock */
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-east" = "%actual-east%" + 1

SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%" + "%my-northlink%" + 1)
INSERT_BYTES "%current-link%" 216
WRITE_LONG "%current-link%" 1 /* Slums */
WRITE_ASCII ("%current-link%" + 4) ~ExitN~ // Name of an EXISTING entrance of the area
WRITE_LONG ("%current-link%"+ 0x24) 1
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-east" = "%actual-east%" + 1

SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%" + "%my-northlink%")
INSERT_BYTES "%current-link%" 216
WRITE_LONG "%current-link%" 3 /* Puente */
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-east" = "%actual-east%" + 1

SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%" + "%my-northlink%" + 1)
INSERT_BYTES "%current-link%" 216
WRITE_LONG "%current-link%" 0 /* Waukeen */
WRITE_ASCII ("%current-link%" + 4) ~ExitN~ // Name of an EXISTING entrance of the area
WRITE_LONG ("%current-link%"+ 0x24) 1
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-east" = "%actual-east%" + 1

SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%" + "%my-northlink%")
INSERT_BYTES "%current-link%" 216
WRITE_LONG "%current-link%" 4 /* Cementerio */
WRITE_ASCII ("%current-link%" + 4) ~ExitN~ // 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-east" = "%actual-east%" + 1

SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%" + "%my-northlink%" + 1)
INSERT_BYTES "%current-link%" 216
WRITE_LONG "%current-link%" 5 /* Templo */
WRITE_ASCII ("%current-link%" + 4) ~ExitNw~ // Name of an EXISTING entrance of the area
WRITE_LONG ("%current-link%"+ 0x24) 1
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-east" = "%actual-east%" + 1

SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%" + "%my-northlink%")
INSERT_BYTES "%current-link%" 216
WRITE_LONG "%current-link%" 6 /* Gubernamental */
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-east" = "%actual-east%" + 1

SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%" + "%my-northlink%" + 1)
INSERT_BYTES "%current-link%" 216
WRITE_LONG "%current-link%" 7 /* Umar */
WRITE_ASCII ("%current-link%" + 4) ~ExitSE~ // Name of an EXISTING entrance of the area
WRITE_LONG ("%current-link%"+ 0x24) 1
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-east" = "%actual-east%" + 1

SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%" + "%my-northlink%")
INSERT_BYTES "%current-link%" 216
WRITE_LONG "%current-link%" 10 /* Ventolanza */
WRITE_ASCII ("%current-link%" + 4) ~ExitW~ // 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-east" = "%actual-east%" + 1

SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%" + "%my-northlink%" + 1)
INSERT_BYTES "%current-link%" 216
WRITE_LONG "%current-link%" 9 /* De´Arnise 1*/
WRITE_ASCII ("%current-link%" + 4) ~ExitsE~ // Name of an EXISTING entrance of the area
WRITE_LONG ("%current-link%"+ 0x24) 1
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-east" = "%actual-east%" + 1


SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%" + "%my-northlink%" + 1)
INSERT_BYTES "%current-link%" 216
WRITE_LONG "%current-link%" 13 /* De´Arnise 2*/
WRITE_ASCII ("%current-link%" + 4) ~ExitsE~ // Name of an EXISTING entrance of the area
WRITE_LONG ("%current-link%"+ 0x24) 1
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-east" = "%actual-east%" + 1

SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%" + "%my-northlink%")
INSERT_BYTES "%current-link%" 216
WRITE_LONG "%current-link%" 8 /* Ruinas Templo 1*/
WRITE_ASCII ("%current-link%" + 4) ~ExitE~ // 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-east" = "%actual-east%" + 1

SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%" + "%my-northlink%")
INSERT_BYTES "%current-link%" 216
WRITE_LONG "%current-link%" 12 /* Ruinas Templo 2*/
WRITE_ASCII ("%current-link%" + 4) ~ExitE~ // 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-east" = "%actual-east%" + 1

SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%" + "%my-northlink%" + 1)
INSERT_BYTES "%current-link%" 216
WRITE_LONG "%current-link%" 14 /* Trademeet */
WRITE_ASCII ("%current-link%" + 4) ~ExitSW~ // Name of an EXISTING entrance of the area
WRITE_LONG ("%current-link%"+ 0x24) 1
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-east" = "%actual-east%" + 1

SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%" + "%my-northlink%")
INSERT_BYTES "%current-link%" 216
WRITE_LONG "%current-link%" 18 /* Tethyr */
WRITE_ASCII ("%current-link%" + 4) ~Exit2603~ // 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-east" = "%actual-east%" + 1

SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%" + "%my-northlink%" + 1)
INSERT_BYTES "%current-link%" 216
WRITE_LONG "%current-link%" 24 /* Suldanesselar */
WRITE_ASCII ("%current-link%" + 4) ~Exit2600~ // Name of an EXISTING entrance of the area
WRITE_LONG ("%current-link%"+ 0x24) 1
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-east" = "%actual-east%" + 1

SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%" + "%my-northlink%")
INSERT_BYTES "%current-link%" 216
WRITE_LONG "%current-link%" 15 /* Arboleda Druidica */
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-east" = "%actual-east%" + 1

SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%" + "%my-northlink%" + 1)
INSERT_BYTES "%current-link%" 216
WRITE_LONG "%current-link%" 14 /* Trademeet */
WRITE_ASCII ("%current-link%" + 4) ~ExitW~ // Name of an EXISTING entrance of the area
WRITE_LONG ("%current-link%"+ 0x24) 1
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-east" = "%actual-east%" + 1


/* 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

/** 13. Check code consistency **/
INNER_ACTION BEGIN
ACTION_IF ("%actual-north%" != "%my-northlink%") THEN BEGIN FAIL ~Semantic error in TP2 code (my-north-link check failed)~

END
ACTION_IF ("%actual-west%" != "%my-westlink%") THEN BEGIN FAIL ~Semantic error in TP2 code (my-west-link check failed)~ END
ACTION_IF ("%actual-south%" != "%my-southlink%") THEN BEGIN FAIL ~Semantic error in TP2 code (my-south-link check failed)~

END
ACTION_IF ("%actual-east%" != "%my-eastlink%") THEN BEGIN FAIL ~Semantic error in TP2 code (my-east-link check failed)~ END
END
BUT_ONLY_IF_IT_CHANGES
balduran
The code's fine. Just update your version of WeiDU to 195. That solved the problem for me.
Baronius
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.
Riojano2002
Thank you!!

I had changed the first error.

About the second, I didn´t want put these two links... I forget them. I´ve changed the code, is it correct?:



/* Add south links */
SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%)
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-link-count%)
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
Baronius
I'm not sure I understand your changes in the code you posted. If you don't want these two links (south and west), the code I pasted at the end of my previous post (and which you also pasted above in an altered form) should simply be deleted from your TP2.
Riojano2002
Oops. I thought that it had to be similar to north links... I´ve cut and paste it, except last line. If I only want east links... Can I deleted code of north, west and south links?
Baronius
Yes. Or just put them between multi-line comments. The north link is already commented out:

CODE
/*
/* Add north links */
SET "current-link" = "%link-offset%" + 216 * ("%link-count%" - "%my-link-count%")
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-north" = "%actual-north%" + 1
*/


It is put between /**/. You can do the same with the last two blocks as well (i.e. with the west and south links). If you want a shorter code, just delete them, it will have the same effect (Be careful not to delete something else too, accidently).
Riojano2002
Thank you!!

I´ve made the last changes and it works ok. Thank you, thank you, thank you...!!!

Januszka
Yay!! Does that mean we'll have soon the best spanish mod ever?! biggrin.gif
Go for it, Rio smile.gif
Riojano2002
Yeah Janu. As soon as somebody finish to record some voices and program and instaler... and I dont see YOU. XDDD

(What are you doing, here, when you could be recording voices?? Come on!!)
Januszka
Ooops *whistles joyfully*

Bf is watching soccer, and this recquires silence tongue.gif I will try to get them as soon as possible smile.gif
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.