Request Help: w/Real-time In-game Blood Alcohol Content (BAC)

jcmtexas01

Unbreakable Bond
Member
Joined
Aug 14, 2019
Messages
24
Reaction score
0
First Language
English
Primarily Uses
RMMV
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.
 

Attachments

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,200
Reaction score
6,758
First Language
German
Primarily Uses
RMMV
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.
 

jcmtexas01

Unbreakable Bond
Member
Joined
Aug 14, 2019
Messages
24
Reaction score
0
First Language
English
Primarily Uses
RMMV
*face palm* I should have thought of that, lol. I'll give it a look, thanks!
 

jcmtexas01

Unbreakable Bond
Member
Joined
Aug 14, 2019
Messages
24
Reaction score
0
First Language
English
Primarily Uses
RMMV
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.
 

Attachments

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,200
Reaction score
6,758
First Language
German
Primarily Uses
RMMV
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...
 

CrowStorm

Storm crow descending, Winter unending.
Veteran
Joined
Sep 7, 2018
Messages
246
Reaction score
227
First Language
English
Primarily Uses
RMMV
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.
 

MushroomCake28

KAMO Studio
Moderator
Joined
Nov 18, 2015
Messages
2,210
Reaction score
3,578
First Language
English
Primarily Uses
RMMV

@jcmtexas01 , please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.


To add to what Andar said, in your first screenshot the first condition is BAC >= 8. So everything in the else bracket under the conditional with BAC > 16 as a conditional will not be executed since the first branch's condition (BAC > 8) has been met.

@CrowStorm I don't think OP is showing the blood alcohol level number to the player. I personally thinks the little messages to the player as the actor gets drunk is a nice idea. He's simply adding a mechanic where being drunk is a negative state, which is original imo.

Also, this is a thread about how to implement a system, not about discussing the merit of that system. Let's try to stay on track and help OP achieve what he/she is trying to accomplish. :D
 
Last edited:

jcmtexas01

Unbreakable Bond
Member
Joined
Aug 14, 2019
Messages
24
Reaction score
0
First Language
English
Primarily Uses
RMMV
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...
Thanks!
 

jcmtexas01

Unbreakable Bond
Member
Joined
Aug 14, 2019
Messages
24
Reaction score
0
First Language
English
Primarily Uses
RMMV
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 it's not a "party game", and this was more of an idea conjured up from boredom. Yes I realize my math isn't an exact science i.e. character's sex, weight, etc. I figured I didn't need to go that in-depth. Maybe I'll bump "Intoxicated" up to 0.2. Thanks for the input!
 
Last edited:

jcmtexas01

Unbreakable Bond
Member
Joined
Aug 14, 2019
Messages
24
Reaction score
0
First Language
English
Primarily Uses
RMMV
[DPOST]@jcmtexas01 [/DPOST]
To add to what Andar said, in your first screenshot the first condition is BAC >= 8. So everything in the else bracket under the conditional with BAC > 16 as a conditional will not be executed since the first branch's condition (BAC > 8) has been met.

@CrowStorm I don't think OP is showing the blood alcohol level number to the player. I personally thinks the little messages to the player as the actor gets drunk is a nice idea. He's simply adding a mechanic where being drunk is a negative state, which is original imo.

Also, this is a thread about how to implement a system, not about discussing the merit of that system. Let's try to stay on track and help OP achieve what he/she is trying to accomplish. :D
^Get's it :)
 

MushroomCake28

KAMO Studio
Moderator
Joined
Nov 18, 2015
Messages
2,210
Reaction score
3,578
First Language
English
Primarily Uses
RMMV

@jcmtexas01 , please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.


Double posting means posting right after one of your post. Instead of writing multiple posts, you can simply put everything into one long post (it is possible to have multiple quotes in one post). If you want to add something later, you can always edit your post and add what you want to add.

So returning to your issue, once you apply our recommendations tell us if it fixes your problem. If not, we'll continue from there with the next issue.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,200
Reaction score
6,758
First Language
German
Primarily Uses
RMMV
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.
 

jcmtexas01

Unbreakable Bond
Member
Joined
Aug 14, 2019
Messages
24
Reaction score
0
First Language
English
Primarily Uses
RMMV
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.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,200
Reaction score
6,758
First Language
German
Primarily Uses
RMMV
but even when it's over the amount shown in the screenshots it won't add any effects.
That is why I wanted to see a screenshot of whatever you did to add to BAC, to check that for errors.
you need three things/conditions to function correctly on these events, and sometimes it's just a missing switch or wrong variable selected.
and very often the developer itself is too deep into his logic to see a tiny mistake, someone else has to see the real coding to find the error.
So please give a screenshot of where you add the BAC and switch on the system.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,200
Reaction score
6,758
First Language
German
Primarily Uses
RMMV
where do you activate switches 236 and 237? (BAC and BAC tine)
 

jcmtexas01

Unbreakable Bond
Member
Joined
Aug 14, 2019
Messages
24
Reaction score
0
First Language
English
Primarily Uses
RMMV
where do you activate switches 236 and 237? (BAC and BAC tine)
When the game starts, but since I created the switches after my latest play test. I just threw a switch on the ground to turn them on.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,200
Reaction score
6,758
First Language
German
Primarily Uses
RMMV
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.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Wasting so much time trying to get a sprite behavior to work. I feel like banging my head against a wall.
Well... it’s been a real pain in the IRS today. :/
My kitty still young (3-4 months), I think I could teach her some funny tricks... like: "Play dead-ly good music for my games"
Here's a quality DPS class idea: The Beekeeper, who uses the "Bees!!" skill to attack and poison enemies.
Please don't create long, boring cutscenes in which characters do nothing but stand around talking.

Forum statistics

Threads
94,274
Messages
919,556
Members
124,000
Latest member
Rinion
Top