Jump to content

FindAllReferencesOfType not working for Workshop created items


Recommended Posts

I am using FindAllReferencesOfType to search for certain items.

 

It works great on items that have been placed in the game via plugins in the CK. However, the same items, for example PoolTable01, created through the Workshop are given weird form ID numbers starting with "ff". So, they don't match the CreationKit form ID for that item and thus do not get picked up by FindAllReferencesOfType calls.

 

Does anyone know a solution for this?

 

Is there some way to know ahead of time what the Workshop created form ID for specific items will be?

 

Or, maybe is there a base object that can be scanned for instead of the static form ID number?

 

Thank you for any help.

Edited by dagobaking
Link to comment
Share on other sites

Runtime created forms all start with FF in their ref IDs.

 

I think what needs to be done here is check for the base objects, by calling GetBaseObject().GetFormID() on those items. Of if you don't need the ID, just stick with GetBaseObject(), then you can do whatever comparison checks you need to do after that.

 

Edit: Ok I see that you mentioned this function not picking up runtime created forms, which seems..strange to me.

 

I thinking now that on the workshop form, it checks through a formlist or perhaps an array.

Edited by Rasikko
Link to comment
Share on other sites

Runtime created forms all start with FF in their ref IDs.

 

I think what needs to be done here is check for the base objects, by calling GetBaseObject().GetFormID() on those items. Of if you don't need the ID, just stick with GetBaseObject(), then you can do whatever comparison checks you need to do after that.

 

Edit: Ok I see that you mentioned this function not picking up runtime created forms, which seems..strange to me.

 

I thinking now that on the workshop form, it checks through a formlist or perhaps an array.

 

I have new information. It turns out that workshop created items work ok as long as they are Furniture items and I am searching for them with the Furniture formID. If they are Static items and I search for them with the Static formID, they are not found.

 

Should I be using a different form ID for static items? I see that there are some helper-looking forms related to them (a transform?).

 

FindAllReferencesOfType definitely works on items created in a Workshop, so long as you use a Formlist that has the right EditorIDs inside. Could you post the code that you are using?

 

I have some new info, see above. It doesn't appear to be workshop created items that are the issue. But, rather Static items.

 

Here is the function that does the search:

 

Function OnGetLocationData(Var[] furnitureForms, Var[] furnitureSources)


AAF_FurnitureSearchList.Revert()


Int i = 0
While i < furnitureForms.Length
Furniture f = Game.GetFormFromFile(furnitureForms[i] as int, furnitureSources[i] as String) as Furniture
AAF_FurnitureSearchList.AddForm(f)
i = i + 1
EndWhile


ObjectReference[] kLocationArray = PlayerRef.FindAllReferencesOfType(AAF_FurnitureSearchList, wizard_search_area)


Var[] locationData = new Var[0]
i = 0
While i < kLocationArray.Length
if(kLocationArray[i].GetAngleX() + kLocationArray[i].GetAngleY() == 0.0)
locationData.Add( Utility.VarArrayToVar(makeLocationData(kLocationArray[i])) )
EndIf
i = i + 1
EndWhile


Var[] sendData = new Var[1]
sendData[0] = Utility.VarArrayToVar(locationData)


sendEvent("SEND_LOCATION_DATA", sendData)
EndFunction

The inputs are arrays of the form ID and sources for items that could really be anything. But, mainly either Furnitures or Static items. Furnitures work ok. Static do not.

Link to comment
Share on other sites

Static items also definitely work with the function. However, you might be running into an issue regarding precombined objects. The function won't find any objects that are within the precombined system.
Link to comment
Share on other sites

Static items also definitely work with the function. However, you might be running into an issue regarding precombined objects. The function won't find any objects that are within the precombined system.

 

What are precombined objects?

 

I am testing this with PoolTable01. I can build that in the workshop, run it through this function and it does not appear in the search. Additionally, when I click on the item via the console, the form ID it shows is not the form ID of the Static that is searched for.

 

But, even further than that, PoolTable01 can be placed into the world via the CK and it still does not get detected by this function.

Link to comment
Share on other sites

Runtime created forms all start with FF in their ref IDs.

 

I think what needs to be done here is check for the base objects, by calling GetBaseObject().GetFormID() on those items. Of if you don't need the ID, just stick with GetBaseObject(), then you can do whatever comparison checks you need to do after that.

 

Edit: Ok I see that you mentioned this function not picking up runtime created forms, which seems..strange to me.

 

I thinking now that on the workshop form, it checks through a formlist or perhaps an array.

 

 

FindAllReferencesOfType definitely works on items created in a Workshop, so long as you use a Formlist that has the right EditorIDs inside. Could you post the code that you are using?

 

I think I see the issue. It's right there in front of us in that function. :)

 

I am casting the incoming objects as Furniture. So, when they are actually Furniture that is ok. But, when they are Static objects, casting them as Furniture breaks the search for that item.

 

SO, the next question is, how can I resolve that? I tried changing it to ObjectReference and then none of the searches worked. I CAN set things up to cast the forms differently based on a passed in type variable. But, I would rather not keep track of an assigned type variable if there is a more elegant solution.

 

Do you see a way to re-write my function so that it will scan whatever type of object shows up via the form/source variables?

Link to comment
Share on other sites

Ok. More progress. I used "Form" instead of Furniture or ObjectReference and that captures both!

 

Now, the only remaining issue is that "theForm.GetName()" works for the Furniture items. But, it returns blank for the Static items.

 

Is there another way to get the name of the Static object?

Link to comment
Share on other sites

The problem you are likely running into is that most Statics don't have names set up for them.

 

True. And I have a solution for those cases. But, it looks like my test static PoolTable01 does have one... Just doesn't appear to be available at run-time..?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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