Jump to content

Papyrus - any ways to find objects of category or class?


Recommended Posts

Hello everyone! Sorry if such question was asked many times before.

Are there any ways to get references of all existing objects of a certain type/class/category, such as doors, containers, etc?

FindAllReferencesOfType is asking for a specific form or a list, but just shoving all existing doors into a formlist seems impractical, plus it would not include doors added by mods.

I've seen some scripts do "kTarget is (Door)", so the game knows when the ObjectReference is a certain class, so maybe there is a way to feed it to FindAllReferences function as a form?

Or the formlist is the only possible way?

Link to comment
Share on other sites

I'm not sure but I think "kTarget is (Door)" may refer to:

Form BaseForm = SomeObjectReference.GetBaseObject()
If BaseForm as Book
	Debug.Notification("SomeObjectReference is a Book.")
EndIf

 

FindAllReferencesOfType() doesn't take FormType as parameter. If using a Papyrus script is not mandatory, you can create a Quest instead: add a Quest Alias with Fill Type Find Matching Reference then add "Run on: Subject GetIsObjectType "BOOK" == 1".

 

If script extender dependency isn't an issue, FindAllReferencesWithFormType() is available in Garden of Eden SE.

ObjectReference[] Function FindAllReferencesWithFormType(String[] asFormTypes, ObjectReference akOrigoRef, float afAerialDistance = 10000.0) native global

 

  • Like 1
Link to comment
Share on other sites

8 hours ago, LarannKiar said:

I'm not sure but I think "kTarget is (Door)" may refer to:

Form BaseForm = SomeObjectReference.GetBaseObject()
If BaseForm as Book
	Debug.Notification("SomeObjectReference is a Book.")
EndIf

 

FindAllReferencesOfType() doesn't take FormType as parameter. If using a Papyrus script is not mandatory, you can create a Quest instead: add a Quest Alias with Fill Type Find Matching Reference then add "Run on: Subject GetIsObjectType "BOOK" == 1".

 

If script extender dependency isn't an issue, FindAllReferencesWithFormType() is available in Garden of Eden SE.

ObjectReference[] Function FindAllReferencesWithFormType(String[] asFormTypes, ObjectReference akOrigoRef, float afAerialDistance = 10000.0) native global

 

Thank you for the suggestion, I haven't looked into quest aliases yet, didn't know it could search for objects by type.

Basically what I need is to somehow make some types of objects in the game emit sound and I'm not sure if it's even possible.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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