Jump to content

GetDistance help


StealthDick

Recommended Posts

After NPC has dialogue with Player the NPC starts walking to a marker.

The player is to meet up with the NPC at the marker but whenever the PC fast travels to a location near the marker, the NPC is still at the spot where the PC fast traveled from.

How would I use GETDISTANCE to move the NPC to the marker when the Player is a certain distance away?

Thanks.

Link to comment
Share on other sites

I had a similar situation and the way sorted it out was I had a quest start via the same dialogue result script that made the NPC start using the AI package to go to the place I wanted them to go. This quest had a processing delay of maybe 1 second. It checked for the player to be a certain distance away from the NPC and for the NPC not to be in the player's view. Once it found that both requirements were satisfied, the NPC was teleported to the marker and the quest was ended. The quest was set to be stopped on proper completion of the AI package as well, in case it were still running.

Begin GameMode
    If player.GetDistance2D NPCref >= 2048
        If player.GetLOS NPCref == 0
            NPCref.moveto MarkerRef
            ; maybe remove their AI package or add another one or whatever here?  maybe EVP?
            StopQuest ThisQuest
        EndIf
    EndIf
End

Begin GameMode
    if NPCref.GetDistance2D MarkerRef <= 64
        StopQuest ThisQuest
    endif
End

Edit: I don't remember are you running your GECK with NVSE and JIP LN, but GetDistance2D is a Lutana function, which is now included in JIP LN as Lutana was merged into JIP LN. GetDistance will work fine if you aren't running JIP LN.

Edited by EPDGaffney
Link to comment
Share on other sites

Well, I've suggested on the JIP LN page that if possible, the SetOnFastTravelEventHandler function be modified to be called any time the player fast travels, should the map marker argument be left blank. So it's possible that in future this will be a moot point, to some degree.

 

Also, GetLOS isn't always reliable, so in some situations it may be preferred just to increase the distance, maybe use GetDistance3D, or whatever. I've had GetLOS return true when the NPC or object was at the very edge of my camera, and I've had it not realise I couldn't see the NPC. These both require an extreme, and most of the time it works fine, but it's best to test each situation.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...