Unsolved AI using the parking brake with a lua trigger box

Discussion in 'Mod Support' started by CrashHard, Aug 14, 2021.

  1. CrashHard

    CrashHard
    Expand Collapse

    Joined:
    Aug 5, 2013
    Messages:
    1,581
    Hey, have been trying to figure out how to set this up for hours.
    Could I ask for someone who know how to write a lua script for some help?
    I have been copying and pasting different lua commands into the triggerbox window, but I`m flying blind here.
    I have been trying the commands with (data) (kdata) and (tdata) Have no idea what it does.
    I have no idea what the Parkingbrake command is, (how to toggle the parkingbrake) have been looking around the lua folder in the game folder.

    If anyone that know the script would post the code here I would be very grateful.

    Lua_trigger.jpg
     
  2. NOCARGO

    NOCARGO
    Expand Collapse

    Joined:
    Apr 1, 2019
    Messages:
    1,514
    input.toggleEvent('parkingbrake')
     
  3. CrashHard

    CrashHard
    Expand Collapse

    Joined:
    Aug 5, 2013
    Messages:
    1,581
    Thank you, but where do I add that to the trigger box window?
    I tried different things, but none of them worked. did I say I have no coding experience ;)

    Code:
    local function handbrake(data)
    if data.event == 'enter' and data.triggerName == 'handbrake' then
    be:input.toggleEvent('parkingbrake')
    end
    end
    handbrake
    Code:
    local function handbrake(tdata)
    be:getObjectByID(tdata.subjectID):queueLuaCommand('input.toggleEvent('parkingbrake')')
    end
    handbrake
    Code:
    local function handbrake(tdata)
    be:getObjectByID(tdata.subjectID):input.toggleEvent('parkingbrake')
    end
    handbrake
     
  4. NOCARGO

    NOCARGO
    Expand Collapse

    Joined:
    Apr 1, 2019
    Messages:
    1,514
    You're welcome, tbh I don't really know about any trigger box window, is that map related maybe ?

    Nope, heheh :)

    So, as I don't know where you are writing your function all I can say is that I tried the handbrake event by editing the pickup trigger for the tailgate by simply replacing the openDoor event by the handbrake event and that worked. So clicking the tailgate trigger acted upon the handbrake :) The trigger code for pickup tailgate is in the pickup_tailgate jbeam file.

    But again, I don't have map (map trigger) modding experience.
     
  5. CrashHard

    CrashHard
    Expand Collapse

    Joined:
    Aug 5, 2013
    Messages:
    1,581
    Yes it is in the map editor. you add the lua trigger box to your map, and add the script in the lua window.
     
  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