dizietemblesssma Posted April 5, 2022 Posted April 5, 2022 How do I test an objectref to see if it is a container? There appears to be no 'container' object type, ad no condition function with container in its name except 'GetInContainer' which has no description! diziet
Sphered Posted April 5, 2022 Posted April 5, 2022 GetType() tells you via Int. Container is 28. If whatever reason not wanting to use SKSE you can cast as container Refs btw you have to check their baseobject, not the ref directly
IsharaMeradin Posted April 6, 2022 Posted April 6, 2022 Here is a listing of script objects: https://www.creationkit.com/index.php?title=Category:Script_Objects Every pre-placed object is an ObjectReference. This includes containers. ObjectReference is a child of Form. Children can be cast upwards to their parents.Container is a child of Form. Parents can be cast downwards to their child. But will fail if the object is not valid for that child. (See Cast Reference) Given that bit of information, assume an object reference is stored in a variable called myRef. If ((myRef as Form) as Container) ;is a container do something Else ;is not a container do something else EndIfAnd as already mentioned SKSE's GetType can inform you if an object is a container. If (myRef.GetBaseObject().GetType() == 28) ;is a container do something Else ;is not a container do something else EndIf
Recommended Posts