Jump to content

How to Make Sleep Rape Only Happen When Player is Aroused?


Recommended Posts

Hi there, I am currently modding SexLab Dangerous Night scripts.

 

 

I want to make it that sleep rape only happens when player arousal value is 50 or higher, but I am new to scripting and would appreciate if someone can offer any help.

 

In the sldn2_upkeep.psc I have found the part that dictates the chance of sleep rape, depending on the location the player is at:

 

float Function GetBaseNightAttackChance()
    Actor playerRef = Game.GetPlayer()
    Form playerLocRef = playerRef.GetCurrentLocation()
    Cell[] CustomHomes = new Cell[10]
    CustomHomes[0] = CustomHome1
    CustomHomes[1] = CustomHome2
    CustomHomes[2] = CustomHome3
    CustomHomes[3] = CustomHome4
    CustomHomes[4] = CustomHome5
    CustomHomes[5] = CustomHome6
    CustomHomes[6] = CustomHome7
    CustomHomes[7] = CustomHome8
    CustomHomes[8] = CustomHome9
    CustomHomes[9] = CustomHome10
    
    if playerLocRef.haskeyword(loctypeplayerhouse) || CustomHomes.find(playerRef.GetParentCell()) > -1
        Log("SLDN2 - In player home")
        Return mcm.cities
    elseif playerLocRef.haskeyword(loctypedwelling) || playerLocRef.haskeyword(loctypecity) || playerLocRef.haskeyword(loctypetown)
        Log("SLDN2 - In civilized area")
        Return mcm.civilized
    elseif playerLocRef.haskeyword(loctypebanditcamp) || playerLocRef.haskeyword(loctypedraugrcrypt) || playerLocRef.haskeyword(loctypewarlocklair) || \
            playerLocRef.haskeyword(loctypefalmerhive) || playerLocRef.haskeyword(loctypevampirelair) || playerLocRef.haskeyword(loctypemilitaryfort) || \
            playerLocRef.haskeyword(loctypemine) || playerLocRef.haskeyword(loctypedungeon) 
        Log("SLDN2 - In dangerous area")
        Return mcm.dangerous
    else 
        Log("SLDN2 - In wilderness area")
        Return mcm.wilderness
    endif
EndFunction

 

 

The highlighted part is defined in the sldn2_mcm.psc which says their chance for sleep rape:

 

float property cities = 5.0 auto
float property civilized = 15.0 auto
float property dangerous = 80.0 auto
float property wilderness = 50.0 auto

 

 

So if I make it that the chance for sleep rape to be 0 unless player arousal is 50 or higher, how do I do that? Do I simply add something like "IsSexLabFemale && (Arousal > 50)" in front all the ifs? 

 

Thank you.

sldn2_mcm.psc sldn2_upkeep.psc

Edited by jalingon3011
Link to comment

Yep, something like that... but reverse your condition and use it to decide when to return 0 instead.

 

if !playerRef.getActorBase().getSex() || playerRef.getFactionRank( sla_Arousal) < 50
	return 0
elseif

 

Hopefully, you already know how to deal with the compiler and script properties.

 

I wrote it to use the actual player's gender.  There is a SL option to override that; I just didn't take the time to look it up.

 

Link to comment
16 hours ago, pfB6cs said:

Yep, something like that... but reverse your condition and use it to decide when to return 0 instead.

 

if !playerRef.getActorBase().getSex() || playerRef.getFactionRank( sla_Arousal) < 50
	return 0
elseif

 

Hopefully, you already know how to deal with the compiler and script properties.

 

I wrote it to use the actual player's gender.  There is a SL option to override that; I just didn't take the time to look it up.

 

 

I put your code straight into the script and it seems to be working. Thank you very much for your help. Much appreciated.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use