kreso Posted January 18, 2016 Author Share Posted January 18, 2016 Is it doable with CLONE, just if I add SET ~loops~ = 0 at the beggining and SET ~loops~ = (loops + 1)? Weidu documentation says something about CLONE insert point, but I can't get it to work, regardless of value. If I understood Wisp, the problem is insertion of the new effect *before* the existing one. Can it be made so that new effect is added *after*; and would it fix the issue? Link to comment
Jarno Mikkola Posted January 18, 2016 Share Posted January 18, 2016 Do you really need to be looping at all? If all you are trying to do is clone each effect that uses opcode 40, you can accomplish that just with CLONE_EFFECT. You need to be looping to find the effect that uses the opcode 40. Link to comment
Mike1072 Posted January 18, 2016 Share Posted January 18, 2016 Can you explain exactly what you are trying to do? Link to comment
kreso Posted January 18, 2016 Author Share Posted January 18, 2016 Do you really need to be looping at all? If all you are trying to do is clone each effect that uses opcode 40, you can accomplish that just with CLONE_EFFECT. I did exactly that. That works correctly, but installs with warnings and while it's installing, you'll see "Warning - no effects added to *.itm/spl" for each time the opcode isn't cloned. Link to comment
Mike1072 Posted January 18, 2016 Share Posted January 18, 2016 You say you want to find all items (or spells) using a specific opcode and patch them - what do you want to do in the patch? Link to comment
kreso Posted January 18, 2016 Author Share Posted January 18, 2016 You say you want to find all items (or spells) using a specific opcode and patch them - what do you want to do in the patch? Change secondary type. Make them remove a sec type. Link to comment
Mike1072 Posted January 18, 2016 Share Posted January 18, 2016 Okay, so you want to change the secondary type of each ability that has at least one effect matching a specific opcode. COPY_EXISTING_REGEXP GLOB ~^.+\.itm$~ ~override~ PATCH_IF (SOURCE_SIZE > 0x71) BEGIN READ_LONG 0x64 abilities_offset READ_SHORT 0x68 num_abilities READ_LONG 0x6a effects_offset FOR (ability = 0; ability < num_abilities; ability += 1) BEGIN READ_SHORT (abilities_offset + 0x38*ability + 0x1e) num_features READ_SHORT (abilities_offset + 0x38*ability + 0x20) features_ind FOR (effect = 0; effect < num_features; effect += 1) BEGIN READ_SHORT (effects_off + 0x30 * (features_ind + effect) + 0x00) opcode PATCH_IF (opcode == 0x40) BEGIN WRITE_BYTE (abilities_offset + 0x38*ability + 0x19) 13 // secondary type SET effect = num_features // exit loop END END END END BUT_ONLY * not tested for correctness The patch for spells would be identical, except you would be copying .spl files and the 3 lines with an 0x38 would need to have those changed to 0x28 to match the smaller size of spell headers. Link to comment
Mike1072 Posted January 18, 2016 Share Posted January 18, 2016 Okay, you edited your answer. Do you want to ADD AN EFFECT (opcode 221) to remove a secondary type for every effect using opcode 40? Link to comment
Mike1072 Posted January 18, 2016 Share Posted January 18, 2016 Modifying the code you were trying to use earlier, this should create one effect using opcode 221 for every one effect using opcode 40. COPY_EXISTING_REGEXP GLOB ~^.+\.itm$~ ~override~ PATCH_IF (SOURCE_SIZE > 0x71) BEGIN LPF CLONE_EFFECT INT_VAR match_opcode = 40 opcode = 221 timing = 1 parameter1 = 9 savingthrow = 0 parameter2 = ~sectype_k1#Haste~ END END BUT_ONLY Link to comment
kreso Posted January 18, 2016 Author Share Posted January 18, 2016 Modifying the code you were trying to use earlier, this should create one effect using opcode 221 for every one effect using opcode 40. COPY_EXISTING_REGEXP GLOB ~^.+\.itm$~ ~override~ PATCH_IF (SOURCE_SIZE > 0x71) BEGIN LPF CLONE_EFFECT INT_VAR match_opcode = 40 opcode = 221 timing = 1 parameter1 = 9 savingthrow = 0 parameter2 = ~sectype_k1#Haste~ END END BUT_ONLY This is pretty much what I've done in the beggining; this is what I've started with: COPY_EXISTING_REGEXP GLOB ~.*\.spl~ ~override~ PATCH_IF (SOURCE_SIZE > 0x71) LPF CLONE_EFFECT INT_VAR match_opcode = 40 opcode = 221 parameter2 = %customsectype% END BUT_ONLY_IF_IT_CHANGES It works fine (i.e. 221 effect isn't added numerous times); but prints warnings as it goes through the files. Each that doesn't get patched, displays a warning. That's why I wanted to try a different way of doing it. Link to comment
Jarno Mikkola Posted January 18, 2016 Share Posted January 18, 2016 And that is the correct code. Yeah, the warnings are there in case the mod maker can't perceive the fact that the file might not have been edited, but you know the fact, that the opcode=40 is kinda rare thing. And yeah, there's no reason to put in the timing, parameter1 or savingthrow because they are cloned from the original effect, not set independently from it.. well the save could be different. Aka, the icehead of the flail of ages hit, thus it's effect to remove the haste. Link to comment
kreso Posted January 18, 2016 Author Share Posted January 18, 2016 Ok. I'll stick with "warnings" being displayed, Wisp said that he'll alter CLONE macro so it doesn't print warnings anymore. At least I don't get items overflooded with 221s. Link to comment
kreso Posted January 18, 2016 Author Share Posted January 18, 2016 Okay, so you want to change the secondary type of each ability that has at least one effect matching a specific opcode. This I have working. Thanks Mike. Link to comment
Wisp Posted January 23, 2016 Share Posted January 23, 2016 Wisp said that he'll alter CLONE macro so it doesn't print warnings anymore. Technically, I did not say that. I said I would add the option of running CLONE_EFFECT without the warning. (Specifically, you'll have to set the INT_VAR silent to 1). Link to comment
kreso Posted January 24, 2016 Author Share Posted January 24, 2016 Wisp said that he'll alter CLONE macro so it doesn't print warnings anymore. Technically, I did not say that. I said I would add the option of running CLONE_EFFECT without the warning. (Specifically, you'll have to set the INT_VAR silent to 1). Will do, in any case. Ty. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.