Jump to content

[LE] How to make a destroyed object respawn again?


Recommended Posts

: I'll do the best to be straight and clear about this matter to avoid confusion. I've been for a long time trying to figure out a method to put a destroyed object to respawn again and reset to their original state when the dungeons resets after the 30 in-game days on Skyrim so they can be destroyed again.

 

Many people probably are familiar with the spider webs that need to cut and the barricades seen during the Civil War that can be destroyed as well.

 

I'm working on custom objects that follows the same principles of the Spider Webs and the Barricades, but, once they are destroyed, nothing else can be done.

 

The "Respawn" option, even marked when double-clicking on a placed object in the Cell View window, seems to not work.

I tried to use some vanilla scripts such as DefaultEnableOnReset <- (Script that self enables/disables an object when a cell reset).

I tried triggers and some other small scripts by my own and even experimenting other options on the "Destruction Data" tool in Creation Kit.

I tried to find a guide or topic that could explain anything about the respawn matter of an object once destroyed but I ended in empty hands.

 

Basically what I'm trying to do is something similar as the well known Castlevania's torches, once the player destroy the torches, as soon as they leave the room and reenter the torches respawn. Or something similar to The Legend Of Zelda's breakable jars and pots.

 

In my case I need them to respawn to a puzzle I'm working on. Everything else in the puzzle respawn correctly except the destroyed objects, which in turn breaks the puzzle in the end.

 

I also recently noticed that even the Vanilla Barricades and the Spider Webs don't respawn after the 30 in-game days... or I might be wrong, and the case of the Barricades, the animated placed model upon the barricade's destruction, stays there forever and is not "cleaned" by the game.

 

I'm not a papyrus expert and I have little knowledge in scripting to help this case. I've been looking for this subject almost a year basically ending with the same results and finally I gave up insisting on doing something about it by my own.

 

I wish to know if someone has better knowledge about a method to make a destroyed object respawn or if there's already a topic talking about this matter or if there's another alternative through scripts, or, if I'm doing everything wrong.

 

Note: I'm trying to avoid having to create Quests to handle this issue as this mod I pretend to make it Quest Free.

 

 

Any advice is appreciated ;3

Link to comment
Share on other sites

You can try using a simple script attached to your object reference.

 

Example script:

 

Scriptname TM_ObjectRefScript extends ObjectReference 

Event OnUnload() 
    Self.Reset()
EndEvent

Note that Reset() will only work for objects placed in the render window in the creation kit, and not for objects placed via script using PlaceAtMe. I also haven't tried it on destroyed objects, but I think it should work.

 

Edit: Name the script something more unique

Link to comment
Share on other sites

Ok scratch that, I tested a bit and that doesn't work. You can use the ClearDestruction() function to make the object appear whole again, but then you can't destroy it by damaging it again, (annoying). So, here is my solution. For your puzzle pieces you want destroyed, place statics in the creation kit with your puzzle piece model, and check the initially Disabled box so they are invisible. Basically you are making them markers. Attach this script to your puzzle piece marker:

 

Scriptname TM_ObjectRefScript extends ObjectReference 

Activator Property PuzzlePiece Auto
ObjectReference Property PuzzlePieceRef Auto Hidden

Event OnInit() 
    PuzzlePieceRef = Self.PlaceAtMe(PuzzlePiece, 1, True)
EndEvent 

Event OnLoad() 
    PuzzlePieceRef.MoveTo(Self) ;re-position the PuzzlePieceRef to prevent the sinking bug. 
EndEvent

Event OnCellDetach()
    ;Debug.Notification("OnCellDetach")
    PuzzlePieceRef.Disable()
    PuzzlePieceRef.Delete() 
    PuzzlePieceRef = None 
    PuzzlePieceRef = Self.PlaceAtMe(PuzzlePiece, 1, True) ;replace old puzzle piece with new one.
EndEvent 

It places a brand new puzzle piece when the cell detaches, and deletes the old previously placed puzzle piece, allowing you to destroy it again. I tested it with the Barricade and it works well.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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