jastey Posted June 8, 2018 Share Posted June 8, 2018 (edited) In Jarl's Tweak Pack, one of the components offers to make Jaheira's alignment Neutral Good. This comes along with it: COPY_EXISTING ~misc5x.itm~ ~override~READ_BYTE 0x1e "use1"READ_BYTE 0x21 "use2"WRITE_BYTE 0x1e (("%use1%" BOR 0b00001000) BAND 0b11111011)WRITE_BYTE 0x21 ("%use2%" BOR 0b10000000)BUT_ONLY_IF_IT_CHANGES "Misc5X.itm" is the Harper's Pin which originally is only usable by True Neutral Fighter-Druids. The above code changes this to Neutal Good Fighter-Druids, which is great. My questions: -is the above code the optimum if it comes to tp2 coding or is there a potential compatibility issue with other possible tweaks? What I mean is, what exactly does the code do, does it only change the True Neutral to Neutral Good or does it overwrite something else, meaning would this still work if another tweak changes Jaheira's kit or even class including the appropriate usability flags of the Harper Pin, too? EDIT: I am aware that this is for BGII/BGT only, as the item is resctricted to Jaheira only for BGII:EE via some opcode not available for BGII: Am I assuming correctly that this resctriction in BGII:EE is independent on the NPC's alignment and thus not affected by alignment tweaks? Edited June 8, 2018 by jastey Quote Link to comment
argent77 Posted June 8, 2018 Share Posted June 8, 2018 That two initial read operations are not strictly needed, because WeiDU automatically reads the content into the variable THIS for each write operation.The logic of the write operations looks correct though. With the hint from above and the use of some helpful WeiDU constants it would result in: COPY_EXISTING ~misc5x.itm~ ~override~ WRITE_BYTE 0x1e ((THIS BOR BIT3) BAND BNOT BIT2) WRITE_BYTE 0x21 (THIS BOR BIT7) BUT_ONLY Or combined into a single write operation: COPY_EXISTING ~misc5x.itm~ ~override~ WRITE_LONG 0x1e ((THIS BOR BIT3 BOR BIT31) BAND BNOT BIT2) BUT_ONLY You can optionally replace BOR by |, BAND by & and BNOT by ` (back quote sign) to reduce code length.Btw, the code makes "...Neutral" and "Half-Orc" unusable and "Good" usable. And yes, NPC-specific restrictions in EE games are only tied to creature (script) name. Alignment, race, etc. doesn't matter. Quote Link to comment
jastey Posted June 8, 2018 Author Share Posted June 8, 2018 Thank you! That was very helpful. I wonder what the bit 31 is for, actually. As I see it, COPY_EXISTING ~misc5x.itm~ ~override~WRITE_BYTE 0x1e ((THIS BOR BIT3) BAND BNOT BIT2)BUT_ONLY would do the trick for Jaheira's alignment change to Neutral Good just fine because it's already unusable by half-orcs and that's nothing to do with an alignment change, I would say. Quote Link to comment
argent77 Posted June 8, 2018 Share Posted June 8, 2018 Well, unfixpacked BG2 would allow half-orcs to wear the item. So I guess it was only added as a precaution. Quote Link to comment
jastey Posted June 8, 2018 Author Share Posted June 8, 2018 Ah! Thank you very much for the info. Indeed I am working with a BGT with BG2Fixpack applied. Quote Link to comment
Mike1072 Posted June 8, 2018 Share Posted June 8, 2018 EDIT: I am aware that this is for BGII/BGT only, as the item is resctricted to Jaheira only for BGII:EE via some opcode not available for BGII: Am I assuming correctly that this resctriction in BGII:EE is independent on the NPC's alignment and thus not affected by alignment tweaks? According to some testing done by earlier me, restrictions to specific characters via the EE opcode are cumulative with restrictions in the item header. For example, if the item was restricted to Jaheira, but something made it unusable by fighter/druids, she wouldn't be able to use it. Quote Link to comment
jastey Posted June 9, 2018 Author Share Posted June 9, 2018 That's good to know! Thanks. Quote Link to comment
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.