Talk:FindClosestReferenceOfTypeFromRef - Game

From the CreationKit Wiki
Jump to navigation Jump to search

Working Example[edit source]

The example does not work, and no one on the forum seems to be able to explain exactly how to make this work. A functioning script example would help immensely to explain how this works.

The value for "afRadius" given in the example is far too small for anything to be found. In my experiments, it seems the radius of the player is something only just under 50 units (I think I remember in previous games hearing that 128 units is about 6 feet which is ~= 1.82 metres).
I can't test it at the moment, but could you try a value like 500 and see if that works?
P.S. Please sign your comments on talk pages with ~~~~. This adds your username (with a link to your user page) and a timestamp
-- Cipscis 22:04, 13 February 2012 (EST)
So the distances are different from Skyrim to Oblivion? Or are they roughly the same?
Dog 02:28, 14 February 2012 (EST)
It seems the units used by both games are still the same. When I say the radius of the player looked less than 50 before, I forgot that, because of the way I was testing, what I should have said was that the radius of most non-creature characters looks to be a little less than 25. Sorry about that.
-- Cipscis 02:56, 14 February 2012 (EST)
The problem is not the radius, is the "None or invalid form type as Base object for FindClosestReferenceOfType" error that returns with all the Forms I've passed to it as base objects. The FormList versions of the function work well...which is weird because one would expect they use this one, but maybe it's the other way around?
Shana 17:54, 16 February 2012 (EST)
Could you give an example here of how you tried to use it that resulted in that error? I assume the error is from the debug log and the script still compiles fine?
-- Cipscis 17:57, 16 February 2012 (EST)
This is the first time I write in a wiki kekeke. As for the example, I replied in the topic I was asking about it with one and the debug log. The script compiles fine yes. [1] Check last two spoilers for the code and the debugging errors. Shall I copy the code in here,if I figure how that is? lol
Shana 18:40, 16 February 2012 (EST)
Ok. I got it. The issue was that I thought when in the properties window said PapyrusPersistenceForm it was really getting the desired Form. Or saying it in another way. You don't seem to be able to auto-fill Forms. They just seem to be used as placeholders. Using another type of object as a parameter auto-filled works allright. I have added an example
Shana 04:18, 17 February 2012 (EST)
Ok, so I'd like a confirmation. I've been testing through this now for eight hours. It seems like that FindClosestReferenceOfTypeFromRef, and respectively all other find functions, will work ONLY if the player is either arBaseObject/arCenter, OR if the player is inside the same cell of the Reference's/Form's that are called via FindClosestReferenceOfTypeFromRef.
Mofakin 11:38, 23 August 2014 (CET)
I'm sure that guy gave up 9 years ago but, arCenter can be any reference to perform the search on. All the find functions that allow for a search to be performed on a reference have the same issue that if arBaseObject is the same base object as arCenter, arCenter is returned instead. Generally speaking they are all bad for finding actors. --TwilightSky (talk) 06:00, 31 August 2023 (EDT)