Lknechtli / BetterCombatEvolved

The Better Combat Evolved mod for Witcher 3
6 stars 1 forks source link

Need someone to create a script for me, Alchemy overhaul #29

Open Chickenudoom opened 9 years ago

Chickenudoom commented 9 years ago

We need a script that adds +2 toxicityRegen for every potion/decoction the player consumes - I've tried my hand at this, but with no luck. :(

I'll attach the script with this comment, maybe one of you guys can tweak it so it actually works?? I had to convert it to a .txt file for it to upload correctly. Ctrl+F "chicken" and you'll see my changes.

toxicity.txt

TriangleAuthority commented 9 years ago

I can check that out

TriangleAuthority commented 9 years ago

So after a little bit of investigating:

  1. Know that the recalc function only gets called when toxicity goes from 0 to nonzero. The toxicity effect is an infinite effect that gets manually removed when toxicity reaches 0, and then gets reapplied when toxicity goes up again
  2. That GetAttributeValue function is a bit mysterious... not entirely sure what it's returning in this case. I would try testing with hardcoded values to make sure things are working first
  3. What you can do is this: When geralt drinks a potion, use effectManager's GetEffect(EET_Toxicity) to get an existing toxicity effect. If it exists, call RecalcEffectValue() on it. When a potion's duration ends you will have to call this again somehow. EDIT - call Recalc again in baseEffect's OnEffectRemoved(). You can check if it's a potion effect with IsPotionEffect().

Not sure what the behavior will be like when you have positive regen and hit max toxicity... Game might assume it's always negative. Might have to add a bit of new logic to deal with this.

OTHER OPTIONS: on drinking a potion, add a new toxicity effect with custom values for duration and strength (positive value). There is at least one place that assumes there is only one toxicity effect at a time (PlayerAbilityManager OnToxicityChanged()), so this might require changes elsewhere.

create a new effect for toxicity regen. Add a new effect of this type whenever you drink a potion.

I'm too tired to code right now... had a long week. but this should hopefully help!