Jump to content

Reliable way to check in Papyrus if the player is swimming


Recommended Posts

Posted (edited)

Random off top of head.

 

Sexlab Cum Overlays Extended does

 

 

 


Scriptname SCO_PlayerCumExpire extends activemagiceffect  

SCO_CumHandler Property CumHandle Auto
SCO_MCM Property MCM Auto
Actor Property ActorRef Auto

 

Event OnEffectStart(Actor akTarget, Actor akCaster)
    ActorRef = akTarget
    RegisterForSingleUpdate(3.0)
EndEvent

 

event OnUpdate()
    if ActorRef.IsSwimming() && MCM.SwimmingClearsCum
        MCM.Sexlab.ClearCum(ActorRef)
    else
        RegisterForSingleUpdate(5.0)
    endIf


endEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)
    Utility.Wait(1) ; Margin
    CumHandle.CumEffectFinish(akTarget)
EndEvent
 

 

 

Which is ok if you don't mind continuously polling. You can rejiggle that by detecting when the the actor enters the swimming animation as referenced in this https://forums.nexusmods.com/topic/9072843-is-player-swimming-how-do-i-check-for-this/ thread :

 

 

 


;inside a maintenance function called during OnInit and triggered by OnPlayerLoadGame event RegisterForAnimationEvent(PlayerRef,"SoundPlay.FSTSwimSwim") ;the event itself Event OnAnimationEvent(ObjectReference akSource, string asEventName) If (akSource == PlayerRef) If asEventName == "SoundPlay.FSTSwimSwim" ;do something EndIF EndIf EndEvent

 

 

eg Detect when the swim animation event is thrown, then start the continuous polling event until the actor isn't swimming via the SKSE function IsSwimming() then kill the polling event, (but obviously not the swim animation event)

 

 

EDIT OPPS - wrong game. 

Edited by spoonsinger
OPPS, wrong game :-)
Posted (edited)
On 8/4/2025 at 4:13 PM, spoonsinger said:

Random off top of head.

 

Sexlab Cum Overlays Extended does

 

  Hide contents

 


Scriptname SCO_PlayerCumExpire extends activemagiceffect  

SCO_CumHandler Property CumHandle Auto
SCO_MCM Property MCM Auto
Actor Property ActorRef Auto

 

Event OnEffectStart(Actor akTarget, Actor akCaster)
    ActorRef = akTarget
    RegisterForSingleUpdate(3.0)
EndEvent

 

event OnUpdate()
    if ActorRef.IsSwimming() && MCM.SwimmingClearsCum
        MCM.Sexlab.ClearCum(ActorRef)
    else
        RegisterForSingleUpdate(5.0)
    endIf


endEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)
    Utility.Wait(1) ; Margin
    CumHandle.CumEffectFinish(akTarget)
EndEvent
 

 

 

Which is ok if you don't mind continuously polling. You can rejiggle that by detecting when the the actor enters the swimming animation as referenced in this https://forums.nexusmods.com/topic/9072843-is-player-swimming-how-do-i-check-for-this/ thread :

 

  Hide contents

 


;inside a maintenance function called during OnInit and triggered by OnPlayerLoadGame event RegisterForAnimationEvent(PlayerRef,"SoundPlay.FSTSwimSwim") ;the event itself Event OnAnimationEvent(ObjectReference akSource, string asEventName) If (akSource == PlayerRef) If asEventName == "SoundPlay.FSTSwimSwim" ;do something EndIF EndIf EndEvent

 

 

eg Detect when the swim animation event is thrown, then start the continuous polling event until the actor isn't swimming via the SKSE function IsSwimming() then kill the polling event, (but obviously not the swim animation event)

 

 

EDIT OPPS - wrong game. 


Thank you for thinking about this.
Indeed that works perfectly for Skyrim but Fallout4 does not expose IsSwimming anymore for some reason.

I did not think to check for a sound being played , good alternative.


Here is what I found, in case it is useful for anyone else. 

While there is no IsSwimming function in the actor script in fallout 4 anymore, there are still Creation Kit conditions about IsSwimming, IsInWater and IsUnderwater. 
Those conditions can pe placed on scenes, topics, or even magic effects.

I looked at Get Dirty Mod and saw that: 

It looks for the OnPlayerStartedSwimming event to figure out if swimming has started without having to poll continuously.
Then applies a magic effect with a script attached that self-renews every x seconds or so, but only as long as those three CK conditions are met (conditions are not set up in Papyrus, but rather in the CK on the magic effect). 
Once they are not met, the magic effect stops.
Papyrus scripts simply check for the presence of the magic effect on the player as needed, when it makes to make a decision.

It is a bit more roundabout than a ISSwimming() function, but it works, checking for these the three conditions seems really robust.

 

Edited by MSM_Alice

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...