Quick Drive And Lua Scenario Script

Discussion in 'Creation Centre' started by BAHNJAN, Dec 6, 2023.

  1. BAHNJAN

    BAHNJAN New Member

    Joined:
    Dec 9, 2016
    Messages:
    6
    Likes Received:
    0
    Hi,
    I want to run a script in a QD. So I have placed a train on an unused siding in the scenario and specified the same track as the destination for this train. In this way, I can open the timetable editor and access the scenario part. I compiled my scenario script (LUAC and MD5) and hoped that it would work. There are triggers in the track that send a message to the scenario script. The triggers do this using SysCall("ScenarioManager:TriggerDeferredEvent" (which works perfectly in timetable scenarios), but the scenario script remains silent in the QD scenario. Does anyone have any ideas?
    Thanks, Jan
     
  2. Spikee1975

    Spikee1975 Guest

    Please post a screenshot of the editor with the timetable of that train opened.

    I might be wrong, but I don't think adding a normal timetable to a train will work in QD, as it has fixed timings and would need a starting time, which doesn't exist in a QD template.
     
  3. BAHNJAN

    BAHNJAN New Member

    Joined:
    Dec 9, 2016
    Messages:
    6
    Likes Received:
    0
    [​IMG]
    That's not my real problem. This train moves a few metres when the Quicktime happens to take place at 12:00. Otherwise it stands there and waits for 12:00. The train was only set so that I can access the timetable tool to activate a scenaroscript. My problem is the scenario script, which apparently doesn't do it and I don't know why.
     
  4. Maik Goltz

    Maik Goltz Well-Known Member

    Joined:
    Dec 9, 2016
    Messages:
    1,120
    Likes Received:
    5,082
    QuickDrive scenarios are generated from a template every time a user starts one. Putting in a script into the template will not copy it over to the generated scenario folder ( that gets deleted with the next start of TS or with a new QD run).
     
  5. BAHNJAN

    BAHNJAN New Member

    Joined:
    Dec 9, 2016
    Messages:
    6
    Likes Received:
    0
    Thank you Maik for this sad but understandable answer. What doesn't work, just doesn't work.
     
  6. Spikee1975

    Spikee1975 Guest

    There could be a way though - just like SAD or Armstrong Powerhouse use special track-linked trigger assets for weather change - so your script is tied to an asset not to a timetable.

    You could modify such an existing asset to your needs (directing to your script in an asset folder) and put it in your QD template. If your train passes such a trigger a script will be executed.

    Example (Brennitzer Linienstern):
    2023-12-06 17_10_47-Train Simulator (x64).png

    This is an asset of class "ScriptableSceneryBlueprint", which just needs the <ScriptComponent> pointing to your script. You can set up your script that it accepts parameters given in the object properties flyout (here: WEATHER_RAINBOW)

    2023-12-06 17_14_37-.png
     
    Last edited by a moderator: Dec 6, 2023
  7. BAHNJAN

    BAHNJAN New Member

    Joined:
    Dec 9, 2016
    Messages:
    6
    Likes Received:
    0
    Thank you very much, but that doesn't help. Firstly, this blueprint is not bound to the track. So I can't tell the script a parameter such as the station name. So I would have to create a separate trigger for each station. Bollocks :)
    I have another idea in mind: Is there a value that a script can use to recognise that the current scenario is a QD scenario? I have triggers in the track that are of no use at the moment because I can't give the QD a scenario script. But if there is a constant that I could evaluate in the track trigger and that tells it that it is a QD, I would be a huge step further.
     
  8. Johnno124

    Johnno124 Active Member

    Joined:
    Dec 8, 2016
    Messages:
    238
    Likes Received:
    226
    Kim Olesen may be able to provide some assistance here, He has made some really advance quick drives that use scripts i believe.
     
  9. Spikee1975

    Spikee1975 Guest

    This IS a track linked trigger, it's just not visible in the shot because the flyout is active, and is the only way you can achieve what you want. It's not that hard creating these and placing these at each station in your QD template, but I don't know exactly what you want to do.

    A QD scenario is actually a Standard scenario that gets created and saved in the route folder when you hit the Play button.
     
    Last edited by a moderator: Dec 7, 2023
  10. Kim Olesen

    Kim Olesen Well-Known Member

    Joined:
    Jun 21, 2018
    Messages:
    747
    Likes Received:
    600
    My Real Drives actually does not use any scripts. They use invisible trains to trigger random red signalling in the path of the player train.
     

Share This Page