Notice: Collision works differently when you're not looking.

Post » Mon Nov 19, 2012 11:29 am

I made this script that captures enemies by placing a cage around them. It works magnificently, except every time you turn around the prisoners became escapees. And I mean every time.

If you're looking at them, they don't clip through. I've done dozens of trials waiting for minutes at a time, and they don't escape. But if you look away and run for a few seconds, invariable they are out of their cages.

It is SUPER annoying. The only solution I see is maybe placing collision markers around their cages. Inelegant, but I want this to work.
User avatar
Jordyn Youngman
 
Posts: 3396
Joined: Thu Mar 01, 2007 7:54 am

Post » Mon Nov 19, 2012 9:26 am

Well, the navmesh determines where they can go when they're not on screen I imagine. You need to script some collision boxes that enable/disable when you activate their cage doors or whatever. Look at WhiterunDragonsreachWorld for an example, especially the "L_NAVCUT" boxes, which, I assume dynamically interrupts the navmesh.
User avatar
Music Show
 
Posts: 3512
Joined: Sun Sep 09, 2007 10:53 am

Post » Mon Nov 19, 2012 11:23 am

The problem with that is, I don't believe what I call "abstract" objects like trigger boxes or collision cubes can be PlaceAtMe'd or they don't have any size. I could use a MoveTo, but I want this spell to be able to catch multiple actors, and I'd have to move tons of them around to accomplish this. Also, keeping ObjectReferences as sustained properties I've noticed causes save game bloat. So, it isn't a great option.
Is there a way to create a collision cube around an object ad hoc?
EDIT: Thought of a less elegant, but functional solution.

int i = 0while i < 45  if (LongCage2) && T.GetDistance(Prison) > 25 && T.GetDistance(LongCage2) > 25   T.SetPosition(X,Y,Z)  elseif T.GetDistance(Prison) > 25 && !LongCage2   T.SetPosition(X,Y,Z)  endIf  Utility.Wait(1)  i=i+1endWhile

lol
User avatar
steve brewin
 
Posts: 3411
Joined: Thu Jun 21, 2007 7:17 am

Post » Sun Nov 18, 2012 10:14 pm

I noticed that the game engine sometimes moves NPC's to their package location or the nearest door marker, so I don't think, collision boxes and stuff will do the trick. A possible solution was to give them a StayAtCurrentLocation package, which could be done with an alias. You could start a mini quest when they are caught in the cage and ForceRef the alias to the captive. Just stop the quest when the cage door is opened and they will continue with their normal packages.
User avatar
Stephanie I
 
Posts: 3357
Joined: Thu Apr 05, 2007 3:28 pm

Post » Mon Nov 19, 2012 1:15 am

Meh, then I'd have to create a boatload of different aliases for if you cast the spell on up to X enemies simultaneously. I wound up just making the script move them back to inside the cage if they get too far away from it.
User avatar
Christine
 
Posts: 3442
Joined: Thu Dec 14, 2006 12:52 am

Post » Mon Nov 19, 2012 7:16 am

Do the NPC's packages tell them to go somewhere outside of the cage? If so then it isn't collisions that are the issue, the game is teleporting them. If an NPC is running along a navmesh (like in an open room) and fails to move for a certain period of time, they are teleported forward a bit. This is to prevent NPC's from being permanently stuck on 'bad' navmesh. I assume the game is simply waiting for you to look away so the player doesn't see them teleport.

Perhaps make the NPC's you're trapping alias's and give them a 'stand still' package? That would stop them from teleporting towards their packages current destination.

EDIT: Doh, I see that was just suggested. :P
User avatar
Sammygirl
 
Posts: 3378
Joined: Fri Jun 16, 2006 6:15 pm

Post » Mon Nov 19, 2012 11:39 am

I had a similar problem, sandboxing NPCs were teleporting past locked doors to reach the markers within their sandbox radius. I had to modify the package to cover a smaller area.
User avatar
:)Colleenn
 
Posts: 3461
Joined: Thu Aug 31, 2006 9:03 am

Post » Mon Nov 19, 2012 4:42 am

I also experienced this but with an object floating in the water. Calculating the Z position of a certain item in water when the player is not looking at it results in a value several units below what I received when I was looking at the item -- probably because the item wasn't actually floating if not in LOS of it. I solved this by placing the item in front of the player when it is created, which seemed to work. In my situation I just had to look at the item at least once when it is initially loaded in order for collision to work properly.

You could also try using !PlayerRef.HasLOS(ObjectRef) to do something if the player isn't looking at it. This was my initial idea for my problem but I decided the above solution was easier.
User avatar
xxLindsAffec
 
Posts: 3604
Joined: Sun Jan 14, 2007 10:39 pm

Post » Mon Nov 19, 2012 7:28 am

...You could also try using !PlayerRef.HasLOS(ObjectRef) to do something if the player isn't looking at it...

Perhaps disabling the objectRef's ai while the player is not looking then re-enable when they are, would this stop their packages temporarily and in turn the backup teleport mechanism? :shrug:

- Hypno
User avatar
Josee Leach
 
Posts: 3371
Joined: Tue Dec 26, 2006 10:50 pm

Post » Mon Nov 19, 2012 6:20 am

If you dont want to deal with aliases and packages, I think you can have an npc call KeepOffsetFromActor on themself and it will effectively make them sit still until you call clearoffset.
User avatar
Eduardo Rosas
 
Posts: 3381
Joined: Thu Oct 18, 2007 3:15 pm


Return to V - Skyrim