Edit Beam Strength in Scenario - Welding Parts

Discussion in 'Programming' started by bidwars, Jan 12, 2018.

  1. bidwars

    bidwars
    Expand Collapse

    Joined:
    Sep 23, 2014
    Messages:
    171
    Hi, I am trying to adjust the strength of some beams from a lua script in my Demotion Derby Scenario. I have already asked this question in the mod support area but have not come up with a solution. Maybe someone that looks at the programming forum will have an answer.

    I am trying to weld parts on cars after the vehicles are loaded into the scenario. I can break hinges without a problem but I cannot get anything to make them stronger. The code below is the only thing that seems to deal with setting break groups. I don't get any error messages when running the code but it also does not do anything.

    The following code searches the Vehicle > Data > Beams table for the word hinge or latch and should set the beamStrength to a very large number.

    helper.queueLuaCommandByName(AIPlayer,
    [[for _,b in pairs(v.data.beams) do
    if b.breakGroup ~= nil then
    local breakGroups = type(b.breakGroup) == "table" and b.breakGroup or {b.breakGroup}
    for _, g in pairs(breakGroups) do
    if type(g) == 'string' and (string.find(g, "hinge") ~= nil or string.find(g, "latch") ~= nil) then
    b.beamStrength = math.huge
    obj:setBeam(-1, b.id1, b.id2, b.beamStrength, b.beamSpring, b.beamDamp, b.beamDeform, b.deformLimit, b.deformLimitExpansion, b.beamPrecompression)
    endendend
    end]])
     
  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