Jump to content

Making NPC's find and walk to objects / locations / xmarkers


HellFencer

Recommended Posts

I am using New Vegas Script Extender (most current edition).

 

Alright, here is what I am trying to achieve:

 

  1. NPC joins you
  2. Access object finder through "hired" menu options
  3. Tell NPC to begin (setting a variable)
  4. NPC equips item with attached script
  5. Script locates nearest object
  6. Script moves / generates an xmarker to get NPC to walk to location
  7. NPC handles object once within a certain distance
  8. NPC returns to player

 

Where I am having trouble is getting the xmarker into the world and then moving it to the location. Here is the broken code:

set placedObject to Player.PlaceAtMe XMarkerRef 1
currentObject.placeatme placedObject 1

Shouldn't this pace an xmarker at the player as placedObject, which can then be moved to the currentObject?

 

I very much appreciate any help that the community can give!

Link to comment
Share on other sites

I created a new XMarker (by dragging XMarker into a cell) and gave it that reference. I assumed I would need to know a specific xmarker, given there are various ones all over cells already (and this script is meant to be used all over the place).

 

However, you are right; I was creating objects, not moving them. You solved my issue, only backwards. :)

 

XMarkerRef.moveto currentObject
;some other code to activate a travel AIpackage to XMarkerRef.

 

Its late at the moment. I'll let you know after I've tested tomorrow. Thanks!

Link to comment
Share on other sites

Okay, I got the script to work but modified it at bit:

XMarkerRef.moveto currentObject
set NPCRef.IsTraveling to 1 ;activates travel AIpackage to XMarkerRef

 

This is successful. The NPC now walks to the object and interacts. However, immediately after doing so I CTD every time. I can only think that I am creating some kind of endless loop or something that eats all the memory.

 

I am running the script on the NPC via equipping an item. Does the following setup cause issues? IE doing nothing when combat is initiated to try to save on system resources.

 

begin gamemode

if player.isincombat

else ;not in combat

;Code

endif ;combat

end ;gamemode

Link to comment
Share on other sites

  • Recently Browsing   0 members

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