Grab Nodes from Lua

Discussion in 'Content Creation' started by HighBeam9000, Feb 3, 2022.

  1. HighBeam9000

    HighBeam9000
    Expand Collapse

    Joined:
    Aug 2, 2021
    Messages:
    265
    Is there a way to grab and connect nodes from lua?

    I noticed a function call in the "Click to Enter Vehicle" mod by Angelo234:
    be.nodeGrabber:clearVehicleFixedNodes

    Are there any additional be.nodeGrabber functions available?

    What I'm trying to do is programmatically load a dummy on an ambulance stretcher, then secure the dummy to the stretcher. It's not easy to do this manually with the node grabber, so I'm trying to build a script to do it. I think I've got the dummy loading part figured out, but I'm a bit clueless on securing it.
     
    • Like Like x 3
  2. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,056
    That is a really cool idea for a mod, but why don't you just make the dummy part of the vehicle? No need to mess with LUA then
     
  3. HighBeam9000

    HighBeam9000
    Expand Collapse

    Joined:
    Aug 2, 2021
    Messages:
    265
    --- Post updated ---
    I'd like to be able to extricate dummies from wrecked cars. The dummy loader would be part of a small tool pack for ambulance roleplay. The pack would also include a tool kinda like the jaws of life, which I'd have to build too.

    A player would use the JoL to unwrap the car from around the dummy, I mean "patient". The player would then drag the patient from the car and use the loader script to load the patient onto the gurney.

    Getting the now-loaded gurney out of the ambulance would be the easy part (and fast & not safe). I've already enabled the gurney to be jettisoned out the back of the ambulance. If you've seen Richard Hammond's Top Gear ambulance, then you know what I'm going for. :D

    ...and the Jaws of Life tool would definitely emit the sound of hydraulics. It just wouldn't be complete without it.
     
    • Like Like x 1
  4. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,056
    That is a really cool idea, I hope you can figure it out! If I knew how to help I would, but I don't.
     
    • Like Like x 1
  5. HighBeam9000

    HighBeam9000
    Expand Collapse

    Joined:
    Aug 2, 2021
    Messages:
    265
    Thank you.

    I suppose the Jaws of Life tool could also be used for chop shop roleplay, or general destruction enjoyment.
     
  6. angelo234

    angelo234
    Expand Collapse
    Programmer
    BeamNG Team

    Joined:
    Aug 11, 2017
    Messages:
    540
    There is a function called be.nodeGrabber:fixCurrentNode() which does connect two nodes together. The catch is that it can only connect nodes you hover over with your mouse cursor, since the function is used for connecting two nodes by hand. But I don't know of any other function that will do exactly what you want.
     
  7. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,056
    I might have a rough idea, how about making couplers like for trailers? Like both the stretcher and the dummy have couplers that connect together and are controlled by a LUA file
     
  8. HighBeam9000

    HighBeam9000
    Expand Collapse

    Joined:
    Aug 2, 2021
    Messages:
    265
    Doh! I was afraid of that. I was hoping there was a function like be.nodeGrabber:fixNodesById(obj1Id, obj1NodeId, obj2Id, obj2NodeId). Maybe something like that might appear someday. That would allow for all kinds of neat stuff: harpoons, sticky mines, lotsa stuff.

    Thanks for letting me know these aren't the droids I'm looking for. I would've kept looking for a while.

    --- Post updated ---
    That's a GREAT idea! With couplers, I don't think I'll have to teleport the dummy to the gurney. All the player has to do is activate the couplers and get the dummy close enough to the gurney. Having to drag the dummy is more realistic than teleporting it in terms of roleplay anyway.

    Here was my original Plan B: When a vehicle is spawned inside of another vehicle, they get stuck together. Maybe I can stick a dummy to a gurney if I teleport the dummy to a position where its volume slightly overlaps the gurney's volume.

    ...but your Plan B is much better. Can the couplers be made unique, such that each of the dummy couplers will only connect with a particular gurney coupler?

    Edit:
    I just checked some docs, and it looks like I can make unique couplers. Yes! This might work!

    Thank you!
     
    #8 HighBeam9000, Feb 4, 2022
    Last edited: Feb 4, 2022
  9. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,056
    Yeah unique couplers work, but they don't modify the camera zoom properly, and could have issues with resetting the car that require some LUA to fix. (check the T-Series dump upfit for example)
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice