Jump to content

How to detect if a workshop-furniture is placed in openair ?


Recommended Posts

Posted

Hello,

 

Does anybody have a good idea how to detect if a workshop furniture or regular furniture is placed in open air ?

 

My own idea works, but not reliable. Basically my own idea was to place a small object somewhat above the furniture and check if there is Line of sight available.

 

So here is my function:

 


bool Function isbedinopenair (objectreference testbed)
 
   If DownLookerRef
   else
      form tform =  Game.getform (0x214007)   ; Mine
      DownLookerRef = pl_ref.PlaceAtMe (tform, 1, false, true, false)
   endif
;   DownLookerRef.MoveTo (testbed, 0.0, 0.0, 340.0) ; a) works in sanctuary
   DownLookerRef.MoveTo (testbed, 0.0, 0.0, 600.0)  ; b) works in redrocket under the roof
   DownLookerRef.enable ()
   utility.wait (0.05)
   
   bool bopenair = DownLookerRef.HasDirectLOS (testbed)
   
   ; DownLookerRef.disable ()

   Log ("Bed in open air 600 " + bopenair + " DownLooker " + DownLookerRef)
   Debug.Notification ("Bed in open air " + bopenair )

   return bopenair
   
endfunction

 

Placing the "Downlooker" 600 units above the furniture works well in Red rocket location and the roof high in the air is detected.

However the same function fails and delivers false in sanctuary with no roof above the furniture.

If the "Downlooker" is placed 340 units above the furniture the function works correct in sanctuary.

Anyway with 340 units the "Downlooker" will be also under the 'high' roof in red rocket and therefore the function does not deliver

the correct result in Red rocket.

Maybe something is wrong with the function and a fix is possible.

But maybe someone has a complete different idea.

 

 

 

 

 

 

 

  • 2 weeks later...
Posted

I do not know the reason, but instead of using a mine as the downlooker I've tested it with a sleeping bag as a downlooker.

And now the script works also in sanctuary as desired with the distance 600 units.

 

Maybe it has something to do with the 'root node' in the mesh file, but I completely have no knowledge abaout mesh files.

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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