I have been working on having my in-game pubs and bars serve alcohol, and decided to make things a bit more realistic. I'm currently using MOG_Time System, and have created a variable called "BAC".
The end state is if the character's BAC surpasses 0.08, a message would warn you they're buzzed. If it hits 0.16 your character becomes intoxicated, and certain penalties follow such as temporarily lowered stats, etc. That part is easy by creating an "Intoxicated" State. I also considered making the screen shaky/blurry when the character takes a step, but I'll have to figure that one out as well and would be a later project. I also developed a "Breathalizer Machine" in the bars, which was fairly easy with \[v].
The hard part for me is trying to get the BAC to drop by 0.03% (3 for sake of simplicity via "variables") per hour in-game, and for the variable to not be allowed to drop below "0". Essentially time-based "sobriety", which would start when your BAC > 0.
I'm assuming this could be achieved with an "BAC" Common Event, and some conditional statements which I have messed around with some. Right now mine is a hot mess. Any help would be greatly appreciated! Screenshot ATTACHED below.
one obvious problem is that you never check for how much time has passed, only if the hour of the clock is greater than 1.
Which means that beginning with the second hour that condition will always be true and 3 will be substracted every frame of the parallel process...
You need to store the time of the last substraction and only reduce this if one hour has passed since that time, which means you need two variables to store a time at minimum.
*face palm* I should have thought of that, lol. I'll give it a look, thanks!
Let me start by saying what works:
1. BAC does start at 0
2. Drinks do add BAC
3. BAC does subtract by 3 successfully every in-game hour, and resets to 0 when it dips below 0.
What doesn't work:
1. Buzz message does not appear @ 0.08 BAC
2. Character "Intoxicated" state does not apply @ 0.16 BAC w/message and screen effects, or removed when it drops back below 0.16.
I'm not sure where I went wrong, but the ATTACHED screenshots are my Common Events. Please help, thanks.
1) in the time event, you only check for minute = 60. Once it is higher nothing will work anymore because the counter is never reset, only increased.
2) in the other event, you start by setting BAC to zero - which means that the next condition (>8) will never be true and the rest of the event never be checked.
3) and autorun means that the player is blocked from moving while that event is active...
How much is your game ABOUT getting wasted? I ask because this seems like a lot of granularity in a system that is anything but essential for your game. Why have BAC as a player facing variable when it's essentially two or three states anyway, sober, buzzed, intoxicated. Add a third state, hangover/hung over, and you're good.
By the way, idk how much IRL experience you have with alcohol consumption, but while everyone is different (body mass, men vs. women, muscle vs. fat, misc. genetic factors) most people are quite quite drunk by the time they reach a BAC of 0.16. BAC 0.2 is absolutely smashed and most people cannot survive a BAC of 0.3.
I guess I'm saying that BAC being a number behind the scenes is fine and dandy but it seems like a really weird number to let the player know.
No dice...
Still won't apply the "Intoxication" state & actions, or "buzzed" actions. I'm still new at condition statements, so I'm guessing something is out of order.
where and how do you increase the BAC?
so far you have only shown screenshots of where it is reduced, and you need it above 20 for the effect.
Alcohol in the bars/pubs raise BAC, and I can check it via a "breathalyzer" I designed in the bar to show the BAC which checks the variable. I know it stacks, but even when it's over the amount shown in the screenshots it won't add any effects. Not even the text box works...so idk. The breathalyzer will be removed after I know everything is working.
Oh okay I see. Thank you!
where do you activate switches 236 and 237? (BAC and BAC tine)
just to get all data, please show the intoxicated state that you're using in the common event.
However I don't think the prblem is there, so please add a show text command showing both BAC and BAC time inside the conditional of the bac time common event, just to make sure the event is running correctly.