Jump to content

[LE] How many ingame days does the game needs to delete dead npcs ?


maxarturo

Recommended Posts

The title says it all.

I'm trying to calculate something for 2 specific cells that i need them to be clear/clean of bodys the third or fourth time he/she returns, and i'm trying to avoid if possible further scripts in those cells (there is already too much going on).


* I do have a simple solution, but requires a small script to be attached to every single dead npc.


I did try to test this in game, but the "Wait" seems to not trigger the deletion, and i'm trying to save some time that it will be wasted while playing it normally (without using "wait").


If anyone knows... he/she will save me some precious time !.


Thanks a lot.

Link to comment
Share on other sites

Thanks for that HadToRegister.

But is kind of the two ideas i had.

1) Auto self delete (dead npc) on "OnCellDetach()"

2) Auto self move (dead npc) to a "Dead Cell" after three "OnCellDetach" (which is actually what i want).


But as i said i'll like to let the game handle this to avoid further scripts in those cells.


Nevertheless... thank you !.

Link to comment
Share on other sites

Hmm.. next script is for Actor, if you use a quest with ReferenceAlias scripts you should adjust.

 

TestRemoveDeadNPCScript

 

Scriptname TestRemoveDeadNPCScript extends Actor
; https://forums.nexusmods.com/index.php?/topic/8294483-how-many-ingame-days-does-the-game-needs-to-delete-dead-npcs/

  ObjectReference PROPERTY DeadCellMarker auto    
  ; use a Xmarker placed into the cell you want to move the dead NPCs

  Int PROPERTY iCounter = 3 auto    ; detach counter
  Bool bDead                        ; [default=False]


; -- EVENTs -- 4

; maxarturo wrote: actually what i want
; 1) Auto self delete (dead npc) on "OnCellDetach()"
; 2) Auto self move (dead npc) to a "Dead Cell" after three "OnCellDetach"


EVENT OnInit()
;=============
    Debug.Trace(self+" OnInit() - has been reached..")            ; a bit info here
ENDEVENT

EVENT OnReset()
;==============
    Debug.Trace(self+" OnReset() - has been reached..")            ; a bit info here
ENDEVENT

EVENT OnDeath(Actor akKiller)
;============================
    bDead = TRUE
ENDEVENT

EVENT OnCellDetach()
;===================
IF ( bDead )
    iCounter = iCounter - 1
    IF (iCounter <= 0)
        myF_CleanUp()
    ENDIF
ENDIF
ENDEVENT


; -- FUNCTION --

;---------------------
FUNCTION myF_CleanUp()  ; for actor script
;---------------------
; wiki tells us: "If an actor is already in the cell, and the player is also in the cell,
; leaving the cell, or arriving in the cell, MoveTo() does not" work.

    self.DisableNoWait()
    self.MoveTo(DeadCellMarker)
    Utility.Wait(0.1)
    self.Delete()
ENDFUNCTION

 

 

 

use that to cleanup an alias script

 

;--------------------------
FUNCTION myF_CleanUpAlias()  ; for ReferenceAlias script
;--------------------------
    objectReference oRef = self.GetReference()
IF ( oRef )
    oRef.DisableNoWait()
    oRef.MoveTo(DeadCellMarker)
    Utility.Wait(0.1)
    oRef.Delete()
    self.Clear()            ; unassign the ObjectRef from ReferenceAlias
ENDIF
ENDFUNCTION

 

 

 

Happy new Year..

Edited by ReDragon2013
Link to comment
Share on other sites

Thanks for that ReDragon2013.


Since i can't find any references of this in the web, i decided to just move all dead npcs to a "Dead Cell" and let the game do its thing whenever it wants.

I will just use a 4 line script for this, i don't think that this needs unnecessary further scripting.


Happy new year to you too my friend.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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