Jump to content

Is player swimming? How do I check for this?


antstubell

Recommended Posts

I have this in working code:

If Dude.IsSwimming()

Note that Dude is an actor parameter in a custom function.

Perhaps you need to cast down from ObjectReference (which is what GetPlayer() returns) into Actor.

 

Taking your script example

 

EVENT onTriggerEnter(ObjectReference akActionRef)
  If akActionRef == Game.GetPlayer()
    if (akActionRef as Actor).IsSwimming()
      Debug.notification("The player is enjoying a swim.")
    EndIf
  EndIf
EndEvent
Link to comment
Share on other sites

No joy. I get the same error.

 

TyburnKetch's idea -

 

EVENT onTriggerEnter(ObjectReference akActionRef)
if Game.GetPlayer().IsSwimming == 1
Debug.notification("The player is enjoying a swim.")
EndIf
EndEvent

 

Gives these errors -

IsSwimming is not a property on script actor or one of its parents

cannot compare a none to a int (cast missing or types unrelated)
Edited by antstubell
Link to comment
Share on other sites

Then your only recourse is to fall back onto animation events.

 

This is taken out of my Controller Walk Run Toggle for SSE. It catches when the player starts swimming. Bare bones code only

 

;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

 

But I rely on IsSwimming to find out when the player stops swimming. You might be able to use a walking animation to find out when the player stops swimming.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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