Jump to content

Help with MoveTo an NPC scripting


unknownhero2827

Recommended Posts

I think this is the right place to post this...

 

I want a script to MoveTo an NPC... upon 3 days after death... to a cell, Trashcan00. Then, I want to resetinterior that cell -- or Trashcan00 -- automatically every so often to permanently delete the NPC.

 

I'm very new to scripting, and I'm not sure how to do that. If someone could at the least point me in the right direction... very appreciated.

Edited by unknownhero2827
Link to comment
Share on other sites

  • 1 month later...

You could try something like:

 

Event OnDeath()

Utility.wait(however many seconds)

self.moveto(wherever)

EndEvent

And attach the same script to each npc in question.

 

If you just want to get rid the a dead body, then try:

Event OnDeath()

Utility.Wait(however many seconds)

Self.Disable()

Self.Delete()

EndEvent

Edited by pyrotx
Link to comment
Share on other sites

@unknownhero2827: also i don't understand what do you want to do.

Anyway...to do something like you want, you need to create a quest script like this.

 

Scriptname TheQuest

 

float Timer

short S

Begin GameMode

if S == 0

set Timer to xxx (where xxx is your period in seconds)

set S to 1

endif

set Timer to Timer - GetSecondsPassed

;(NPCRef > the ref of your npc, CellMarkerRef > a XMarker that you need to place in the cell)

if (Timer <= 0) && (NPCRef.GetDead == 1)

NPCRef.Disable

NPCRef.MoveTo CellMarkerRef

ResetInterior TheCell

StopQuest TheQuest

endif

End

 

An actor cannot be deleted/reset if it is a static Ref (not created by the PlaceAtMe command but by the CS editor), but also if it is a dynamic ref (created by the PlaceAtMe command). You can delete only dynamic objects (not actors). You can only disable actors and/or move them in another place. When you reset the cell the ref is not deleted suddenly, but the cell will be restored to the initial state on the next loading of the cell marked as expired (as Maskar wrote 72 hours after the reset). Oblivion reset the cell when it need to load the cell; if you never enter the cell, Oblivion never restores it.

Link to comment
Share on other sites

I'm just trying to delete NPCs spawned with PlaceAtMe (From CS)

 

 

So, PlaceAtMe NPCs can't be deleted?

 

In-game, I clicked on the NPC with the console so that I had their ref. I then killed the NPC, and two days later it moved to the cell I wanted. Resetinterior was then also used on that cell. The NPC ref was still in my console. Then I entered the cell myself, and the NPC ref was gone.

 

I took this as the NPC was deleted. For if I had just disabled the NPC, it would still be selected in my console. Is not not deleted?

Edited by unknownhero2827
Link to comment
Share on other sites

It's correct. PlaceAtMe actors (not only NPC) cannot be deleted directly by a command. You need to wait that Oblivion removes them. Actors work in a different way from the other objects.

You can check out the wiki here: http://cs.elderscrolls.com/index.php?title=List_of_Functions.

 

unknownhero2827 wrote:

In-game, I clicked on the NPC with the console so that I had their ref. I then killed the NPC, and two days later it moved to the cell I wanted. Resetinterior was then also used on that cell. The NPC ref was still in my console. Then I entered the cell myself, and the NPC ref was gone.

 

Yes. As i wrote, if you enter the cell, the ref is removed but if you never enter the cell, the ref is marked as expired but it is not disposed in memory until you enter the cell. Only Oblivion's code can destroy an actor's ref, you cannot by external code (there is no commands to do it).

Link to comment
Share on other sites

I'm pretty sure i'm following correctly as you are saying. That you cannot delete NPCs by direct command, but only indirectly through oblivion resetting the cell after 72hrs (but also which can be done instantly through ResetInterior written in script).

 

Once Oblivion re-spawns the cell, you have to go to the cell to permanently trash the (marked for deletion) ref, or else the ref is still stuck in memory. So I think we are on the same page, sorta. I just wasn't completely sure we were, and that'd be a big problem for my mod if I got the wrong message.

 

Regardless, thank-you for the help.

Edited by unknownhero2827
Link to comment
Share on other sites

  • Recently Browsing   0 members

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