Solved Moding scenario.

Discussion in 'Mod Support' started by Drivver, Jul 6, 2016.

  1. Drivver

    Drivver
    Expand Collapse

    Joined:
    May 1, 2015
    Messages:
    233
    I'm referring to this thread.
    http://www.beamng.com/threads/i-need-help-moding-scenario.27512/
    (Since I got 1 reply at monday - not complaining just explaining why I made 2nd thread.)

    Simply I want to activate erase function only when this scenario is loaded. Also I'd be happy if you could help me deleting Prefabs and TSStatics from map via mod, but leaving barriers around arena. Because TSStatics are the most demanding right now, but barriers around playground are also part of TSStatic.

    Code:
        deleteClassObjects('Prefab')
    ex. When I put this line in to mod, scenario will not load. Changing 'Prefab' in to anything else for example 'TSStatic' works and will delete every TSStatic from map and will load correctly.
     

    Attached Files:

  2. mumboking

    mumboking
    Expand Collapse

    Joined:
    Jun 11, 2015
    Messages:
    1,401
    The scenario objects themselves are a prefab. It's probably deleting the scenario objects too.
     
  3. meywue

    meywue
    Expand Collapse
    Administrator
    BeamNG Team

    Joined:
    Nov 19, 2015
    Messages:
    339
    Hey,

    sorry for the late reply.

    There is one solution to delete TSStatic objects but it won't work with any of our maps so far.

    Code:
    ObjectToDelete = scenetree.findObject("NameOfTheObject")
    ObjectToDelete:deleteObject()
    
    In Lua you have to create an object and use the findObject method to assign the desired TSStatic to it. After that you can delete it with the deleteObject method. The problem is that none of our ststic objects has a name so far.

    A second solution could be to load all TSStatic objects into one table and afterwards calculate the distance between the starting point and the objects. And every object which is futher afar than x meters needs to be deleted.

    Code:
    local objNames = scenetree.findClassObjects('TSStatic')
    Furthermore I would recommend to load your extension with the scenario. Currently your loading the modScript (which is loaded for every map) and this is loading the veggie.lua. So every map/scenario is affected by this. Just rename your custom lua to fit your scenario name and put it into the scenarios folder. It will be loaded automatically if it has the same name as the scenario.


    Hope this was kind of helpful.

    Please let me know if you found a proper solution for you.
     

    Attached Files:

  4. Drivver

    Drivver
    Expand Collapse

    Joined:
    May 1, 2015
    Messages:
    233
    Thank you a lot, gonna try figure it out later, when I'll be back from job.
     
  5. meywue

    meywue
    Expand Collapse
    Administrator
    BeamNG Team

    Joined:
    Nov 19, 2015
    Messages:
    339
    Hey,

    does it work for your now?
     
  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