Jump to content

Can anyone fill in the blanks on FindAllReferences?


Recommended Posts

objectreference[] pCloseStuff = FindAllReferencesOfType(pForm,700)

 

I have created a formlist in the creation kit - and tried too many times to get this to work, in spite of the compile coming back with no errors on each iteration of the trial and error method - it's ... crap software if you ask me, this app maker that compiles stuff with proper syntax that does not work or have a hope of working.

 

I also tried "FindAllReferencesWithType" passing it a formlist of an item I had created and in testing with the object right in front of me in-game - it returned the infamous "none."

 

I see that most items don't even use keywords or have them.

 

So FindAllReferencesWithType seems to be the logical route.

 

I also read that this is bugged and only looks for the first form in the formlist.

 

But... how ffs do you specify that list so that it actually does something instead of returning "none" ????

I followed a thread where supposedly someone solved this issue and was able to 'look around' at all the references of "typetofind" - but amazingly the two people who were chatting in the thread did not reveal the solution. Just that the mod he was working on was released. Great. If you don't know - mod script source is not included in a release - there's no way to see the solution even if you get the mod and look at it in the creation kit.

 

I tried all the versions of 'looking around' in terms of getting object references including "Game.FindClosestReferenceOfAnyTypeInListFromRef" - and they all return "none" - ffs

 

Anyone?

 

Link to comment
Share on other sites

What exact items are you placing in your Formlist? I've used FindAllReferencesOfType and the variants in several of my released mods, so the functions do work. An example would be in my Door mod, where I search for all doors in a settlement and either open or close them as needed. All the base door references are in a big formlist that I input into the function.

Link to comment
Share on other sites

I created a new "formlist" using the "new" under the "formlist" listing - it shows like a container - I dragged and dropped my object "IncineratorFootlocker" - a copy of "footlocker" container into it - added it to a script editing the objectreference script's "properties" - a script that is attached to a weapon.

 

Any way you could post your door script?

Link to comment
Share on other sites

I'm also having problems with these types of functions. I initially used FindAllReferencesWithTypeFromRef, but as it always returned "none", decided to change to FindClosestReferenceOfAnyTypeInListFromRef, as for me it's enough if it just finds the nearest. It still doesn't work though...

 

This is how I'm calling it:

Closest = Game.FindClosestReferenceOfAnyTypeInListFromRef(pSPETypesAvoidanceList, PositionMarker, 1500.0)

My suspicion is that if it works for Reneer, then the function should plainly work and we are doing something wrong. Probably the types we are looking for? In my case I'm trying to find if there is any type of actor or creature nearby.

 

In my case pSPETypesAvoidanceList points to a form list that contains types of most creatures and humanoids. Maybe I'm choosing the wrong types to detect? These are the contents of the FormList (Keywords):

ActorTypeAnimal
ActorTypeBug
ActorTypeCreature
ActorTypeDog
ActorTypeFeralGhoul
ActorTypeGhoul
ActorTypeHuman
etc...

I'm moving the player to a random location nearby (PositionMarker), but cancels if Closest is not "none". It always returns "none" and I'm often moved right in the middle of a group of ghouls, which can get quite unpleasant. A distance of 1500 should still be within the loaded area, so I guess this shouldn't be the problem?

Link to comment
Share on other sites

Game.FindClosestReferenceOfAnyTypeInListFromRef() Is not going to work.

 

 

You have to point at an ObjectReference which is at the center of your radius (most likely Player).

 

"Game" is not an object that can be used as a target to search around the radius. It has to be an object IN the game itself which exists somewhere to search in an area around.

 

The fact that it has a Radius parameter tells you it has to be something that exists to search around, not the entire game itself.

Link to comment
Share on other sites

The ObjectReference parameter is inside the function in this case... Or am I reading this wrong?

ObjectReference Function FindClosestReferenceOfAnyTypeInListFromRef(FormList arBaseObjectsA, ObjectReference arCenter, float afRadius) global

In my case it would be "PositionMarker", which is a marker I use to search the area from.

Link to comment
Share on other sites

I will try this. I can move the player to the marker and check from the player.

 

 

[EDIT]: Didn't seem to work either when checked from the player. I will keep testing.

Edited by Dielos
Link to comment
Share on other sites

When I get back to my computer later on today I'll provide a working example for you guys.

 

But real quick, using a Formlist of Keywords to search for will not work, because those don't exist in the game world. You will want to replace those with the actual base FormIDs of the creatures you want to find.

Edited by Reneer
Link to comment
Share on other sites

  • Recently Browsing   0 members

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