![]() |
The Black Wyrm's Lair Terms of Use |
![]() ![]() ![]() ![]() |
![]() |
![]()
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 |
|
|
![]() |
![]()
Post
#2
|
|
Forum Member Posts: 6 Joined: 17-October 06 ![]() |
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 |
|
|
![]() ![]() |
![]() |
Lo-Fi Version | Time is now: 29th August 2025 - 07:26 AM |