One way to approach this is to have one variable track another. Let's call them Health and Lust.
For every point in Lust it would subtract from Health and vice versa. So if Health = 1, Lust = 100, and if Health = 100, Lust = 1
The more Lust builds up, the more it affects the players other stats. For example maybe their strength stat. Or lowering their damage output. It doesn't have to be a 1:1 ratio. This would require testing to find a balance of Lust:Health ratio.
You can do a lot of complex things, so depending on how dedicated you are to the system, here are some ideas.
Lust can be affected by seeing Naked NPC. You could add a mechanic on the player where they can close their eyes but decrease their accuracy or whatever stat you want.
Have objects in the world that increases the lust meter.
Boss and enemies have skills that increase the meter.
Traps. Put in some puzzles or platforms the player has to solve, and if they fail increase the meter.
Annoying enemies that will occasionally appear to spray mist close to the player that increase Lust.
List goes on.
Now the challenging part is the implementation of AI. Some ideas I have come up with are as followed.
Option 1:
For weaker enemies, the AI would check the players Lust.
If Lust>=50, the AI would attempt to fight the player. Otherwise they run if they're by themselves or call for backup.
If Lust>=100, exec sex.
For stronger enemies, they would still check the Lust but would engage regardless.
There are 2 checks for this.
If Lust >=25
Enrage, do more damage, use skills that increase Lust.
2nd Check
If Lust >=75
Regardless of Health, exec sex.
Bosses would engage regardless, but 90% of their skills increase the players Lust. Kind of like the Stronger enemies, you would have checks in place, maybe 3 checks.
1st check, Lust>=50
Do something
2nd check, Lust>=75
Do something
3rd check, Lust>=100
Exec sex.
There is an edge case here, where the player maybe sitting at Lust>=100, maybe Lust isn't capped at 100 and could go over it. That's where the check for Lust>=100 would contain the code on how to handle that situation. Something along the lines of
Did the player enter the room, or engage in combat with Lust>=100, if true don't exec sex, but make sure the enemy engages in battle before exec sex. Something along this line.
Option 2:
Enemies still check the Lust variable.
But they react differently to what the Lust variable is sitting at.
Weaker enemies = more spawns
Stronger enemies = less spawns but more tanky
Bosses still follow the template from above.
The challenge here is not so much the design of the player, but the AI. Creating an AI that reacts appropriately to the situation is much harder. No one wants to press W, stand there and lose on purpose just so they can exec a sex scene. Especially trying to lose on purpose. I've played a few games like this and they get boring very quick.
The thing for anyone who wants to make a losing = progress and sex, is not so much about how to lose, but to create a system in which puts the player at a disadvantage while giving them some agency and the illusion that they can win. Losing shouldn't be a punishment but rewarded, I've ran into some games (don't remember the names) where I lost intentionally to get the sex scenes, only to be sent to the beginning of the level. Frustrating I tell you.
Things like this shouldn't exist in these types of games. It'll only detour the players away from it. The hard acceptance of creating a game like this is, the player needs to be rewarded regardless of the outcome. Whether they win or lose they should be rewarded. Winning could be a small net positive, while losing gives the bigger reward. Players shouldn't be punished by making them redo the level, having a "You Die" screen, pretty much anything that punishes the player for losing on purpose.
Another thing is the reward gap between losing and winning shouldn't be so big that there's no longer player agency. At that point it's no different than the player holding W and standing there waiting to die. That is the challenging part of making these types of game, is finding the balance in which the player still has agency while not punishing them to lose on purpose.