How to determine if player drank the max number of potions

Post » Wed May 18, 2011 9:28 pm

There are game settings in the CS for the maximum number of potions the player can drink at one time (i.e. IMagicMaxPotionsNovice), but how do I determine if that maximum limit has been reached by the player? I've searched the CS Wiki and OBSE documentation and I think I could maybe use GetNthActiveEffectMagicItem but not really sure how...

I assume if two of the same potions are drank at the same time that still counts as two toward the limit, instead of one, right?
User avatar
MISS KEEP UR
 
Posts: 3384
Joined: Sat Aug 26, 2006 6:26 am

Post » Thu May 19, 2011 4:11 am

The problem is that many of the standard potions are instant-effect, so they stop counting towards the limit immediately. IIRC the inventory menu keeps a count of how many potions you drink while it's open, but that resets when you close, and you can immediately re-open for another batch. You could add a menumode block to count for yourself, but that won't catch the hot-key use.

You'd probably be better off providing a more meaningful limit of your own, like a minimum time since you last drank one, if you can catch the "drink potion" event.
User avatar
Yama Pi
 
Posts: 3384
Joined: Wed Apr 18, 2007 3:51 am

Post » Wed May 18, 2011 8:10 pm

The problem is that many of the standard potions are instant-effect, so they stop counting towards the limit immediately. IIRC the inventory menu keeps a count of how many potions you drink while it's open, but that resets when you close, and you can immediately re-open for another batch. You could add a menumode block to count for yourself, but that won't catch the hot-key use.

You'd probably be better off providing a more meaningful limit of your own, like a minimum time since you last drank one, if you can catch the "drink potion" event.


Thank you ghastley. After some tinkering I got a proof of concept working. You're right, it doesn't work for instant-effect potions but that's no matter because I am counting in real-time so that extra millisecond is not going to affect anything.
User avatar
Cody Banks
 
Posts: 3393
Joined: Thu Nov 22, 2007 9:30 am


Return to IV - Oblivion