Jump to content

Recommended Posts

Posted (edited)

Hi all,

 

I created a form list. Let's say it's with a cabbage, and a sweet roll.

 

I call FindClosestReferenceOfAnyTypeInListFromRef. Remember it has 3 parameters:

 

ObjectReference Function FindClosestReferenceOfAnyTypeInListFromRef(FormList arBaseObjectsA, ObjectReference arCenter, \

float afRadius) global

 

I'm passing in my form list, self, and 150

 

self refers to the object the script is attached to (let's just say it's a treasure chest).

 

So when I do this, for 150, it works like a charm. If I move a sweet roll closer to the chest than the cabbage...it finds sweet roll. If I swap, it finds cabbage.

I noticed, however, 150 seems HIGH. What is a unit, anyway? 150 units? how big is that? I took the cabbage and ate it, then I THREW the sweet roll into a huge moving river.

After watching it vanish, I activated the chest again, and it STILL found the reference.. Shouldn't it be returning empty at that point?

 

 

..So I then changed arCenter (radius) to 100, 50, 25, etc, ALL of which return not found when I move the same items that just worked near the chest. I even put them on TOP of the chest! It seems only 150+ returns the object, otherwise nothing.

I don't get it..It seems like <= 150 = nothing, 150 = anywhere on the damn map within reason it finds the object (I actually was able, once, to make such a huge gap between the chest and the sweet roll where it finally returned nothing).

 

Any ideas?

 

thanks so much!!! :wallbash: :wallbash:

Edited by tek_7
Posted

Ok, so I struggled with this at first, too...

 

With regards to the radius: It turns out that the radius the player takes up is about 25 units... so even 150 is not really that much.

 

And here is what I've personally found using an almost identical scenario but with static objects: Even though I script the container to find, disable and delete an object, and then make an inventory copy inside of itself, the target objects never really go away. Each time the 'Find' function fires it will find the same 'closest' object, over and over again. And as far as I know, there is no real way to 'Find' the next object, b/c even if you tell the script to ignore a disabled object it will still just find the same disabled object over and over. If you find a good solution to what you want to do, please share it! The best I was able to do was to find the closest of each type of object I was looking for, but if there were multiples the second closest would never be found.

 

 

Hope this helps a bit.

 

LB

Posted
  On 4/27/2012 at 6:55 PM, LittleBaron said:

Ok, so I struggled with this at first, too...

 

With regards to the radius: It turns out that the radius the player takes up is about 25 units... so even 150 is not really that much.

 

And here is what I've personally found using an almost identical scenario but with static objects: Even though I script the container to find, disable and delete an object, and then make an inventory copy inside of itself, the target objects never really go away. Each time the 'Find' function fires it will find the same 'closest' object, over and over again. And as far as I know, there is no real way to 'Find' the next object, b/c even if you tell the script to ignore a disabled object it will still just find the same disabled object over and over. If you find a good solution to what you want to do, please share it! The best I was able to do was to find the closest of each type of object I was looking for, but if there were multiples the second closest would never be found.

 

 

Hope this helps a bit.

 

LB

 

Thanks so much for responding!

 

I'm glad you confirmed the radius, although a bit confused on why I put 150 and after such a great distance it still continued to find the object. I wonder if it's accessing a reference regardless of whether the object is still any closer..

the only odd part is if i put the item in a position near the sweet roll, it'd find it. when i moved the sweet roll far away it still found it, but when i moved it REALLY far away (like outside the cell type far) it didn't find it. Maybe I need to clear the objectreference each time or something.. ill try and let you know.

  • 2 years later...
Posted

The way to actually work it out is to visit the Bethesda site where you will learn that 1 foot equals ~21.333 'units'.

 

So, for example, if you want a distance of 10 feet you would have to (21.333 x 10) = 213.33 units.

 

HTH

  • Recently Browsing   0 members

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