1. Before reporting issues or bugs, please check the up-to-date Bug Reporting Thread for the current version.
    Solutions and more information may already be available.

v0.6.1 - Dry Van Trailer Scenario restart issue

Discussion in 'Troubleshooting: Bugs, Questions and Support' started by torsion, Sep 19, 2016.

  1. torsion

    torsion
    Expand Collapse

    Joined:
    May 31, 2015
    Messages:
    1,585
    In a scenario which includes a semi and dry van trailer (such as Heavy Delivery Pack:Utah's "Heavy Cargo B" scenario) the landing gear can malfunction upon scenario reset.

    If the landing gear is in the up position (such as when it is attached to the semi) and the scenario is reset, the landing gear will remain in the "up" position with no way for the player to correct it. For this reason it can be difficult or impossible to hookup to the trailer after a reset (The front of the trailer is too low to get the fifth wheel under it.). I've attached a screenshot.

    This is very easy to replicate, please let me know if there are any questions. For now, a workaround is to be certain to press "L" to disconnect the trailer before resetting the scenario.
     

    Attached Files:

    • 20160918180653_1.jpg
  2. mumboking

    mumboking
    Expand Collapse

    Joined:
    Jun 11, 2015
    Messages:
    1,417
    Try setting the following on the trailer:
    Code:
    electrics.values.feet = 0
     
  3. torsion

    torsion
    Expand Collapse

    Joined:
    May 31, 2015
    Messages:
    1,585
    Ah, good workaround. I won't be able to update the Lua right away, but it looks like that is going to work!

    Generally I feel like the game should probably handle this for us, but maybe it makes more sense to handle this one uncommon thing inside the scenario? I'm trying to remember how other things inside "electrics" are handled on resets.
     
  4. torsion

    torsion
    Expand Collapse

    Joined:
    May 31, 2015
    Messages:
    1,585
    @mumboking - thanks, that definitely did the job. Here's some functioning example code (assuming that the trailer is named 'trailer' in the prefab).

    @Scepheo - you may find this interesting, or you may already know this. It seems that the last hook that race.lua currently calls before onRaceStart() is actually onRaceWaypoint. This call is useful because it's where the WP count resets from nil to zero and the call occurs after everything is loaded. I see that onRaceInit is supposedly called around the same time, but that doesn't show in my log for some reason and I haven't tried to use it.

    WP 0 seems to be a good place to execute this sort of thing for the moment.
    EDIT: see the bottom.

    Code:
    local function onRaceWaypoint(data, goal)
          if data.cur == 0 then
            scenetree.findObject('trailer'):queueLuaCommand("electrics.values.feet = 0")
        end  
    end
    EDIT: Hmm, so actually WP0 loads right before the countdown starts, eg only 3.5s before onRaceStart is called - not really useful, my mistake. Unfortunately onRaceInit isn't called any earlier either. It seems that if you want something done when the scenario hits the START the best thing to do is use both onScenarioRestarted and onScenarioLoaded. That seems to do the trick. :)
     
    #4 torsion, Sep 21, 2016
    Last edited: Sep 21, 2016
  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