Jump to content

How to make a potion effect script read a potion's magnitude


Xander9009

Recommended Posts

I'm trying to make a potion craftable. Normally, this wouldn't be too difficult; just give a few ingredients the right magic effect, use them at an alchemy lab together, and viola. The problem is that the potion's effect is scripted. It has a magnitude, but that magnitude is currently hard-coded into the script. So, when I make the potion at an alchemy lab, the potion's displayed magnitude doesn't actually do anything.

 

My question: is it possible to get a potion's effect script to read the potion's magnitude so it can use that (and, obviously, if it is, then how do I do that)? The alternative is for every crafted potion of that type to have the same magnitude (which I really don't like) or hard-code the cheaper ingredients to make the less powerful versions, which is also not great since that means the cheap ones can't be used with the expensive/rare ones.

Link to comment
Share on other sites

You can make it so the potion is always the same, but the duration changes with ingredients, and skill perks.

 

I'm making a potion that summons a creature, and it will summon the same creature of the same level, no matter what.

 

Only for longer durations depending.

 

I know it's not an answer to your question. Just suggesting an alternative.

 

Good luck.

Link to comment
Share on other sites

Thank you for the inspiration. I'd actually already implemented an entirely different method and completely abandoned the potions in favor of spells and was going to leave hard-coded magnitude versions of the potions available, but otherwise unobtainable. Thanks to your suggestion regarding time, I managed to get the potions working well enough that I like them.

 

In order for the potions to even come CLOSE to matching the base-game potions' magnitudes (health potions), I had to set the ingredients' duration to 1 and allow that to be boosted by the alchemy skill. Then, with the potions made they'll have a duration ranging from roughly 11 to 22 depending on alchemy level. Then, in the script, each second, I made a counter to count how many times it's gone around and added 1.14^counter. At 11-22 seconds, that comes out to about 26 points at 11 seconds (which is the potion you get at 0 alchemy with no perks). At 22 seconds (the potion you get at 100 with all perks) it comes out to about 136. So, it turned out pretty close to what I needed. I could have made it perfectly match with the vanilla potions, but that would require a 10-second delay in which the potions doesn't actually do anything.

 

It's a bit of an odd way to go about it, but it still results in roughly the right amount being added over all, so I'm happy with that. Thank you! :) (And to think, when I first read it, I didn't think it would be applicable.) (I actually wrote this last night, but I forgot to hit send....

Link to comment
Share on other sites

Yeah, I stared at the function as my brain tried to find a way to make it work, but it appears it would require linking to the potion. Since this happens immediately after the potion no longer exists, that poses a problem. The only possible way I could think of that would make that work would be to keep track of every potion my mod makes in the player's inventory and wait for one to be missing simultaneously with a potion being drank. (I can find IF one was consumed, just can't find anything ABOUT the consumed potion.) That seemed absurdly complex for my needs. But thank you, I appreciate the suggestion :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...