monsto Posted July 20, 2019 Share Posted July 20, 2019 I'm spawning mannequins with a pedestal. Under normal operation, the mann & pedestal are processed together. But sometimes, the mann becomes unresponsive, even to a normal activation. Thus, i'm building a spell that will outright delete the mann. The instance for the mann has the reference info to the pedestal, and deleting the mann does not delete the pedestal. What's a way to make the 2 entities live on each other, so that if the mann is deleted the pedestal goes as well? Could I have a function on the mannequin that would respond to a spell cast on it, giving info back to the spell so that the script could delete the correct entities? Further, I realize that this is an XYProblem... as it's a question about a solution (forcibly deleting entities) rather than a question about the problem itself (why/how the actor becomes unresponsive). There's nothing to suggest why this happens to the actor, as it's usually in 3rd to 5th time the mannequin has been changed. Link to comment Share on other sites More sharing options...
RichWebster Posted July 20, 2019 Share Posted July 20, 2019 You can't delete 2 instances by deleting 1, but you can make the pedestal a variable (property) in the script attached to the man, and then delete the pedestal before deleting the man. Remember to clear the property after deleting. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted July 20, 2019 Share Posted July 20, 2019 If you link the mannequin to the pedestal (and it may already be), you can have the spell target which ever is considered "the parent" and use GetLinkedRef to first remove "the child" and then remove "the parent". Requires the code to be on the object being hit rather than on the spell or its effects. Example (not tested for compilation or function -- theory only): Scriptname MannPedestalCleaner Extends ObjectReference Projectile Property mySpellProjectile Auto Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) If akProjectile == mySpellProjectile ;hit by the spell ObjectReference LinkedObj = Self.GetLinkedRef() LinkedObj.Disable() LinkedObj.Delete() Self.Disable() Self.Delete() EndIf EndEvent Link to comment Share on other sites More sharing options...
RichWebster Posted July 20, 2019 Share Posted July 20, 2019 That method won't work with script created objects, because there's no SetLinkedRef() function. Link to comment Share on other sites More sharing options...
TobiaszPL Posted July 20, 2019 Share Posted July 20, 2019 Script01 ( attached to XMarker ) ObjectReference ObjA ; Ref to Object 1 ObjectReference ObjB ; Ref to Object 2 Event OnActivate( ObjectReference QRef ) ObjA.delete() ObjB.delete() self.delete() EndEvent Script02 Event ??? Script01.Activate( self ) EndEvent Just use Activate Create 3 objects Two that you want to delete and XMarker ( last ) that support deleting all objects at once then Activate XMarker with any event by Activate() function and done... in Script01 if XMarker was activated it delete two References and self... Link to comment Share on other sites More sharing options...
maxarturo Posted July 21, 2019 Share Posted July 21, 2019 Another way to go is to create a script that will act as a controller and monitor the condition in which each object is, and it could be attached to anything in your cell or even in a quest, rough example : Event OnCellAttach() if (Mannequin.IsDisabled() Pedestal.Disable() Utility.Wait(0.2) Pedestal.Delete() endIf EndEvent * The mannequin should first be "Disable" before "Delete" in order for this to work. * This logic can also be apply in a script attached to the pedestal itself, the controller logic is more usfull if you have a large amounts of objects that needs to be monitored. Link to comment Share on other sites More sharing options...
Recommended Posts