Jump to content

Set armor pieces for additional bonuses


Recommended Posts

So, doing this with two items would be fairly simple and there is a nice trick with proficiencies you could use in place of spellstates, taking advantage of the way bit-equality works. (In short, if both items increase a proficiency by 4 bits, then you can set a 326 check to look for anyone whose proficiency is being increased by 8 bits. My dual-wielding bonuses use this to good effect.)

You can’t use that trick for a set of three items, though. 

Further, consider the distinction among these three possible implementations:

Quote

Bracers give +1 CHA when the Cloak is also worn. A Ring gives +1 STR when the Cloak is also worn.

…vs.

Quote

You get +1 CHA when you wear the Cloak plus either the Bracers or Ring. You get +1 CHA and +1 STR when you wear the Cloak plus both the Bracers and Ring. (But the Cloak is required in any case.)

…vs.

Quote

You get +1 CHA when wearing any two of the Cloak, the Bracers, and the Ring. You get +1 CHA and +1 STR when wearing all three.

The first is fairly simple; the second is more complicated; the third is quite difficult. And of course this all gets more complex as you go from including two items to three to four etc. 

Edited by subtledoctor
Link to comment

Just an idea.

Here was discussed example of item that check condition every round and if met cast spell for one round. If you don't want this effect to be visible instantly in statistics, then maybe it would be simplest approach? It can be on one item and equipment order would not matter.

Link to comment
2 hours ago, marchitek said:

example of item that check condition every round and if met cast spell for one round.

Yes, this kind of repeating effect can simplify things, since it uses nice simple .SPL files that can be canceled with op321 and blocked with op206. And they can use spellstate/proficiency conditions via op326 that cannot be done with op177 equipping effects. 

Still, op206 does work with op177 equipping effects, so I would try to see if it could be done without the clutter of repeating effects. (Which, again, depends on the precise desired effects.)

Link to comment
3 hours ago, subtledoctor said:

So, doing this with two items would be fairly simple and there is a nice trick with proficiencies you could use in place of spellstates, taking advantage of the way bit-equality works. (In short, if both items increase a proficiency by 4 bits, then you can set a 326 check to look for anyone whose proficiency is being increased by 8 bits. My dual-wielding bonuses use this to good effect.)

You can’t use that trick for a set of three items, though. 

Further, consider the distinction among these three possible implementations:

…vs.

…vs.

The first is fairly simple; the second is more complicated; the third is quite difficult. And of course this all gets more complex as you go from including two items to three to four etc. 

Thanks! By proficiency, do you mean attribute (e.g. STR, DEX etc)? And how could "Apply effects list (326)" be used to check an increase in value as I thought you would need to set a base value first? Your first example is the simplest and now that I think about it, I think a 2-set piece is probably as far as I would go.

2 hours ago, marchitek said:

Just an idea.

Here was discussed example of item that check condition every round and if met cast spell for one round. If you don't want this effect to be visible instantly in statistics, then maybe it would be simplest approach? It can be on one item and equipment order would not matter.

Thanks, I think the item you're referring to (BLUN38, Night Club +1) uses an .EFF file with Type = "Cast spell on condition (232)"; Condition = "TimeOfDay('Special') / per round (13)". I've used the same file with another round-based condition and it works for 2-set armor. Removing the bonus when unequipping an armor is now the main issue.

16 minutes ago, Endarire said:

I know the Diablo comparisons to this mechanic are apparent.  shohy on SHS already converted many D2 kits and items to be BG2/EET compatible (GitHub).  This seems like a collaborative project.

Enjoy, all!

Interesting, I'll have to take a look at this. Thanks for sharing the links!

Link to comment
8 hours ago, pete_smith1229 said:

Removing the bonus when unequipping an armor is now the main issue.

Hm, from what I understood, this item just cast spell for one round. So if you are doing the same bonus should disappear 1 round after unequip of item (what would make condition not valid and result with no bonus renewal).

But I agree it seems rather like a fallback solution.

Link to comment

Right, I seem to have a working example now for a 2-set armor piece where when both items are equipped, a bonus is added; when either item is removed, the bonus is lost. The bonus also no longers stack when an armor is re-equipped. At the moment, it uses 3 EFF files and 3 SPL files with combinations of opcodes mentioned in earlier posts.

I'll work on it some more to see if I can simplify the logic tree otherwise it's going to be a nightmare for a 3-set piece and more...

 

Edited by pete_smith1229
Link to comment
8 hours ago, pete_smith1229 said:

Right, I seem to have a working example now for a 2-set armor piece where when both items are equipped, a bonus is added; when either item is removed, the bonus is lost. The bonus also no longers stack when an armor is re-equipped. At the moment, it uses 3 EFF files and 3 SPL files with combinations of opcodes mentioned in earlier posts.

I think it could be possible to simplify like this:

  • to each set piece add dedicated spl state "while equipped" to equipment effects
  • to one set piece add cast spell on condition "while equipped" to equipment effects (each round for one round duration), this is were your SPL would be applied
  • to your SPL add:
    • protections agains this spell (op318) if set piece spl state not present (one protection for each set piece), this need go at the begging of SPL ability effect list
    • your set bonuses

So one SPL in total, no EFFs.

If you will want to make set bonuses more like "while equipped" then you need jump into this EFFs / SPLs maze (success is not guaranteed).

Link to comment
On 4/19/2023 at 11:36 PM, lynx said:

Thanks, unfortunately the .EFF file fires the STRREF_GUI_FEEDBACK_CONTINGENCY_TRIGGER held in the ENGINEST.2DA file. Changing the value of this to 0 or leaving blank still results in the PC name still written to the text window. The "Disable display string (267)" effect doesn't seem to affect this. But it's fine, just a minor thing.

On 4/20/2023 at 7:34 AM, marchitek said:

I think it could be possible to simplify like this:

  • to each set piece add dedicated spl state "while equipped" to equipment effects
  • to one set piece add cast spell on condition "while equipped" to equipment effects (each round for one round duration), this is were your SPL would be applied
  • to your SPL add:
    • protections agains this spell (op318) if set piece spl state not present (one protection for each set piece), this need go at the begging of SPL ability effect list
    • your set bonuses

So one SPL in total, no EFFs.

If you will want to make set bonuses more like "while equipped" then you need jump into this EFFs / SPLs maze (success is not guaranteed).

Thanks, I tested this and it works when equipping the armor pieces. Unfortunately, taking a piece off doesn't remove the set bonus. I think it's because the "Cast spell on condition (232)" effect only fires once even if you set the condition "CheckSpellState(Myself,'Special') / per round (21)". However, I did simplify it slightly and reduced 3 .EFFs files to 2! This also works better as before, there would always be text triggered by the EFF every round. Now the text only appears once when the set bonus takes effect.

Will continue to test.

Link to comment

I believe I've achieved what I wanted in the most efficient way (for me at least) which only involves:

  • 2 .SPL files
  • 1 new global variable
  • 1 .BCS file

SPL1 file contains the bonus effects you want applied when all set armor pieces are equipped via various opcodes such as "AC bonus (0)", "Blur (65)" etc.; SPL2 file contains "Remove effects by resource (321)" to remove the bonus effects from SPL1. Because the script will be calling these spells, you will need to add these to "SPELL.IDS" using the ADD_SPELL_EX function by K4thos and define it with a name as this will be used to call the spell (e.g. SPL1 = "SET_ARMOR_BONUS_ON" and SPL2 = "SET_ARMOR_BONUS_OFF").

A new global variable (e.g. "SET_ARMOR_BONUS") needs to be added to the "Baldur.GAM" file. This is used as a boolean check to ensure script blocks in the .BCS file doesn't get executed continuously.

Finally, the .BCS file contains the logic to check if all set armor pieces are equipped and if so, apply the first .SPL file. If any armor is removed, apply the second .SPL file. The .BCS file is added to each armor using "Set AI script (82)". The following is the script used for a 2-set armor piece but can be easily customized to include additional armor pieces.
 

// Generic .BCS script for 2-set armor piece
// Add "HasItemEquipedReal()" for additional armor pieces

// Apply bonus if all armor is equipped and global variable SET_ARMOR_BONUS=0
IF
    HasItemEquipedReal("RB_ARM01",Myself)  // Custom armor
    HasItemEquipedReal("RB_HLM01",Myself)  // Custom helmet
    Global("SET_ARMOR_BONUS","GLOBAL",0)
THEN
    RESPONSE #100
        ReallyForceSpell(Myself,SET_ARMOR_BONUS_ON)  // Custom bonus spell
        SetGlobal("SET_ARMOR_BONUS","GLOBAL",1) // Set global variable SET_ARMOR_BONUS=1 to ensure this code block is executed once
END

// Remove bonus if any armor is unequipped and global variable SET_ARMOR_BONUS=1
// Set global variable SET_ARMOR_BONUS=0 to ensure these code blocks are executed once
// Each armor needs to have their own removal code block
// Add more code blocks for additional armor pieces
IF
    !HasItemEquipedReal("RB_ARM01",Myself)  // Custom armor
    Global("SET_ARMOR_BONUS","GLOBAL",1)
THEN
    RESPONSE #100
        SetGlobal("SET_ARMOR_BONUS","GLOBAL",0)
        ReallyForceSpell(Myself,SET_ARMOR_BONUS_OFF)  // Custom bonus removal spell
END

IF
    !HasItemEquipedReal("RB_HLM01",Myself)  // Custom helmet
    Global("SET_ARMOR_BONUS","GLOBAL",1)
THEN
    RESPONSE #100
        SetGlobal("SET_ARMOR_BONUS","GLOBAL",0)
        ReallyForceSpell(Myself,SET_ARMOR_BONUS_OFF)  // Custom bonus removal spell
END

I'm sure there is a much cleaner method but this works perfectly for me. Thanks to all for your comments!

Edited by pete_smith1229
Changed "Remove effects by opcode (337)" to "Remove effects by resource (321)"
Link to comment
Guest morpheus562

Does splprot.2da have a way to check if a spellstate is active or not? I'm not in front of a computer right now, but I think this could be doable without being a repeating effect.

 

Can't you add to the stats.ids file and use splprot.2da to check against it? You can then use opcode 318 to block the eff file tied to the set bonus if the stat is 0. Then have the item for the set then set the stat to 1 on equip. Wouldn't it then register on equip as 0, block it, then set the stat to 1 for when the matching set item is attached? Does one have the ability to increment a stats.ids entry by 1 or is it only set?

Edit: Hmm... The unequip will need a way to be handled with this approach though...

Edited by morpheus562
Link to comment
2 hours ago, ptifab said:

Thanks a lot for that, maybe i'll try to do the same for my personal modlist. 😉

I'd certainly appreciate confirmation if this works for someone else!

23 minutes ago, morpheus562 said:

Does splprot.2da have a way to check if a spellstate is active or not? I'm not in front of a computer right now, but I think this could be doable without being a repeating effect.

 

Can't you add to the stats.ids file and use splprot.2da to check against it? You can then use opcode 318 to block the eff file tied to the set bonus if the stat is 0. Then have the item for the set then set the stat to 1 on equip. Wouldn't it then register on equip as 0, block it, then set the stat to 1 for when the matching set item is attached? Does one have the ability to increment a stats.ids entry by 1 or is it only set?

This sounds similar to what I've done previously with .EFF files except with spell states. The major issue was how to remove the bonus when one set item is removed. I got it to work but it required 2 EFF and 2 SPL files. And this was for a 2-set armor, adding more armor would require more EFF files for each item. I'm sure your way works better than what I did without scripting.

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...