Detect if player is truly swimming underwater

Post » Fri Apr 18, 2014 5:39 am

I would like to know if there is a way to tell when the player is truly swimming (i.e. completely submerged) underwater. I know that there is an IsSwimming condition, but it is true even if the player is treading water above the surface. There are also the http://www.creationkit.com/Animation_Events#Movement_.26_World_Interaction_Events that fire when the player enters and leaves the water, but similarly, those fire while the player is still above the surface. Let us settle this question decisively once and for all. I'm looking at you Zartar ;) Is it possible to detect this state somehow?

User avatar
Tina Tupou
 
Posts: 3487
Joined: Fri Mar 09, 2007 4:37 pm

Post » Fri Apr 18, 2014 12:58 pm

Could you check for the Player's Oxygen meter? Or maybe the sounds played when you're swimming? (Can' remember for certain, but maybe there's breath-holding sounds, like there are puffed out sounds? It doesn't look like there's an AV, but there must be SOMETHING that is keeping track of how long they Player is submerged, and if you could find that you could probably watch for it decreasing... (obviously that last wouldn't work for people using Waterbreathing/argonians, but it might help somehow...)

User avatar
Eve(G)
 
Posts: 3546
Joined: Tue Oct 23, 2007 11:45 am

Post » Fri Apr 18, 2014 10:56 am

I was wondering myself whether the breathing sounds would work, I am not sure if those are registerable animation events though. I also don't think oxygen is a value that can be checked -- it's not stored in any ActorValue that I can tell, and there's no oxygen meter either, just the health bar starts dropping after a certain amount of time. I suspect the game doesn't even track an oxygen variable in Skyrim - it might just check if WaterBreathing ActorValue is set or not when the player first enters the water, and if it's not, start a countdown that then leads to dropping health after a predetermined time period.

User avatar
Lilit Ager
 
Posts: 3444
Joined: Thu Nov 23, 2006 9:06 pm

Post » Fri Apr 18, 2014 6:39 pm

"SoundPlay.FSTSwimSwim" should fire when moving while swimming but there are no unique events to catch the transition to swim idle. And I don't think there are any animation variables to tell if the actor is swimming :/.

"InterruptCast" should fire too (but this event is used in many places in the behavior) so you might have to register for this event and then use SKSE's IsSwimming() function to catch this transition (but does IsSwimming() script function have the same problems as it's condition function?).

You could also patch 0_master.hkx to send a custom animation event when the swim state is entered.

User avatar
Carlitos Avila
 
Posts: 3438
Joined: Fri Sep 21, 2007 3:05 pm

Post » Fri Apr 18, 2014 12:00 pm

The HUDMenu has a mode called "Swimming", too.
User avatar
SiLa
 
Posts: 3447
Joined: Tue Jun 13, 2006 7:52 am


Return to V - Skyrim