Releasing Grabbed Nodes

Discussion in 'Mods and Skins' started by HighBeam9000, May 6, 2022.

  1. HighBeam9000

    HighBeam9000
    Expand Collapse

    Joined:
    Aug 2, 2021
    Messages:
    265
    Hello!

    I'm trying to programmatically release nodes stuck together with the node grabber. For example, if I strap a mattress or recliner to the top of a car using the node grabber, I'd like to dump the cargo with the push of a button. Here's the code:

    Code:
    --Prep the module
    local M = {}
    M.type = "auxilliary"
    M.relevantDevice = nil
    M.defaultOrder = 1
    
    --Release node-grabbed nodes
    local function releaseNodes()
       
        --Get player vehicle ID
        local vid = be:getPlayerVehicleID(0)
        if vid ~= nil then
           
            --Release node-grabbed nodes
            be.nodeGrabber:clearVehicleFixedNodes(vid)
            log('I', "Node Release", "OK...")
        else
            log('I', "Node Release", "Uh-oh...")
        end
    end
    
    -- Public interface
    M.releaseNodes = releaseNodes
    
    -- Return the module
    return M
    I've progressed to the point where no errors or warnings pop up in the debug window, and I can see where "OK..." is output because the code reaches that point, but nothing seems to happen. The above code is in an "extension.lua" file, which is loaded with a "modScript.lua" file.

    I think I read in another post that the function be.nodeGrabber:clearVehicleFixedNodes unsticks any nodes stuck to a vehicle using the node grabber. Am I using the function wrong, or maybe using the wrong function?

    I'm actually testing this by spawning the D-series tow truck mod, using the node grabber to stick the tow hook to the front bumper of a Pidgeon, and towing it away. When I get to the scrapyard, I trigger the code above, and I see "OK..." appear in the debug window, but the tow hook doesn't detach from the Pidgeon's bumper.

    Help, please, please?
     
    #1 HighBeam9000, May 6, 2022
    Last edited: May 6, 2022
  2. HighBeam9000

    HighBeam9000
    Expand Collapse

    Joined:
    Aug 2, 2021
    Messages:
    265
    Oops... I think I posted this to the wrong forum. :oops:

    I think it should have been in "Mod Support". I'm going to repost it there.

    Sorry...
     
  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