Jump to content

Deleting a actor inside a formlist


Recommended Posts

I'm trying to delete actors that were added to a formlist when they died. I use it (at least that how it was in NV) to keep track of dead bodies:

        While (xxxEndlessWarfareMCM_CorpseList.GetSize() > xxxEndlessWarfareMCM_MaxDeadBodies.GetValue())
            Form ToDelete = xxxEndlessWarfareMCM_CorpseList.GetAt(0)            
            string name = ToDelete.GetName()
            name = ToDelete.GetName()
            fDebugTrace("Removed Actor " + name + " from dead body list.")
            xxxEndlessWarfareMCM_CorpseList.RemoveAddedForm(ToDelete)
            ToDelete.Disable()
            ToDelete.Delete()
        EndWhile

but all i get is "Disable is not a function or does not exist" in the CK. Any help?

Link to comment
Share on other sites

Oh sorry about that. In deleting i meant deleting the actual actor from the map using Disable() and Delete(). I already know how to remove the actor from the formlist.

Edit: Using "GetAt(0) as Actor" (learned it from your other answer) fixed it. Thanks again!

 

Edited by Magnusen2
Link to comment
Share on other sites

The issue is that you are pulling an object as a generic form from the form list and never telling the system what type of obejct the form is, so it doesn't have a script context.

 

If you are going to use formlists for managing ObjectReferences, which are less elegant than the purposely designed ReferenceCollectionAliases, then;

ObjectReference ToDelete = xxxEndlessWarfareMCM_CorpseList.GetAt(0) as ObjectReference 

or

(ToDelete as ObjectRefernce).Disable()
(ToDelete as ObjectRefernce).Delete()
Link to comment
Share on other sites

 

The issue is that you are pulling an object as a generic form from the form list and never telling the system what type of obejct the form is, so it doesn't have a script context.

 

If you are going to use formlists for managing ObjectReferences, which are less elegant than the purposely designed ReferenceCollectionAliases, then;

ObjectReference ToDelete = xxxEndlessWarfareMCM_CorpseList.GetAt(0) as ObjectReference 

or

(ToDelete as ObjectRefernce).Disable()
(ToDelete as ObjectRefernce).Delete()

Pardon me but is there any resource where i can learn more about "ReferenceCollectionAliases"? I can't find info on google.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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