If you're aiming for realism here's how I'd do it:
First there's the pee_volume
variable which works as you describe. Every second or so it gets incremented by a small amount.
That amount is multiplied by the hydration
variable. If hydration
is 0 then no pee is added. If it's 1 then pee accumulates at the default rate, etc. To keep things interesting I'd program it to set hydration
to a random number between 0.5 and 1.5 at intervals of 30-60 minutes.
Now your code can use the pee_volume
variable when deciding what to do. You could add a bladder_capacity
setting and have it automatically cause an accident whenever that threshold is crossed. Also, remember that in real life a kid might not fully empty their bladder, especially if they're trying their best to keep their pants dry. For realism the size of an accident should never exceed pee_volume
but could be much less than it.
What sort of scenarios or age ranges are you thinking of roleplaying with this?