r/BG3mods • • 3d ago

Mod Creation Help Request Help with status effect for subclass mod

So I'm trying to add a status effect where on dealing fire damage add 1 stack, up to 5 (till lvl 9, 10 stacks after, with LevelMapValues). While you have this status effect, you deal 1d4 additional fire damage with each melee attack (weapon/unarmed), but take 1d4 fire damage at the end of your turn.

I can get various parts of it working, just not everything at once. I added a passive to the subclass to apply the status similarly to the hat of fire acuity, and it works although sometimes its strange. I excluded OncePerAttack cause I want it to trigger on every instance of non self fire damage.

The cap is supposed to be 5 stacks, which I tried limiting with a duration counter status boost since effects like lightning charges seem to use them, with

IF(HasStatus('FireWithinStacks', context.Target, LevelMapValue(FireWithinStacks))):SetStatusDuration(FireWithin, LevelMapValue(FireWithinStacks), ForceSet)

in OnApplyFunctors. That counter has StackType overwrite (can someone pls explain stack types). However stacks go past 5.

I can get the 1d4 self damage working fine with TickFunctors, just not the outgoing damage boost.

I originally tried to have the extra fire damage added as a boost, but it was multiplying for each stack, idk if its because I used additive stack type. So I alternatively tried to have no boost in the status, and instead refer back to the original passive in the passive column. With

IF(HasStatus('FIRE_WITHIN', context.Source) and IsMeleeAttack()):DamageBonus(LevelMapValue(FirePunchMonk),Fire);

in the boosts column. But now I'm not getting the extra fire damage on melee attacks.

Also how do I get the extra 1d4 fire damage to show up in melee tooltips? Thanks!

1 Upvotes

4 comments sorted by

2

u/bornwiththreeballs 3d ago edited 3d ago

If you want the boost to linearly scale per stack u can use the MultiplyEffectsByTurnDuration flag, that will multiply Boosts, make the status unique and on application do an if statement like IF(HasStatus('Status')):SetStatusDuration(Status,1,Add);IF(not HasStatus('Status')):ApplyStatus(Status,100,1);

you can then add in additional conditions with StatusDurationLessThan() and CharacterLevelGreaterThan()

1

u/i-meese 3d ago

Omg this worked and is so simple, ty!

1

u/draco2nes 3d ago

The boost multiplying per stack is probably due to the flag "MultiplyEffectsByTurnDuration", not the stack type.

I ran into this issue as well and somehow what worked was creating a custom khonsu function that is for checking the number of stacks of the custom status rather than writing it directly into the stats table. Although I do not know if that only failed because I was also still learning and probably had skill issue

SetStatusDuration is a StatFunctor not a Boost. You want it to be rechecked everytime the Status gets applied or removed, so OnStatusApplied and OnStatusRemoved should be the Context (i forgot the specific name of that column) with the Condition being StatusId('statusname').

For StackTypes: How ApplyStatus works when the character already has the status. By using SetStatusDuration( , , Add) you do not actually need it to be Additive since you directly modify the turn count, but it wouldnt trigger the OnStatusApplied check because you arent applying any Statuses, just modifying the duration of an existing one. Overwrite means it removes the current status and reapplies a new one, Additive means it adds the new duration to the old duration, Stack (default behaviour) means it applies a parallel status that exists together with the old one that do not share turn count.

1

u/TheMillionthOne Mod Author 3d ago edited 1d ago

Going to throw a lot at you here.

can someone pls explain stack types

StackTypes influence how things work when you attempt to apply a status to something which already has that status.

  • Overwrite: If you ApplyStatus() to a character who already has it or has another status with the same StackId, the character loses the old status and the new ApplyStatus takes effect. I think this is also the default, if a StackId is added. This is handy if you want to avoid a character having multiple, separate instances of the same status at once, but maybe want new status applications to reset the duration or have some OnApply functors trigger. It's also handy if you have statuses you want to be mutually exclusive (for instance, you cannot apply multiple different Elemental Weapon elements to the same weapon).
  • Ignore: If you attempt to ApplyStatus() and the character already has it, nothing happens. Useful for statuses that are permanent or might run until Long Rest, or are otherwise pointless to apply if the target already has them.
  • Additive: If you attempt to ApplyStatus() and the character already has the status, then rather than overwrite them, the ApplyStatus duration is added to the status's existing duration.
  • Blank and no StackID: You can have multiple instances of the same status on the same character, all of which have their own duration. Using ApplyStatus() will simply create a new instance of the status on that character.

There are other options, but to be honest, I'm not sure on how they all work and those options are probably enough for you here.

If you look at Lightning Charges, you'll see they're set to Additive. This means that when adding new charges, you can simply type:

ApplyStatus(SELF, MAG_CHARGED_LIGHTNING,100,2);ApplyStatus(SELF,MAG_CHARGED_LIGHTNING_DURATION_TECHNICAL,100,0)

and not worry about it. But wait, what's the second status? It's a hidden status with this OnApply functor:

IF(HasMaximumLightningCharge(context.Target)):SetStatusDuration(MAG_CHARGED_LIGHTNING,7,ForceSet)

If you're over the maximum when this status is applied, forcibly set you back to 7. This is also triggered as a tick in the Lightning Charge status, just in case you somehow increase the status another way. Fortunately, HasMaximumLightningCharge has a more generic alternative called StatusDurationMoreThan(). We might be able to do something like:

IF(not CharacterLevelGreaterThan(8) and StatusDurationMoreThan(context.Target,'FIRE_WITHIN',5)):SetStatusDuration(FIRE_WITHIN,5,ForceSet); IF(CharacterLevelGreaterThan(8) and StatusDurationMoreThan(context.Target,'FIRE_WITHIN',10)):SetStatusDuration(FIRE_WITHIN,10,ForceSet)

or ClassLevelHigherOrEqualThan(9,'Monk'), if you want this scaling based on Monk level.

Also how do I get the extra 1d4 fire damage to show up in melee tooltips?

If this is only to apply to weapon and unarmed attacks, we can try using these two more specific damage boosts:

IF(IsMeleeAttack()):CharacterWeaponDamage(LevelMapValue(FirePunchMonk),Fire);CharacterUnarmedDamage(LevelMapValue(FirePunchMonk),Fire)

Tooltips can be messy - they can sometimes disappear due to IF conditionals - but it should at least pop up for unarmed strikes.