Water Collision Issues

Post » Tue Jan 26, 2016 7:29 pm

Hi all. I've recently written some code to lower a water level in a dungeon, which has worked. But while the visible water level drops, the original water collision level seems to remain, so walking through the visibly drained areas is being treated as swimming. There might be an issue with the code I've used that's causing this. Could one of you chaps have a quick look and tell me what I'm doing wrong please?




ObjectReference Property WaterLevel Auto
ObjectReference Property SoundMarker Auto
Bool Property WaterLowered = False Auto
Bool Property WaterDraining = False Auto
Int Property CDTimer = 0 Auto

Event OnActivate(ObjectReference akActionRef)

If akActionRef == Game.GetPlayer()

if (WaterDraining == False)
if(WaterLowered == False)
WaterDraining = True
WaterLevel.Translateto(864.00, -3552.00 , -852.00, 0, 0, 0, 15, 0)
endif
endif

While (WaterDraining == True)

While (CDTimer < 15)
SoundMarker.Enable()
CDTimer = CDTimer +1
Debug.Notification("Water Draining Timer = "+CDTimer)
Utility.Wait(1)
EndWhile

if (CDTimer > 14)
WaterDraining = False
WaterLowered = True
SoundMarker.disable()
CDTimer = 0
Endif

EndWhile

Endif

Endevent

I know its a bit messy, as I've chopped, copied and mangled bits of code from a number of online tutorials to get this working so there's probably an issue there as well :)

User avatar
Alexis Acevedo
 
Posts: 3330
Joined: Sat Oct 27, 2007 8:58 pm

Post » Tue Jan 26, 2016 5:32 pm

Water collision doesn't translate properly, u gotta disable/enable the water plane for it to update collision.

A better way would be to have a water plane at the translate destination (ie, the final resting place of the plane), initially disabled, then stick a tiny script on your translated plane to enable the disabled one OntranslationAlmostComplete.

User avatar
Robert Jr
 
Posts: 3447
Joined: Fri Nov 23, 2007 7:49 pm

Post » Tue Jan 26, 2016 6:23 pm

The translation basically removes water from the dungeon, so there's no need to enable a second, unless its specifically required is there? Would you know the code to remove the water plane from my original water?

User avatar
Brad Johnson
 
Posts: 3361
Joined: Thu May 24, 2007 7:19 pm

Post » Tue Jan 26, 2016 9:09 am

Scripting noob here.


Should swimming be possible in your initial water? If not, you could simply remove the collision (bhkSPCollisionObject) from the water nif and save it as new water. Only the surface will be left.


I remember that I did that once when I wanted to walk beneath the water surface and it worked.

User avatar
Avril Churchill
 
Posts: 3455
Joined: Wed Aug 09, 2006 10:00 am

Post » Tue Jan 26, 2016 8:27 am

Hi Tamira. Yes, the original water half fills a large cavern, and some slightly lower tunnels, so it needs to have collision initially.



Edit: Ok, i just added an if statement on the 6th tick (where it hits the floor in the main room) and disabled the water totally. Seems to have worked without causing any issues...

User avatar
lolly13
 
Posts: 3349
Joined: Tue Jul 25, 2006 11:36 am


Return to V - Skyrim