PathToReference - Actor in ObjectReference Script

Post » Tue Nov 20, 2012 5:44 pm

Possible?

Basically what I need to do is have a way for NPC's to be able to path to certain area's of my cell. I'm hoping to achieve this with hidden or cleverly disguised DOOR forms (all properly navmeshed but with BlockActivation to prevent instant teleport effect) by getting the DOORs to force the NPC's to a nearby location whereupon they are transported by more mundane means to the other end of the DOOR pairing. I hope I've been clear.

To clarify let's call:

Door 1: Point A
Door 2: Point B
Nearby location 1: Point Aa
Nearby location 2: Point Bb

Scenario:

NPC's will be walking up to the doors in order to get to certain places within my cell. Doors 1 and 2 are "teleporting" doors (with proper navmesh, but BlockActivation called on them), the problem is I don't want my NPC's to magically teleport between these points. The DOOR forms will ideally force the NPC's to move to the respective "Nearby Locations" (Points Aa + Bb) where they are moved between points A + B in another manner.

Can PathToReference be called on actors in an ObjectReference script? I really don't want to run a quest to manage this either that is just going overboad (plus alias' confuse/elude me)

I haven't tried MoveToInteractionLocation but I assume that it teleports similarly to MoveTo and won't actually prompt the NPC's to do any actual interaction in of itself.
User avatar
Richus Dude
 
Posts: 3381
Joined: Fri Jun 16, 2006 1:17 am

Post » Tue Nov 20, 2012 3:33 pm

Just want to bump this thread.

For testing purposes I have given an NPC a TravelBackAndForth package. Place to Travel 1 is near editor location, Place to Travel 2 is a marker beyond Door 2.

Everything is navmeshed correctly so the NPC recognises that it has to interact with my disguised DOOR form in order to complete the package. (Package is definitely being run correctly at this point)

The problem is that my NPC just perpetually activates the DOOR, the subsequent code isn't forcing them to do the things I want them to do in the interim.

Script is here:
Spoiler

Scriptname MDHSecretScript extends ObjectReference{Does something pretty cool}Event OnLoad()BlockActivation()EndEventEvent OnActivate(ObjectReference akActionRef)BlockActivation()Actor ActorObject = akActionRef as ActorIf Condition &--#62; 0   ;do function 1   If akActionRef != PlayerRef	ActorObject.SetRestrained()	 Utility.Wait(3.0)	ActorObject.SetRestrained(false)	ActorObject.PathToReference(NearbyLocation, 0.5)	ActorObject.SetRestrained()	   ;do function 2	 Utility.Wait(9.5)	ActorObject.SetRestrained(false)	ActorObject.EvaluatePackage()		  ;precautionaryendif   endifIf akActionRef == PlayerRef   ;do nothing, the player has other methodsendifIf akActionRef != PlayerRefIf Condition == 0  ActorObject.PathToReference(NearbyLocation, 0.5)	ActorObject.SetRestrained()		   ;NPC's be all cray   ;do function 2	Utility.Wait(9.5)	ActorObject.SetRestrained(false)	ActorObject.EvaluatePackage()endifendifEndEvent

I have blockActivation on the DOOR's to prevent them from just teleporting. PathToReference is not forcing my NPC's to move away from the precise spot from which they interact with the DOOR.

If I can get them to the reference all will be right in the world. Will calling EvaluatePackage reset the package and prompt the NPC to return to their editor location (to start the package again) or will it just remind them that they still want to get to Place to Travel 2? (I'm pretty sure the package get's interrupted during 9.5s of SetRestrained)
User avatar
Miguel
 
Posts: 3364
Joined: Sat Jul 14, 2007 9:32 am


Return to V - Skyrim