Jump to content

disabling objects in a list


silhouett

Recommended Posts

I have a form list with both actors and Objects in it.

so from an object reference point how would I disable every thing in that list ?

 

I start with

 

While (index < COB_Removals.GetSize())

 

need some code here ?

 

 

index = index + 1
EndWhile
Thank You in Advance for any help
Link to comment
Share on other sites

Hi,

I've been doing something similar but with Arrays but I still think I can help you with this.

Source:

Int index = 0
While (index < COB_Removals.GetSize())
     ObjectReference MyObjReference = COB_Removals.GetAt(index) as ObjectReference
     MyObjReference.Disable()
     Debug.Trace("Successfully Removed")
     index += 1
EndWhile

Code Breakdown:

 

#1:

Int index = 0

Sets your integer to zero before you run it through the loop and add to it.

 

#2

While (index < COB_Removals.GetSize())

Starts the loop. It will run until 'index' is larger than the Formlist size for COB_Removals.

 

#3

ObjectReference MyObjReference = COB_Removals.GetAt(index) as ObjectReference

Sets anything in the FormList to an ObjectReference. Uses the index as a number to pull the object from. Because we're using GetSize index is going to start at 0 then go to 1, 2, 3, 4, etc.

 

#4

Debug.Trace("Successfully Removed")

Because why not add a trace in your loop to make sure it's working right?

 

#5

index +=1

For every time index is not larger than COB_Removals we're going to add 1 to it until it is. After it adds one the entire loop starts over.

 

#6

EndWhile

Leaves the loop when index is higher than COB_Removals

Link to comment
Share on other sites

This works for most of them fine but on a few I get "[08/29/2016 - 09:48:04PM] error: (0011E79D): cannot disable an object with an enable state parent" with different id's for the objects.

 

Someone else might have an answer for this part.

 

What exactly is being stored in this Formlist?

 

Also are these objects already enabled somewhere?

Edited by StuykGaming
Link to comment
Share on other sites

well the disable line says [ (000BDDFA)].ObjectReference.Disable() - "<native>" Line ?

 

I am storing some objects and actors from the prewar sanctuary. I was trying to make the original sanctuary empty of cars and life but still have the buildings etc.

 

Thought this would be a good way to do that.

Link to comment
Share on other sites

well the disable line says [ (000BDDFA)].ObjectReference.Disable() - "<native>" Line ?

 

I am storing some objects and actors from the prewar sanctuary. I was trying to make the original sanctuary empty of cars and life but still have the buildings etc.

 

Thought this would be a good way to do that.

The problem is that some of the objects in your list have an "enable state parent" which is basically another object linked to the one in your Formlist via the CK itself. Essentially the object in your formlist gets its "enabled state" from the "parent" object and thus you would need to disable the "parent" object in order to disable the "child" (your object) as well. This would be simple if you could actually get the "parent state" object that is connected to your formlist object but unfortunately you can't do that via Papyrus.

 

You may have to use .Delete()

This would not work. Delete() only works on objects that were dynamically created in the game (using functions like PlaceAtMe). It will not work on objects that were placed / created within the CK.

Edited by Reneer
Link to comment
Share on other sites

I believe you can use http://www.creationkit.com/fallout4/index.php?title=SetCriticalStage_-_Actor as a makeshift delete for objects not dynamically placed. Although this is something I would use in like an uninstall script or something. Disable is fine on its own otherwise, since it blocks rendering obviously.

That function works on actors, not objects, so, no, it would not function as a "makeshift delete". Edited by Reneer
Link to comment
Share on other sites

Yeah I just read that again and you beat me to my edit. :tongue:

 

Although your tone comes off a bit.. insulting but I get it that no one likes misinformation, but I always behind myself.

 

However that almost makes me want to find a way to delete objects from the world.

Edited by TummaSuklaa
Link to comment
Share on other sites

  • Recently Browsing   0 members

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