how to check if Npc is in water?

Post » Thu Jun 21, 2012 10:56 am

how to ?
User avatar
Sasha Brown
 
Posts: 3426
Joined: Sat Jan 20, 2007 4:46 pm

Post » Thu Jun 21, 2012 7:24 pm

I use this -> I stripped it down to just what you need.

Event OnEffectStart(Actor akTarget, Actor akCaster) ; Your going to want to change this based on how you want to apply the Event checks.

RegisterForAnimationEvent(akTarget, "SwimStart")
RegisterForAnimationEvent(akTarget, "SwimStop")

EndEvent

Event OnAnimationEvent(ObjectReference akSource, string asEventName)

Debug.Notification(asEventName) ; Do S**t, other then a Notification!

EndEvent
User avatar
Abel Vazquez
 
Posts: 3334
Joined: Tue Aug 14, 2007 12:25 am

Post » Thu Jun 21, 2012 2:43 pm

I personally use a system where I apply two invisible magic effects to the player, each with a condition of IsSwimming == 0 or IsSwimming == 1. The effects toggle back and forth based on these states. I then use OnEffectStart events on scripts tied to these effects to do things when the "Wet" or "Dry" effect starts. They are classified as constant effect abilities, so they are always applied to the player and never wear off.

I do this for the PC. To apply these to NPCs, I assume that you only care about NPCs you can see, so I suppose calls to FindRandomActorFromRef() to apply these effects to actors in range might do the job.
User avatar
Daniel Brown
 
Posts: 3463
Joined: Fri May 04, 2007 11:21 am

Post » Thu Jun 21, 2012 9:11 am

Actually I was considering this just becouse of a Bug of the gameplay ... like I have a ship in sea ... all around just sea , a dragon comes and startfighting making messes around , kills a npc , but on one occasion this NPC ended up in water and the water is very deep there , the following scene requires the other npcs to gather around the dead body , but since this was finished in water well the whole game stopped ...

It didn't happaned again but I tought that a troubleshooting could be usefull , I then added collision boxes all around the ship to not allow falling overboard not sure if this would save from the npc bugs to fall in water ...

actually he was pushed by a weird firebreath ... that usually shouln't cause any force push ...
User avatar
Tamika Jett
 
Posts: 3301
Joined: Wed Jun 06, 2007 3:44 am

Post » Thu Jun 21, 2012 6:10 am

wait...so outdoor water level is not pos z 0.0 like it was in Oblivion?

To check to see if an actor was in water was easy as checking their posz (if I remember correctly).

I guess I should have realized that seeing as most of skyrim is in the Negative elevations (I find -700 pos z even at snow level foot hills for example).
User avatar
LuCY sCoTT
 
Posts: 3410
Joined: Sun Feb 04, 2007 8:29 am

Post » Thu Jun 21, 2012 8:15 am

wait...so outdoor water level is not pos z 0.0 like it was in Oblivion?
Skyrim's water is at a lot of different heights. Oblivion was 100% flat I think, no waterfalls or anything. Skyrim has the stepping rivers, lakes all over, etc.
User avatar
Kaley X
 
Posts: 3372
Joined: Wed Jul 05, 2006 5:46 pm


Return to V - Skyrim