Detect if object underwater?

Post » Wed Jun 20, 2012 11:42 pm

How can I detect if an object (MISC is best) is currently swimming, floating or under water? Does papyrus have any collision or proximity functions that dont require me to lay down trigger areas across all of Skyrim?

I'm trying to make a carryable, useable fishing net. Drop it in water, catch fish. Drop on land, catch dirt (or maybe rabbits).

I made a hacky solution by spawning a Slaughterfish at the objects current location when dropped. In the console I can then target the fish and check "isSwimming" to determine if the object was dropped in deep water... but I cannot figure out how to get the value of isSwimming (console command) into my Papyrus script. There's a page describing how - http://www.creationkit.com/Passing_Conditions_to_Papyrus - but it's poorly written and I don't really understand what he's doing or if it applies to my case.

Would SKSE or ScriptDragon help me? (for that matter, are there any docs for these on the web???)

Any help is appreciated.
User avatar
A Boy called Marilyn
 
Posts: 3391
Joined: Sat May 26, 2007 7:17 am

Post » Wed Jun 20, 2012 9:33 pm

Ha ha, i made a similar hacky system to detect water, and well it works.

Using a Ref of an Actor with a copy of NordChildRace and all sizes set to the lowest. This Actor has two Abilities, the first is returning IsSwimming with the ME and the second is a constant Invisibility.
Any time i equip a certain object, the Ref is moved with script at 40 feet forward the Player, and this little fish is able to swim in very low water level.

I can't see another way to detect water for now.
User avatar
Lindsay Dunn
 
Posts: 3247
Joined: Sun Sep 10, 2006 9:34 am

Post » Wed Jun 20, 2012 9:50 pm

How about if you make the net a "Talking Activator" type, and put a script like this in it:

Event OnContainerChanged(OldContainer,NewContainer)   if !NewContainer ; if we were dropped	  RegisterForSingleUpdate(2.0) ; should hit whatever we were dropped in by then   else	  UnRegisterForUpdate() ; Stop polling if we're picked up. Handle "Caught something" here.   EndifEndEventEvent OnUpdate()   if (self as Actor).IsSwimming()	 Debug.Notification("Net is Wet")   else	 Debug.Notification("Net is Dry")   endif   RegisterForSingleUpdate(2.0)EndEvent
User avatar
Laura-Lee Gerwing
 
Posts: 3363
Joined: Fri Jan 12, 2007 12:46 am

Post » Wed Jun 20, 2012 9:56 pm

Figured it out - i was applying the conditional to the magic effect and not the ability. Once I reversed them, it all works fine.
User avatar
BRAD MONTGOMERY
 
Posts: 3354
Joined: Mon Nov 19, 2007 10:43 pm


Return to V - Skyrim