erebusant Posted January 21, 2009 Share Posted January 21, 2009 As the title states, I'd like to relocate a couple of entrances in some area files. Will the following code work? I'm fairly unsure of the + 0x80 part in the identifier portion of the code. More comfortable with the rest. COPY_EXISTING ~AR0015.ARE~ ~override~ ~AR6526.ARE~ ~override~ READ_LONG 0x68 "entrances_off" READ_SHORT 0x6c "entrances_num" WHILE ("%entrances_num%" > 0) BEGIN SET "entrances_num" = ("%entrances_num%" - 1) READ_ASCII ("%entrances_off%" + 0x80 + ("%entrances_num%" * 0x68)) "entrance_name" PATCH_IF ("%entrance_name%" STRING_COMPARE_CASE "Exit6507" = 0) BEGIN WRITE_SHORT (offset+0x20) 1557 //X WRITE_SHORT (offset+0x22) 2509 //Y WRITE_LONG (offset+0x24) "15" // facing END END BUT_ONLY_IF_IT_CHANGES or would this work? COPY_EXISTING ~AR0015.ARE~ ~override~ ~AR6526.ARE~ ~override~ READ_LONG 0x68 "entrances_off" READ_SHORT 0x6c "entrances_num" FOR( cnt=0; cnt<"%entrances_num%"; cnt=cnt+1 ) BEGIN //entrances loop READ_ASCII ("%entrances_offset%"+0x68*cnt) "entry_name" (8) PATCH_IF (("%entry_name%" STRING_COMPARE_CASE "Exit6507")=0) BEGIN WRITE_SHORT ("%entrances_offset%"+0x68*cnt+0x20) 1557 WRITE_SHORT ("%entrances_offset%"+0x68*cnt+0x22) 2509 END END BUT_ONLY_IF_IT_CHANGES While I'm at it, does anyone know the correct code for "NPC's Cannot pass" in a travel trigger? WRITE_LONG (offset+0x60) 0x00000000 //flags - can not be passed by NPC Link to comment
Ardanis Posted January 22, 2009 Share Posted January 22, 2009 I'm fairly unsure of the + 0x80 part in the identifier portion of the codeMe too. COPY_EXISTING ~AR0015.ARE~ ~override~ ~AR6526.ARE~ ~override~ READ_LONG 0x68 "entrances_off" READ_SHORT 0x6c "entrances_num" FOR( cnt=0; cnt<"%entrances_num%"; cnt=cnt+1 ) BEGIN //entrances loop READ_ASCII ("%entrances_offset%"+0x68*cnt) "entry_name" (8) PATCH_IF (("%entry_name%" STRING_COMPARE_CASE "Exit6507")=0) BEGIN WRITE_SHORT ("%entrances_offset%"+0x68*cnt+0x20) 1557 WRITE_SHORT ("%entrances_offset%"+0x68*cnt+0x22) 2509 END END BUT_ONLY_IF_IT_CHANGES You have 'entrances_off' and 'entrances_offset', they should be the same. While I'm at it, does anyone know the correct code for "NPC's Cannot pass" in a travel trigger? WRTIE_LONG (offset+0x60) 512 Or, if you need to patch only that single bit - it's the 2nd byte, 2nd bit (from the end). From my additional tweaks: BEGIN ~Set 'NPC can't pass' flags to entrances with 'party required' flags on~ COPY_EXISTING_REGEXP GLOB ~^.+\.are$~ ~override~ // COPY_EXISTING ~ar0802.are~ ~override~ READ_SHORT 0x5a trig_num READ_LONG 0x5c trig_off FOR (i=0; i<trig_num; i+=1) BEGIN READ_BYTE (trig_off+i*0xc4+0x60) flags1 READ_BYTE (trig_off+i*0xc4+0x61) flags2 PATCH_IF ((flags1 BAND 0b00000100) == 0b00000100) BEGIN WRITE_BYTE (trig_off+i*0xc4+0x61) (flags2 BOR 0b00000010) END END BUT_ONLY_IF_IT_CHANGES Link to comment
erebusant Posted January 22, 2009 Author Share Posted January 22, 2009 I'm fairly unsure of the + 0x80 part in the identifier portion of the codeMe too. COPY_EXISTING ~AR0015.ARE~ ~override~ ~AR6526.ARE~ ~override~ READ_LONG 0x68 "entrances_off" READ_SHORT 0x6c "entrances_num" FOR( cnt=0; cnt<"%entrances_num%"; cnt=cnt+1 ) BEGIN //entrances loop READ_ASCII ("%entrances_offset%"+0x68*cnt) "entry_name" (8) PATCH_IF (("%entry_name%" STRING_COMPARE_CASE "Exit6507")=0) BEGIN WRITE_SHORT ("%entrances_offset%"+0x68*cnt+0x20) 1557 WRITE_SHORT ("%entrances_offset%"+0x68*cnt+0x22) 2509 END END BUT_ONLY_IF_IT_CHANGES You have 'entrances_off' and 'entrances_offset', they should be the same. Yep. I found that out, but it works once the change was made. While I'm at it, does anyone know the correct code for "NPC's Cannot pass" in a travel trigger? WRTIE_LONG (offset+0x60) 512 Or, if you need to patch only that single bit - it's the 2nd byte, 2nd bit (from the end). It ended up being 0x00000200. Had to take the 9th flag extrapolated out (512) and put the 512 into the decimal to hex converter for the correct box to be checked. From my additional tweaks: BEGIN ~Set 'NPC can't pass' flags to entrances with 'party required' flags on~ COPY_EXISTING_REGEXP GLOB ~^.+\.are$~ ~override~ // COPY_EXISTING ~ar0802.are~ ~override~ READ_SHORT 0x5a trig_num READ_LONG 0x5c trig_off FOR (i=0; i<trig_num; i+=1) BEGIN READ_BYTE (trig_off+i*0xc4+0x60) flags1 READ_BYTE (trig_off+i*0xc4+0x61) flags2 PATCH_IF ((flags1 BAND 0b00000100) == 0b00000100) BEGIN WRITE_BYTE (trig_off+i*0xc4+0x61) (flags2 BOR 0b00000010) END END BUT_ONLY_IF_IT_CHANGES Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.