Unsolved Deleting Vehicles in Scenario

Discussion in 'Mod Support' started by bidwars, Dec 14, 2016.

  1. bidwars

    bidwars
    Expand Collapse

    Joined:
    Sep 23, 2014
    Messages:
    171
    I am able to delete a vehicle "vehicle3" in a scenario using TorqueScript.eval(command) in the function onRaceStart. The problem starts when the scenario starts to run an onUpdate() from the statistics.lua. It is trying to get speed data on the vehicle that I deleted. How can I remove the vehicle3 from onUpdate() call?

    Here is the log info:

    7.22860|E|GameEngineLua:Exception|lua/ge/extensions//statistics/statistics.lua:731: attempt to index local 'vehicle' (a nil value)
    =============== Stack Traceback >> START >>
    (1) metamethod C function '__index'
    (2) Lua function 'onUpdate' at file 'lua/ge/extensions//statistics/statistics.lua:731' (best guess)
    Local variables:
    scenario = table: 0x5678a630 {multiseat:table: 0x56b69320, preImgIndex:0, minPlayers:1, players:table: 0x56784328 (more...)}
    (for generator) = C function: next
    (for state) = table: 0x56a387c0 {2851:table: 0x56b2fc20, 2789:table: 0x56d67008, 2917:table: 0x56d49888 (more...)}
    (for control) = number: nan
    vehicleID = number: 2404
    vehicleTable = table: 0x56766448 {stat_damage:table: 0x56b0d468, stat_altitude:table: 0x56b0c970, stat_speed:table: 0x56b0cd70 (more...)}
    data = table: 0x56b0cd70 {label:Max Speed, instances:table: 0x56b0cd98, unit:speed, enabled:true (more...)}
    (for generator) = C function: next
    (for state) = table: 0x56b0cd98 {vehicle3:table: 0x56b0ce28}
    (for control) = number: nan
    _ = string: "vehicle3"
    instance = table: 0x56b0ce28 {source:vehicle3, value:0}
    vehicleData = nil
    vehicle = nil
    (*temporary) = table: 0x569abaa0 {2917:table: 0x56a3ea88, 2789:table: 0x56b23a48, 2851:table: 0x56b23630 (more...)}
    (*temporary) = table: 0x5677fda8 {}
    (*temporary) = nil
    (*temporary) = string: "attempt to index local 'vehicle' (a nil value)"
    (3) Lua field 'hook' at file 'lua/common/extensions.lua:221'
    Local variables:
    func = string: "onUpdate"
    funcList = table: 0x566c4460 {1:function: 0x56709a20, 2:function: 0x56791190, 3:function: 0x566be7e8 (more...)}
    (for index) = number: 2
    (for limit) = number: 6
    (for step) = number: 1
    i = number: 2
    (4) Lua function '?' at line 216 of chunk '"lua/ge/main.lua"]'
    --------------- << END <<
     
    #1 bidwars, Dec 14, 2016
    Last edited: Dec 19, 2016
  2. bidwars

    bidwars
    Expand Collapse

    Joined:
    Sep 23, 2014
    Messages:
    171
    Can anyone help me out with this?
     
  3. bidwars

    bidwars
    Expand Collapse

    Joined:
    Sep 23, 2014
    Messages:
    171
    I am still trying to figure this out. Also if I delete the ai vehicle the player camera does not work.
     
  4. bidwars

    bidwars
    Expand Collapse

    Joined:
    Sep 23, 2014
    Messages:
    171
    So I found out that if you press "R" on the keyboard to reload the scenario then this error disappears and I get the player camera back. Is there a way to reload a scenario from my lua script?
     
  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