plainab Posted December 21, 2011 Share Posted December 21, 2011 It actually places one at the bottom (all zeros) and one at the top with the proper data. In other words, I've two new effect slots. it wasn't two new effects. it was one new effect and a replacement of the AC modifier effect (which is the one at the top). Only one effect is added per use of the function wipt_new_eqfx Your new code helps (only one new effect is added), but comes up short.that's cause it wasn't in your code which i pulled and tested and why i suggested you look at the other values and add as needed Link to comment
grogerson Posted April 23, 2012 Author Share Posted April 23, 2012 After suffering a bout of insanity (otherwise known as playing Ultima IX) I'm back to BG1 Tweaks. Strange thing is, I had it working but now it doesn't. Instead I now get this: ERROR: cannot convert wipt_fx_off or %wipt_fx_off% to an integer This code occurs only in the wipt.tph file. Can you help me on this? Link to comment
plainab Posted April 23, 2012 Share Posted April 23, 2012 can I see the patch that you using the functions in? Link to comment
grogerson Posted April 24, 2012 Author Share Posted April 24, 2012 I expanded this component to include mod items as well. This is the first part of the mod component (six colors, six times the size). I compared it to the setup I had for BG1 only shields and the code (except for color) is the same. INCLUDE ~bg1tweaks/lib/wipt.tph~ COPY_EXISTING ~X#AJSBG1.ITM~ ~override~ // add effect, change to shield panel color cycle RED (AJANTIS BG1) LAUNCH_PATCH_FUNCTION ~wipt_new_eqfx~ INT_VAR wipt_n_opco = 9 wipt_n_targ = 1 wipt_n_par1 = 38400 wipt_n_par2 = 2621474 wipt_n_tmod = 2 wipt_n_pro1 = 100 END BUT_ONLY COPY_EXISTING ~shld02.itm~ ~override~ // effect exists, change to shield panel color cycle RED ~CMSHQ01.ITM~ ~override~ // SMALL SHIELD OF FIRE +2 (CoM Dark Horizons) ~SHLDDS01.ITM~ ~override~ // CUCHOINNEACH'S SMALL SHIELD +3 (CoM DSotSC) ~CUSHLD01.ITM~ ~override~ // CUCHOINNEACH'S SMALL SHIELD +3 (IEGMC NTotSC) LAUNCH_PATCH_MACRO ~wipt_item_reader~ FOR (idx=0;idx<%wipt_eqfx_num%;idx+=1) BEGIN PATCH_IF ($wipt_r_opco("%idx%") = 7) AND ($wipt_r_par2("%idx%") = 34) BEGIN LAUNCH_PATCH_FUNCTION ~wipt_item_writer~ INT_VAR $wipt_w_opco("%idx%") = 9 $wipt_w_par1("%idx%") = 38400 $wipt_w_par2("%idx%") = 2621474 END END END BUT_ONLY The strange thing is, I tested this while the various mods were installed with no problem. The magic shields glowed the proper colors. Now it won't install, either in basic BG1 or TotSC. Both give me the same error code. Copying and patching 1 file ... ERROR: cannot convert wipt_fx_off or %wipt_fx_off% to an integer ERROR: [X#AJSBG1.ITM] -> [override] Patching Failed (COPY) (Not_found) Stopping installation because of error. Link to comment
plainab Posted April 24, 2012 Share Posted April 24, 2012 You aren't launching the item reader. add this LAUNCH_PATCH_MACRO ~wipt_item_reader~ after the COPY line of the first copy block You've already got it in the second copy block so that one would work fine. Edit: all the write macros/functions depend upon the reader being used. but I wanted/needed the ability to change values from what was read. thus it was easier for me to keep them separate rather than having the write macros/functions call up the reader. Link to comment
grogerson Posted April 26, 2012 Author Share Posted April 26, 2012 So it should read: COPY_EXISTING ~X#AJSBG1.ITM~ ~override~ // add effect, change to shield panel color cycle RED (AJANTIS BG1) LAUNCH_PATCH_MACRO ~wipt_item_reader~ LAUNCH_PATCH_FUNCTION ~wipt_new_eqfx~ INT_VAR wipt_n_opco = 9 wipt_n_targ = 1 wipt_n_par1 = 38400 wipt_n_par2 = 2621474 wipt_n_tmod = 2 wipt_n_pro1 = 100 END BUT_ONLY I'll give it a try. Thanks. Link to comment
grogerson Posted April 26, 2012 Author Share Posted April 26, 2012 Didn't work. Copying and patching 1 file ... ERROR: cannot convert wipt_fx_off or %wipt_fx_off% to an integer ERROR: [X#AJSBG1.ITM] -> [override] Patching Failed (COPY) (Not_found) Stopping installation because of error. I've included the item in the ALLOW_MISSING section (~X#AJSBG1.ITM~), and verified the spelling (~X#AJSBG1.ITM~) in the component. And it worked before my bout of madness. I'd like to get playing and testing again, but... Link to comment
plainab Posted April 26, 2012 Share Posted April 26, 2012 if you comment that particular patch out, does the other one following work properly? ************************ I downloaded Ajantis expansion.... when i've some time I'll take a look at it locally. I can't see any reason why it wouldn't work of the top of my head, so I'll delve into it as soon as I can. for now, move on to other things you need to get done in the mod.... Link to comment
plainab Posted April 26, 2012 Share Posted April 26, 2012 aside from putting in some checks to make sure files existed or not and putting in a PRINT line so i could see whats going on during install. I had no problems. I do not have the wipt.tph file in the same location so I had to point to it elsewhere. Is it possible that your copy has gotten messed up? Also I had incorrectly told you to add the launch of the reader. its already done inside the function that adds new equipping effects. this worked for me INCLUDE ~bgfixpack/tph/wipt.tph~ ACTION_FOR_EACH file IN ~X#AJSBG1.ITM~ BEGIN ACTION_IF (FILE_EXISTS_IN_GAME ~%file%~) THEN BEGIN COPY_EXISTING ~%file%~ ~override~ // add effect, change to shield panel color cycle RED (AJANTIS BG1) LAUNCH_PATCH_FUNCTION ~wipt_new_eqfx~ INT_VAR wipt_n_opco = 9 wipt_n_targ = 1 wipt_n_par1 = 38400 wipt_n_par2 = 2621474 wipt_n_tmod = 2 wipt_n_pro1 = 100 END PATCH_PRINT ~%file% - changed shield panel color to RED~ BUT_ONLY END END ACTION_FOR_EACH file IN ~shld02.itm~ ~CMSHQ01.ITM~ ~SHLDDS01.ITM~ ~CUSHLD01.ITM~ BEGIN ACTION_IF (FILE_EXISTS_IN_GAME ~%file%~) THEN BEGIN COPY_EXISTING ~%file%~ ~override~ // effect exists, change to shield panel color cycle RED LAUNCH_PATCH_MACRO ~wipt_item_reader~ FOR (idx=0;idx<%wipt_eqfx_num%;idx+=1) BEGIN PATCH_IF ($wipt_r_opco("%idx%") = 7) AND ($wipt_r_par2("%idx%") = 34) BEGIN LAUNCH_PATCH_FUNCTION ~wipt_item_writer~ INT_VAR $wipt_w_opco("%idx%") = 9 $wipt_w_par1("%idx%") = 38400 $wipt_w_par2("%idx%") = 2621474 END PATCH_PRINT ~%file% - changed shield panel color to RED~ END END BUT_ONLY END END check your wipt.tph file and make sure it matches this one: DEFINE_PATCH_MACRO ~wipt_item_reader~ BEGIN PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN // protects against invalid files DEFINE_ARRAY h_entry BEGIN un in ri fl1 fl2 fl3 fl4 it u1 u2 u3 u4 ia ml ms msb k1 mi k2 md k3 mw k4 mc wp mch pr st ii lo gi we ud id di en END DEFINE_ARRAY h_offst BEGIN 0x8 0xc 0x10 0x18 0x19 0x1a 0x1b 0x1c 0x1e 0x1f 0x20 0x21 0x22 0x24 0x26 0x28 0x29 0x2a 0x2b 0x2c 0x2d 0x2e 0x2f 0x30 0x31 0x32 0x34 0x38 0x3a 0x42 0x44 0x4c 0x50 0x54 0x58 0x60 END DEFINE_ARRAY h_SoWrt BEGIN 4 4 8 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 4 2 8 2 8 4 4 4 8 4 END DEFINE_ARRAY h_AsciL BEGIN 0 0 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 0 8 0 0 0 8 0 END DEFINE_ARRAY h_Bit BEGIN 0 0 0 1 1 1 1 0 1 1 1 1 0 0 0 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 END FOR(hi=0;hi<36;hi+=1)BEGIN SET $wipt_Off($h_entry("%hi%")) = $h_offst("%hi%") //set offset for entry SET $wipt_SoW($h_entry("%hi%")) = $h_SoWrt("%hi%") //set size of write for entry SET $wipt_AcL($h_entry("%hi%")) = $h_AsciL("%hi%") //set ascii length 0 = non-ascii; 8 = file name ascii; 32 = name & variable ascii SET $wipt_Bit($h_entry("%hi%")) = $h_Bit("%hi%") //set whether entry should be written in bit format PATCH_IF ($h_SoWrt("%hi%") = 1) BEGIN READ_BYTE $wipt_Off($h_entry("%hi%")) $wipt_r($h_entry("%hi%")) END PATCH_IF ($h_SoWrt("%hi%") = 2) BEGIN READ_SHORT $wipt_Off($h_entry("%hi%")) $wipt_r($h_entry("%hi%")) END PATCH_IF ($h_SoWrt("%hi%") = 4) BEGIN READ_LONG $wipt_Off($h_entry("%hi%")) $wipt_r($h_entry("%hi%")) END PATCH_IF ($h_SoWrt("%hi%") = 8) AND ($h_AsciL("%hi%") = 8) BEGIN READ_ASCII $wipt_Off($h_entry("%hi%")) $wipt_r($h_entry("%hi%")) (8) NULL END PATCH_IF ($h_SoWrt("%hi%") = 8) AND ($h_AsciL("%hi%") = 32) BEGIN READ_ASCII $wipt_Off($h_entry("%hi%")) $wipt_r($h_entry("%hi%")) (32) NULL END END //begin ability to access abilities and effects SET wipt_abil_size = 0x38 SET wipt_fx_size = 0x30 DEFINE_ARRAY h_entry BEGIN abil_off abil_num fx_off eqfx_idx eqfx_num END DEFINE_ARRAY h_offst BEGIN 0x64 0x68 0x6a 0x6e 0x70 END DEFINE_ARRAY h_SoWrt BEGIN 4 2 4 2 2 END DEFINE_ARRAY h_AsciL BEGIN 0 0 0 0 0 END DEFINE_ARRAY h_Bit BEGIN 0 0 0 0 0 END FOR(hmi=0;hmi<5;hmi+=1)BEGIN SET $wipt_Off($h_entry("%hmi%")) = $h_offst("%hmi%") //set offset for entry SET $wipt_SoW($h_entry("%hmi%")) = $h_SoWrt("%hmi%") //set size of write for entry SET $wipt_AcL($h_entry("%hmi%")) = $h_AsciL("%hmi%") //set ascii length 0 = non-ascii; 8 = file name ascii; 32 = name & variable ascii SET $wipt_Bit($h_entry("%hmi%")) = $h_Bit("%hmi%") //set whether entry should be written in bit format PATCH_IF ($h_SoWrt("%hmi%") = 2) BEGIN READ_SHORT $h_offst("%hmi%") $wipt($h_entry("%hmi%")) END PATCH_IF ($h_SoWrt("%hmi%") = 4) BEGIN READ_LONG $h_offst("%hmi%") $wipt($h_entry("%hmi%")) END END SET wipt_total_fx = %wipt_eqfx_num% //begin ability to read and edit Equipping effects FOR(el1=%wipt_eqfx_idx%;el1<%wipt_eqfx_num%;el1+=1)BEGIN SET wipt_fx_location=(%wipt_fx_off% + (%el1%*%wipt_fx_size%)) DEFINE_ARRAY e_entry BEGIN opco targ powr par1 par2 tmod resi dura pro1 pro2 reso diet dies savt savb END DEFINE_ARRAY e_offst BEGIN 0x0 0x2 0x3 0x4 0x8 0xc 0xd 0xe 0x12 0x13 0x14 0x1c 0x20 0x24 0x28 END DEFINE_ARRAY e_SoWrt BEGIN 2 1 1 4 4 1 1 4 1 1 8 4 4 4 4 END DEFINE_ARRAY e_AsciL BEGIN 0 0 0 0 0 0 0 0 0 0 8 0 0 0 0 END DEFINE_ARRAY e_Bit BEGIN 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 END FOR(ei=0;ei<15;ei+=1)BEGIN SET $wipt_Off($e_entry("%ei%")"%el1%") = %wipt_fx_location% + $e_offst("%ei%") //set offset for entry SET $wipt_SoW($e_entry("%ei%")"%el1%") = $e_SoWrt("%ei%") //set size of write for entry SET $wipt_AcL($e_entry("%ei%")"%el1%") = $e_AsciL("%ei%") //set ascii length 0 = non-ascii; 8 = file name ascii; 32 = name & variable ascii SET $wipt_Bit($e_entry("%ei%")"%el1%") = $e_Bit("%ei%") //set whether entry should be written in bit format PATCH_IF ($e_SoWrt("%ei%") = 1) BEGIN READ_BYTE $wipt_Off($e_entry("%ei%")"%el1%") $wipt_r($e_entry("%ei%")"%el1%") END PATCH_IF ($e_SoWrt("%ei%") = 2) BEGIN READ_SHORT $wipt_Off($e_entry("%ei%")"%el1%") $wipt_r($e_entry("%ei%")"%el1%") END PATCH_IF ($e_SoWrt("%ei%") = 4) BEGIN READ_LONG $wipt_Off($e_entry("%ei%")"%el1%") $wipt_r($e_entry("%ei%")"%el1%") END PATCH_IF ($e_SoWrt("%ei%") = 8) AND ($e_AsciL("%ei%") = 8) BEGIN READ_ASCII $wipt_Off($e_entry("%ei%")"%el1%") $wipt_r($e_entry("%ei%")"%el1%") (8) NULL END PATCH_IF ($e_SoWrt("%ei%") = 8) AND ($e_AsciL("%ei%") = 32) BEGIN READ_ASCII $wipt_Off($e_entry("%ei%")"%el1%") $wipt_r($e_entry("%ei%")"%el1%") (32) NULL END END //end array loop END //end loop through equiping effects //begin ability to read and edit ability headers FOR(al1=0;al1<%wipt_abil_num%;al1+=1)BEGIN SET wipt_abil_location=(%wipt_abil_off% + (%al1%*%wipt_abil_size%)) DEFINE_ARRAY a_entry BEGIN attack id_req useloc useico target tarnum range projec speed thac0b dsides dthrow damagb damagt charge chardp flagb1 flagb2 proani ohand bhand thrust arrow bolt other END DEFINE_ARRAY a_offst BEGIN 0x0 0x1 0x2 0x4 0xc 0xd 0xe 0x10 0x12 0x14 0x16 0x18 0x1a 0x1c 0x22 0x24 0x26 0x27 0x2a 0x2c 0x2e 0x30 0x32 0x34 0x36 END DEFINE_ARRAY a_SoWrt BEGIN 1 1 1 8 1 1 2 2 2 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 END DEFINE_ARRAY a_AsciL BEGIN 0 0 0 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 END DEFINE_ARRAY a_Bit BEGIN 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 END FOR(ai=0;ai<25;ai+=1)BEGIN SET $wipt_Off($a_entry("%ai%")"%al1%") = %wipt_abil_location% + $a_offst("%ai%") //set offset for entry SET $wipt_SoW($a_entry("%ai%")"%al1%") = $a_SoWrt("%ai%") //set size of write for entry SET $wipt_AcL($a_entry("%ai%")"%al1%") = $a_AsciL("%ai%") //set ascii length 0 = non-ascii; 8 = file name ascii; 32 = name & variable ascii SET $wipt_Bit($a_entry("%ai%")"%al1%") = $a_Bit("%ai%") //set whether entry should be written in bit format PATCH_IF ($a_SoWrt("%ai%") = 1) BEGIN READ_BYTE $wipt_Off($a_entry("%ai%")"%al1%") $wipt_r($a_entry("%ai%")"%al1%") END PATCH_IF ($a_SoWrt("%ai%") = 2) BEGIN READ_SHORT $wipt_Off($a_entry("%ai%")"%al1%") $wipt_r($a_entry("%ai%")"%al1%") END //end short read compare write PATCH_IF ($a_SoWrt("%ai%") = 4) BEGIN READ_LONG $wipt_Off($a_entry("%ai%")"%al1%") $wipt_r($a_entry("%ai%")"%al1%") END //end long read compare write PATCH_IF ($a_SoWrt("%ai%") = 8) AND ($a_AsciL("%ai%") = 8) BEGIN READ_ASCII $wipt_Off($a_entry("%ai%")"%al1%") $wipt_r($a_entry("%ai%")"%al1%") (8) NULL END PATCH_IF ($a_SoWrt("%ai%") = 8) AND ($a_AsciL("%ai%") = 32) BEGIN READ_ASCII $wipt_Off($a_entry("%ai%")"%al1%") $wipt_r($a_entry("%ai%")"%al1%") (32) NULL END END //begin ability to read and edit ability effects DEFINE_ARRAY a_entry BEGIN abilfx_num abilfx_idx END DEFINE_ARRAY a_offst BEGIN 0x1e 0x20 END DEFINE_ARRAY a_SoWrt BEGIN 2 2 END DEFINE_ARRAY a_AsciL BEGIN 0 0 END DEFINE_ARRAY a_Bit BEGIN 0 0 END FOR(ami=0;ami<2;ami+=1)BEGIN SET $wipt_Off($a_entry("%ami%")"%al1%") = %wipt_abil_location% + $a_offst("%ami%") //set offset for entry PATCH_IF (%ami% = 0) BEGIN READ_SHORT %wipt_abil_location% + $a_offst("%ami%") $wipt_abilfx_num("%al1%") END PATCH_IF (%ami% = 1) BEGIN READ_SHORT %wipt_abil_location% + $a_offst("%ami%") $wipt_abilfx_idx("%al1%") END END SET wipt_total_fx+=$wipt_abilfx_num("%al1%") FOR(el2=$wipt_abilfx_idx("%al1%");el2<($wipt_abilfx_idx("%al1%")+$wipt_abilfx_num("%al1%"));el2+=1)BEGIN SET wipt_abilfx_location=(%wipt_fx_off% + (%el2%*%wipt_fx_size%)) DEFINE_ARRAY ae_entry BEGIN opco targ powr par1 par2 tmod resi dura pro1 pro2 reso diet dies savt savb END DEFINE_ARRAY ae_offst BEGIN 0x0 0x2 0x3 0x4 0x8 0xc 0xd 0xe 0x12 0x13 0x14 0x1c 0x20 0x24 0x28 END DEFINE_ARRAY ae_SoWrt BEGIN 2 1 1 4 4 1 1 4 1 1 8 4 4 4 4 END DEFINE_ARRAY ae_AsciL BEGIN 0 0 0 0 0 0 0 0 0 0 8 0 0 0 0 END DEFINE_ARRAY ae_Bit BEGIN 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 END FOR(aei=0;aei<15;aei+=1)BEGIN SET $wipt_Off($ae_entry("%aei%")"%el2%") = %wipt_abilfx_location% + $ae_offst("%aei%") //set offset for entry SET $wipt_SoW($ae_entry("%aei%")"%el2%") = $ae_SoWrt("%aei%") //set size of write for entry SET $wipt_AcL($ae_entry("%aei%")"%el2%") = $ae_AsciL("%aei%") //set ascii length 0 = non-ascii; 8 = file name ascii; 32 = name & variable ascii SET $wipt_Bit($ae_entry("%aei%")"%el2%") = $ae_Bit("%aei%") //set whether entry should be written in bit format PATCH_IF ($ae_SoWrt("%aei%") = 1) BEGIN READ_BYTE $wipt_Off($ae_entry("%aei%")"%el2%") $wipt_r($ae_entry("%aei%")"%el2%") END //end byte read compare write PATCH_IF ($ae_SoWrt("%aei%") = 2) BEGIN READ_SHORT $wipt_Off($ae_entry("%aei%")"%el2%") $wipt_r($ae_entry("%aei%")"%el2%") END //end short read compare write PATCH_IF ($ae_SoWrt("%aei%") = 4) BEGIN READ_LONG $wipt_Off($ae_entry("%aei%")"%el2%") $wipt_r($ae_entry("%aei%")"%el2%") END //end long read compare write PATCH_IF ($ae_SoWrt("%aei%") = 8) AND ($ae_AsciL("%aei%") = 8) BEGIN READ_ASCII $wipt_Off($ae_entry("%aei%")"%el2%") $wipt_r($ae_entry("%aei%")"%el2%") (8) NULL END PATCH_IF ($ae_SoWrt("%aei%") = 8) AND ($ae_AsciL("%aei%") = 32) BEGIN READ_ASCII $wipt_Off($ae_entry("%aei%")"%el2%") $wipt_r($ae_entry("%aei%")"%el2%") (32) NULL END END END END //end ability header read END END//end function define DEFINE_PATCH_FUNCTION ~wipt_item_writer~ BEGIN PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN // protects against invalid files DEFINE_ARRAY h_entry BEGIN un in ri fl1 fl2 fl3 fl4 it u1 u2 u3 u4 ia ml ms msb k1 mi k2 md k3 mw k4 mc wp mch pr st ii lo gi we ud id di en END DEFINE_ARRAY h_offst BEGIN 0x8 0xc 0x10 0x18 0x19 0x1a 0x1b 0x1c 0x1e 0x1f 0x20 0x21 0x22 0x24 0x26 0x28 0x29 0x2a 0x2b 0x2c 0x2d 0x2e 0x2f 0x30 0x31 0x32 0x34 0x38 0x3a 0x42 0x44 0x4c 0x50 0x54 0x58 0x60 END DEFINE_ARRAY h_SoWrt BEGIN 4 4 8 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 4 2 8 2 8 4 4 4 8 4 END DEFINE_ARRAY h_AsciL BEGIN 0 0 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 0 8 0 0 0 8 0 END DEFINE_ARRAY h_Bit BEGIN 0 0 0 1 1 1 1 0 1 1 1 1 0 0 0 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 END FOR(hi=0;hi<36;hi+=1)BEGIN SET $wipt_Off($h_entry("%hi%")) = $h_offst("%hi%") //set offset for entry SET $wipt_SoW($h_entry("%hi%")) = $h_SoWrt("%hi%") //set size of write for entry SET $wipt_AcL($h_entry("%hi%")) = $h_AsciL("%hi%") //set ascii length 0 = non-ascii; 8 = file name ascii; 32 = name & variable ascii SET $wipt_Bit($h_entry("%hi%")) = $h_Bit("%hi%") //set whether entry should be written in bit format PATCH_IF (VARIABLE_IS_SET $wipt_w($h_entry("%hi%")) ) BEGIN PATCH_IF ($h_SoWrt("%hi%") = 1) BEGIN WRITE_BYTE $wipt_Off($h_entry("%hi%")) $wipt_w($h_entry("%hi%")) END PATCH_IF ($h_SoWrt("%hi%") = 2) BEGIN WRITE_SHORT $wipt_Off($h_entry("%hi%")) $wipt_w($h_entry("%hi%")) END PATCH_IF ($h_SoWrt("%hi%") = 4) BEGIN WRITE_LONG $wipt_Off($h_entry("%hi%")) $wipt_w($h_entry("%hi%")) END PATCH_IF ($h_SoWrt("%hi%") = 8) AND ($h_AsciL("%hi%") = 8) BEGIN WRITE_ASCIIE $wipt_Off($h_entry("%hi%")) $wipt_w($h_entry("%hi%")) (8) END PATCH_IF ($h_SoWrt("%hi%") = 8) AND ($h_AsciL("%hi%") = 32) BEGIN WRITE_ASCIIE $wipt_Off($h_entry("%hi%")) $wipt_w($h_entry("%hi%")) (32) END END END //begin ability to access abilities and effects //pre-set by using wipt_item_reader which will be a requirement // SET wipt_abil_size = 0x38 // SET wipt_fx_size = 0x30 DEFINE_ARRAY h_entry BEGIN abil_off abil_num fx_off eqfx_idx eqfx_num END DEFINE_ARRAY h_offst BEGIN 0x64 0x68 0x6a 0x6e 0x70 END DEFINE_ARRAY h_SoWrt BEGIN 4 2 4 2 2 END DEFINE_ARRAY h_AsciL BEGIN 0 0 0 0 0 END DEFINE_ARRAY h_Bit BEGIN 0 0 0 0 0 END FOR(hmi=0;hmi<5;hmi+=1)BEGIN SET $wipt_Off($h_entry("%hmi%")) = $h_offst("%hmi%") //set offset for entry SET $wipt_SoW($h_entry("%hmi%")) = $h_SoWrt("%hmi%") //set size of write for entry SET $wipt_AcL($h_entry("%hmi%")) = $h_AsciL("%hmi%") //set ascii length 0 = non-ascii; 8 = file name ascii; 32 = name & variable ascii SET $wipt_Bit($h_entry("%hmi%")) = $h_Bit("%hmi%") //set whether entry should be written in bit format PATCH_IF ($h_SoWrt("%hmi%") = 2) BEGIN READ_SHORT $h_offst("%hmi%") $wipt($h_entry("%hmi%")) END PATCH_IF ($h_SoWrt("%hmi%") = 4) BEGIN READ_LONG $h_offst("%hmi%") $wipt($h_entry("%hmi%")) END END //pre-set by using wipt_item_reader which will be a requirement // SET wipt_total_fx = %wipt_eqfx_num% //begin ability to read and edit Equipping effects FOR(el1=%wipt_eqfx_idx%;el1<%wipt_eqfx_num%;el1+=1)BEGIN SET wipt_fx_location=(%wipt_fx_off% + (%el1%*%wipt_fx_size%)) DEFINE_ARRAY e_entry BEGIN opco targ powr par1 par2 tmod resi dura pro1 pro2 reso diet dies savt savb END DEFINE_ARRAY e_offst BEGIN 0x0 0x2 0x3 0x4 0x8 0xc 0xd 0xe 0x12 0x13 0x14 0x1c 0x20 0x24 0x28 END DEFINE_ARRAY e_SoWrt BEGIN 2 1 1 4 4 1 1 4 1 1 8 4 4 4 4 END DEFINE_ARRAY e_AsciL BEGIN 0 0 0 0 0 0 0 0 0 0 8 0 0 0 0 END DEFINE_ARRAY e_Bit BEGIN 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 END FOR(ei=0;ei<15;ei+=1)BEGIN SET $wipt_Off($e_entry("%ei%")"%el1%") = %wipt_fx_location% + $e_offst("%ei%") //set offset for entry SET $wipt_SoW($e_entry("%ei%")"%el1%") = $e_SoWrt("%ei%") //set size of write for entry SET $wipt_AcL($e_entry("%ei%")"%el1%") = $e_AsciL("%ei%") //set ascii length 0 = non-ascii; 8 = file name ascii; 32 = name & variable ascii SET $wipt_Bit($e_entry("%ei%")"%el1%") = $e_Bit("%ei%") //set whether entry should be written in bit format PATCH_IF (VARIABLE_IS_SET $wipt_w($e_entry("%ei%")"%el1%") ) BEGIN PATCH_IF ($e_SoWrt("%ei%") = 1) BEGIN WRITE_BYTE $wipt_Off($e_entry("%ei%")"%el1%") $wipt_w($e_entry("%ei%")"%el1%") END PATCH_IF ($e_SoWrt("%ei%") = 2) BEGIN WRITE_SHORT $wipt_Off($e_entry("%ei%")"%el1%") $wipt_w($e_entry("%ei%")"%el1%") END PATCH_IF ($e_SoWrt("%ei%") = 4) BEGIN WRITE_LONG $wipt_Off($e_entry("%ei%")"%el1%") $wipt_w($e_entry("%ei%")"%el1%") END PATCH_IF ($e_SoWrt("%ei%") = 8) AND ($e_AsciL("%ei%") = 8) BEGIN WRITE_ASCIIE $wipt_Off($e_entry("%ei%")"%el1%") $wipt_w($e_entry("%ei%")"%el1%") (8) END PATCH_IF ($e_SoWrt("%ei%") = 8) AND ($e_AsciL("%ei%") = 32) BEGIN WRITE_ASCIIE $wipt_Off($e_entry("%ei%")"%el1%") $wipt_w($e_entry("%ei%")"%el1%") (32) END END //end variable is set END //end array loop END //end loop through equiping effects //begin ability to read and edit ability headers FOR(al1=0;al1<%wipt_abil_num%;al1+=1)BEGIN SET wipt_abil_location=(%wipt_abil_off% + (%al1%*%wipt_abil_size%)) DEFINE_ARRAY a_entry BEGIN attack id_req useloc useico target tarnum range projec speed thac0b dsides dthrow damagb damagt charge chardp flagb1 flagb2 proani ohand bhand thrust arrow bolt other END DEFINE_ARRAY a_offst BEGIN 0x0 0x1 0x2 0x4 0xc 0xd 0xe 0x10 0x12 0x14 0x16 0x18 0x1a 0x1c 0x22 0x24 0x26 0x27 0x2a 0x2c 0x2e 0x30 0x32 0x34 0x36 END DEFINE_ARRAY a_SoWrt BEGIN 1 1 1 8 1 1 2 2 2 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 END DEFINE_ARRAY a_AsciL BEGIN 0 0 0 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 END DEFINE_ARRAY a_Bit BEGIN 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 END FOR(ai=0;ai<25;ai+=1)BEGIN SET $wipt_Off($a_entry("%ai%")"%al1%") = %wipt_abil_location% + $a_offst("%ai%") //set offset for entry SET $wipt_SoW($a_entry("%ai%")"%al1%") = $a_SoWrt("%ai%") //set size of write for entry SET $wipt_AcL($a_entry("%ai%")"%al1%") = $a_AsciL("%ai%") //set ascii length 0 = non-ascii; 8 = file name ascii; 32 = name & variable ascii SET $wipt_Bit($a_entry("%ai%")"%al1%") = $a_Bit("%ai%") //set whether entry should be written in bit format PATCH_IF (VARIABLE_IS_SET $wipt_w($a_entry("%ai%")"%al1%") ) BEGIN PATCH_IF ($a_SoWrt("%ai%") = 1) BEGIN WRITE_BYTE $wipt_Off($a_entry("%ai%")"%al1%") $wipt_w($a_entry("%ai%")"%al1%") END PATCH_IF ($a_SoWrt("%ai%") = 2) BEGIN WRITE_SHORT $wipt_Off($a_entry("%ai%")"%al1%") $wipt_w($a_entry("%ai%")"%al1%") END //end short read compare write PATCH_IF ($a_SoWrt("%ai%") = 4) BEGIN WRITE_LONG $wipt_Off($a_entry("%ai%")"%al1%") $wipt_w($a_entry("%ai%")"%al1%") END //end long read compare write PATCH_IF ($a_SoWrt("%ai%") = 8) AND ($a_AsciL("%ai%") = 8) BEGIN WRITE_ASCIIE $wipt_Off($a_entry("%ai%")"%al1%") $wipt_w($a_entry("%ai%")"%al1%") (8) END PATCH_IF ($a_SoWrt("%ai%") = 8) AND ($a_AsciL("%ai%") = 32) BEGIN WRITE_ASCIIE $wipt_Off($a_entry("%ai%")"%al1%") $wipt_w($a_entry("%ai%")"%al1%") (32) END END //end variable is set END //begin ability to read and edit ability effects DEFINE_ARRAY a_entry BEGIN abilfx_num abilfx_idx END DEFINE_ARRAY a_offst BEGIN 0x1e 0x20 END DEFINE_ARRAY a_SoWrt BEGIN 2 2 END DEFINE_ARRAY a_AsciL BEGIN 0 0 END DEFINE_ARRAY a_Bit BEGIN 0 0 END FOR(ami=0;ami<2;ami+=1)BEGIN SET $wipt_Off($a_entry("%ami%")"%al1%") = %wipt_abil_location% + $a_offst("%ami%") //set offset for entry PATCH_IF (%ami% = 0) BEGIN READ_SHORT %wipt_abil_location% + $a_offst("%ami%") $wipt_abilfx_num("%al1%") END PATCH_IF (%ami% = 1) BEGIN READ_SHORT %wipt_abil_location% + $a_offst("%ami%") $wipt_abilfx_idx("%al1%") END END //pre-set by using wipt_item_reader which will be a requirement // SET wipt_total_fx+=$wipt_abilfx_num("%al1%") FOR(el2=$wipt_abilfx_idx("%al1%");el2<($wipt_abilfx_idx("%al1%")+$wipt_abilfx_num("%al1%"));el2+=1)BEGIN SET wipt_abilfx_location=(%wipt_fx_off% + (%el2%*%wipt_fx_size%)) DEFINE_ARRAY ae_entry BEGIN opco targ powr par1 par2 tmod resi dura pro1 pro2 reso diet dies savt savb END DEFINE_ARRAY ae_offst BEGIN 0x0 0x2 0x3 0x4 0x8 0xc 0xd 0xe 0x12 0x13 0x14 0x1c 0x20 0x24 0x28 END DEFINE_ARRAY ae_SoWrt BEGIN 2 1 1 4 4 1 1 4 1 1 8 4 4 4 4 END DEFINE_ARRAY ae_AsciL BEGIN 0 0 0 0 0 0 0 0 0 0 8 0 0 0 0 END DEFINE_ARRAY ae_Bit BEGIN 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 END FOR(aei=0;aei<15;aei+=1)BEGIN SET $wipt_Off($ae_entry("%aei%")"%el2%") = %wipt_abilfx_location% + $ae_offst("%aei%") //set offset for entry SET $wipt_SoW($ae_entry("%aei%")"%el2%") = $ae_SoWrt("%aei%") //set size of write for entry SET $wipt_AcL($ae_entry("%aei%")"%el2%") = $ae_AsciL("%aei%") //set ascii length 0 = non-ascii; 8 = file name ascii; 32 = name & variable ascii SET $wipt_Bit($ae_entry("%aei%")"%el2%") = $ae_Bit("%aei%") //set whether entry should be written in bit format PATCH_IF (VARIABLE_IS_SET $wipt_w($ae_entry("%aei%")"%el2%") ) BEGIN PATCH_IF ($ae_SoWrt("%aei%") = 1) BEGIN WRITE_BYTE $wipt_Off($ae_entry("%aei%")"%el2%") $wipt_w($ae_entry("%aei%")"%el2%") END //end byte read compare write PATCH_IF ($ae_SoWrt("%aei%") = 2) BEGIN WRITE_SHORT $wipt_Off($ae_entry("%aei%")"%el2%") $wipt_w($ae_entry("%aei%")"%el2%") END //end short read compare write PATCH_IF ($ae_SoWrt("%aei%") = 4) BEGIN WRITE_LONG $wipt_Off($ae_entry("%aei%")"%el2%") $wipt_w($ae_entry("%aei%")"%el2%") END //end long read compare write PATCH_IF ($ae_SoWrt("%aei%") = 8) AND ($ae_AsciL("%aei%") = 8) BEGIN WRITE_ASCIIE $wipt_Off($ae_entry("%aei%")"%el2%") $wipt_r($ae_entry("%aei%")"%el2%") (8) END PATCH_IF ($ae_SoWrt("%aei%") = 8) AND ($ae_AsciL("%aei%") = 32) BEGIN WRITE_ASCIIE $wipt_Off($ae_entry("%aei%")"%el2%") $wipt_w($ae_entry("%aei%")"%el2%") (32) END END //end variable is set END END END END END//end function define //Used code from miloch to create the function... DEFINE_PATCH_FUNCTION ~wipt_new_eqfx~ BEGIN LAUNCH_PATCH_MACRO ~wipt_item_reader~ SET wipt_insert_loc = (%wipt_fx_off% + (%wipt_fx_size% * %wipt_eqfx_num%)) INSERT_BYTES %wipt_insert_loc% %wipt_fx_size% SET wipt_fx_location=%wipt_insert_loc% DEFINE_ARRAY e_entry BEGIN opco targ powr par1 par2 tmod resi dura pro1 pro2 reso diet dies savt savb END DEFINE_ARRAY e_offst BEGIN 0x0 0x2 0x3 0x4 0x8 0xc 0xd 0xe 0x12 0x13 0x14 0x1c 0x20 0x24 0x28 END DEFINE_ARRAY e_SoWrt BEGIN 2 1 1 4 4 1 1 4 1 1 8 4 4 4 4 END DEFINE_ARRAY e_AsciL BEGIN 0 0 0 0 0 0 0 0 0 0 8 0 0 0 0 END DEFINE_ARRAY e_Bit BEGIN 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 END FOR(ei=0;ei<15;ei+=1)BEGIN SET $wipt_Off($e_entry("%ei%")) = %wipt_fx_location% + $e_offst("%ei%") //set offset for entry SET $wipt_SoW($e_entry("%ei%")) = $e_SoWrt("%ei%") //set size of write for entry SET $wipt_AcL($e_entry("%ei%")) = $e_AsciL("%ei%") //set ascii length 0 = non-ascii; 8 = file name ascii; 32 = name & variable ascii SET $wipt_Bit($e_entry("%ei%")) = $e_Bit("%ei%") //set whether entry should be written in bit format PATCH_IF (VARIABLE_IS_SET $wipt_n($e_entry("%ei%")) ) BEGIN PATCH_IF ($e_SoWrt("%ei%") = 1) BEGIN WRITE_BYTE $wipt_Off($e_entry("%ei%")) $wipt_n($e_entry("%ei%")) END PATCH_IF ($e_SoWrt("%ei%") = 2) BEGIN WRITE_SHORT $wipt_Off($e_entry("%ei%")) $wipt_n($e_entry("%ei%")) END PATCH_IF ($e_SoWrt("%ei%") = 4) BEGIN WRITE_LONG $wipt_Off($e_entry("%ei%")) $wipt_n($e_entry("%ei%")) END PATCH_IF ($e_SoWrt("%ei%") = 8) AND ($e_AsciL("%ei%") = 8) BEGIN WRITE_ASCIIE $wipt_Off($e_entry("%ei%")) $wipt_n($e_entry("%ei%")) (8) END PATCH_IF ($e_SoWrt("%ei%") = 8) AND ($e_AsciL("%ei%") = 32) BEGIN WRITE_ASCIIE $wipt_Off($e_entry("%ei%")) $wipt_n($e_entry("%ei%")) (32) END END //end variable is set END //end array loop WRITE_SHORT %wipt_Off_eqfx_num% (%wipt_eqfx_num% + 1) FOR (i1 = 0; i1 < %wipt_abil_num%; i1 += 1) BEGIN //Update 1st effect indices PATCH_IF ($wipt_abilfx_idx("%i1%") > %wipt_eqfx_idx%) BEGIN //If ability after eq effects WRITE_SHORT $wipt_Off_abilfx_idx("%i1%") ($wipt_abilfx_idx("%i1%") + 1) //Increase 1st effect index by 1 END END END //end function define //add new ability effects DEFINE_PATCH_FUNCTION ~wipt_new_abilfx~ BEGIN LAUNCH_PATCH_MACRO ~wipt_item_reader~ PATCH_IF (VARIABLE_IS_SET %wipt_abil_idx%) BEGIN FOR(al1=0;al1<%wipt_abil_num%;al1+=1)BEGIN PATCH_IF (%wipt_abil_idx% = %al1%) BEGIN //begin ability to read and edit ability effects DEFINE_ARRAY a_entry BEGIN abilfx_num abilfx_idx END DEFINE_ARRAY a_offst BEGIN 0x1e 0x20 END DEFINE_ARRAY a_SoWrt BEGIN 2 2 END DEFINE_ARRAY a_AsciL BEGIN 0 0 END DEFINE_ARRAY a_Bit BEGIN 0 0 END FOR(ami=0;ami<2;ami+=1)BEGIN SET $wipt_Off($a_entry("%ami%")"%al1%") = %wipt_abil_location% + $a_offst("%ami%") //set offset for entry PATCH_IF (%ami% = 0) BEGIN READ_SHORT %wipt_abil_location% + $a_offst("%ami%") $wipt_abilfx_num("%al1%") WRITE_SHORT %wipt_abil_location% + $a_offst("%ami%") ($wipt_abilfx_num("%al1%") + 1) //update current working ability's # of effects END PATCH_IF (%ami% = 1) BEGIN READ_SHORT %wipt_abil_location% + $a_offst("%ami%") $wipt_abilfx_idx("%al1%") SET wipt_updatebeyondthis = $wipt_abilfx_idx("%al1%") END END SET wipt_total_fx+=$wipt_abilfx_num("%al1%") FOR(el2=$wipt_abilfx_idx("%al1%");el2<($wipt_abilfx_idx("%al1%")+$wipt_abilfx_num("%al1%"));el2+=1)BEGIN SET wipt_abilfx_location=(%wipt_fx_off% + (%el2%*%wipt_fx_size%)) SET wipt_insert_loc = (%wipt_abilfx_location% + ($wipt_abilfx_num("%al1%") * %wipt_fx_size%)) INSERT_BYTES %wipt_insert_loc% %wipt_fx_size% SET wipt_fx_location=%wipt_insert_loc% DEFINE_ARRAY e_entry BEGIN opco targ powr par1 par2 tmod resi dura pro1 pro2 reso diet dies savt savb END DEFINE_ARRAY e_offst BEGIN 0x0 0x2 0x3 0x4 0x8 0xc 0xd 0xe 0x12 0x13 0x14 0x1c 0x20 0x24 0x28 END DEFINE_ARRAY e_SoWrt BEGIN 2 1 1 4 4 1 1 4 1 1 8 4 4 4 4 END DEFINE_ARRAY e_AsciL BEGIN 0 0 0 0 0 0 0 0 0 0 8 0 0 0 0 END DEFINE_ARRAY e_Bit BEGIN 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 END FOR(ei=0;ei<15;ei+=1)BEGIN SET $wipt_Off($e_entry("%ei%")) = %wipt_fx_location% + $e_offst("%ei%") //set offset for entry SET $wipt_SoW($e_entry("%ei%")) = $e_SoWrt("%ei%") //set size of write for entry SET $wipt_AcL($e_entry("%ei%")) = $e_AsciL("%ei%") //set ascii length 0 = non-ascii; 8 = file name ascii; 32 = name & variable ascii SET $wipt_Bit($e_entry("%ei%")) = $e_Bit("%ei%") //set whether entry should be written in bit format PATCH_IF (VARIABLE_IS_SET $wipt_n($e_entry("%ei%")) ) BEGIN PATCH_IF ($e_SoWrt("%ei%") = 1) BEGIN WRITE_BYTE $wipt_Off($e_entry("%ei%")) $wipt_n($e_entry("%ei%")) END PATCH_IF ($e_SoWrt("%ei%") = 2) BEGIN WRITE_SHORT $wipt_Off($e_entry("%ei%")) $wipt_n($e_entry("%ei%")) END PATCH_IF ($e_SoWrt("%ei%") = 4) BEGIN WRITE_LONG $wipt_Off($e_entry("%ei%")) $wipt_n($e_entry("%ei%")) END PATCH_IF ($e_SoWrt("%ei%") = 8) AND ($e_AsciL("%ei%") = 8) BEGIN WRITE_ASCIIE $wipt_Off($e_entry("%ei%")) $wipt_n($e_entry("%ei%")) (8) END PATCH_IF ($e_SoWrt("%ei%") = 8) AND ($e_AsciL("%ei%") = 32) BEGIN WRITE_ASCIIE $wipt_Off($e_entry("%ei%")) $wipt_n($e_entry("%ei%")) (32) END END //end variable is set END //end array loop END END ELSE BEGIN FOR(al2=0;al2<%wipt_abil_num%;al2+=1)BEGIN DEFINE_ARRAY a_entry BEGIN abilfx_num abilfx_idx END DEFINE_ARRAY a_offst BEGIN 0x1e 0x20 END DEFINE_ARRAY a_SoWrt BEGIN 2 2 END DEFINE_ARRAY a_AsciL BEGIN 0 0 END DEFINE_ARRAY a_Bit BEGIN 0 0 END FOR(ami=0;ami<2;ami+=1)BEGIN SET $wipt_Off($a_entry("%ami%")"%al2%") = %wipt_abil_location% + $a_offst("%ami%") //set offset for entry PATCH_IF (%ami% = 0) BEGIN READ_SHORT %wipt_abil_location% + $a_offst("%ami%") $wipt_abilfx_num("%al2%") END PATCH_IF (%ami% = 1) BEGIN READ_SHORT %wipt_abil_location% + $a_offst("%ami%") $wipt_abilfx_idx("%al2%") PATCH_IF ($wipt_abilfx_idx("%al2%") > %wipt_updatebeyondthis%) BEGIN WRITE_SHORT (%wipt_abil_location% + $a_offst("%ami%")) ($wipt_abilfx_idx("%al2%") + 1 ) END END END END SET al1 = %wipt_abil_num% END END END END //end function define Link to comment
grogerson Posted April 27, 2012 Author Share Posted April 27, 2012 I replaced the wipt.tph with yours, problem remained. Changed the tp2 to your method (no ALLOW_MISSING) and it worked. I wonder, could it be a problem with WeiDU231? Don't know but it's working now. Thanks again. Link to comment
plainab Posted April 27, 2012 Share Posted April 27, 2012 possibly ALLOW_MISSING has always been flaky at best It is better to actually check with a FILE_EXIST_IN_GAME at the patch. Doing so allows you to lump together files from BG & ToTSC without having to worry about doing game specific checks. Yes about 2-4 extra lines of code per patch, but saves duplicating code for different platforms. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.