Unsolved Problem with Overriding the vehicleController.lua Logic

Discussion in 'Mod Support' started by default0.0player, Jun 26, 2021.

  1. angelo234

    angelo234
    Expand Collapse
    Programmer
    BeamNG Team

    Joined:
    Aug 11, 2017
    Messages:
    540
    Hmm weird, I tested it out and I can see that "aggressionOverride" does change when I call that function.
     
  2. default0.0player

    default0.0player
    Expand Collapse

    Joined:
    Nov 30, 2018
    Messages:
    1,926

    Here's the file that where my test was made. It should be 0.95 aggression if S is selected (0.95 is a placeholder for another future aggression curve). Search keyword "--modtest"
    However there's no effect in game
     

    Attached Files:

  3. angelo234

    angelo234
    Expand Collapse
    Programmer
    BeamNG Team

    Joined:
    Aug 11, 2017
    Messages:
    540
    So I think the culprit is the tiny spelling mistake of getControllerSafe :)
     
  4. default0.0player

    default0.0player
    Expand Collapse

    Joined:
    Nov 30, 2018
    Messages:
    1,926
    Not quite, the first version is getControllerSafe but after an attempt failure I delete the file. the file uploaded here is rushed, sorry.
     

    Attached Files:

  5. angelo234

    angelo234
    Expand Collapse
    Programmer
    BeamNG Team

    Joined:
    Aug 11, 2017
    Messages:
    540
    Have you tried running the command in the console?
    Code:
    controller.getControllerSafe("vehicleController").setAggressionOverride(1)
     
  6. default0.0player

    default0.0player
    Expand Collapse

    Joined:
    Nov 30, 2018
    Messages:
    1,926
    I got this
    Code:
    100.43282|I|GELua.ui_console.exec| GELua(Sandboxed) < 'controller.getControllerSafe("vehicleController").setAggressionOverride(1)'
    100.43494|E|GELua.ui_console.exec| Error: [string "GEConsole"]:1: attempt to index global 'controller' (a nil value)
    =============== Stack Traceback >> START >>
    (1) main chunk of GEConsole at line 1
    (2) global C function 'xpcall'
    (3) Lua global 'executeLuaSandboxed' at file 'lua/common/devUtils.lua:33'
      Local variables:
      cmd = string: "controller.getControllerSafe(\"vehicleController\").setAggressionOverride(1)"
      source = string: "GEConsole"
      stdOutCache = table: 0x0213dea17670  {}
      fEnv = _G (global table)
      print_saved = Lua function 'print' (defined at line 16 of chunk @/lua/ge/main.lua)
      func = Lua function '?' (defined at line 0 of chunk GEConsole)
      err = nil
    (4) Lua local 'func' at line 891 of chunk 'lua/ge/extensions//ui/console.lua'
      Local variables:
      dtReal = number: 0.0168689
      dtSim = number: 0.0165
      dtRaw = number: 0.0125145
      mustFocusKeyboard = boolean: false
      uiScale = number: 1
      imgsize = number: 22.7
      numColm = number: 4
      flags = number: 736
      exec = boolean: true
      cmd = string: "controller.getControllerSafe(\"vehicleController\").setAggressionOverride(1)"
    (5) Lua field 'hook' at line 654 of chunk 'lua/common/extensions.lua'
      Local variables:
      funcName = string: "onUpdate"
      funcList = table: 0x0213dde40888  {1:function: 0x0213d5523fa0, 2:function: 0x021321913a98, 3:function: 0x021321898c30 (more...)}
      (for generator) = C function: builtin#6
      (for state) = table: 0x0213dde40888  {1:function: 0x0213d5523fa0, 2:function: 0x021321913a98, 3:function: 0x021321898c30 (more...)}
      (for control) = number: 1
      _ = number: 1
      func = Lua function '?' (defined at line 454 of chunk lua/ge/extensions//ui/console.lua)
    (6) Lua function 'update' at file '/lua/ge/main.lua:361' (best guess)
      Local variables:
      dtReal = number: 0.0168689
      dtSim = number: 0.0165
      dtRaw = number: 0.0125145
    --------------- << END <<
    
    
     
  7. angelo234

    angelo234
    Expand Collapse
    Programmer
    BeamNG Team

    Joined:
    Aug 11, 2017
    Messages:
    540
    You need to run it in the Vehicle Lua console (click on the down arrow next to input box and select "Current Vehicle")
     
    • Agree Agree x 1
  8. default0.0player

    default0.0player
    Expand Collapse

    Joined:
    Nov 30, 2018
    Messages:
    1,926
    OK, will try that later.
     
  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