Force Scenario Complete, How Do I Do That?

Discussion in 'General Discussion' started by james37611, Sep 8, 2024.

  1. james37611

    james37611 New Member

    Joined:
    Dec 19, 2021
    Messages:
    11
    Likes Received:
    1
    Hello all,
    Doing a 'timed' scenario however being a Thameslink service there is some very tight running and are likely to be late at a couple of them, however obviously at the end you get a 'scenario incomplete' message, but I don't know how to do this in LUA scripting, I thought it would be a good start to try scripting with this but I cannot find much detail in what I need to do, all I found on the TrainSimLive LUA Blog is ending a scenario early with

    SysCall ( "ScenarioManager:TriggerScenarioComplete", "Scenario completed!" );

    Would that work at the last station of a scenario as well? If so is that all I need or do you need to put Function and some other bits first?? It's the only thing I can find but apparently you can force a scenario to complete irrelevant to how late you are, I just can't find the full details

    any help appreciated!

    James
     
  2. Spikee1975

    Spikee1975 Guest

    Much easier to make it a Career Scenario instead, which completes successfully irrelevant of being late (more realistic). For completion, only arriving at the destination matters. (The rest is handled via score deduction, but not success/fail as in Standard type.)

    A Standard scenario will fail completely if at least one stop is missed by a minute.

    If you want the score hunters to still get their points, reward each timed instruction with more than (1000/number of instructions) score to compensate for being forcibly late, or set Late deduction points to zero. Or set a start score >0, there's many ways to do it.
     
    Last edited by a moderator: Sep 8, 2024
  3. james37611

    james37611 New Member

    Joined:
    Dec 19, 2021
    Messages:
    11
    Likes Received:
    1
    Oh I didn't know that, thank you

    But I assume there's a way in standard too? I'd like my scenario packs to be standard, and I've already created one now that one is completed and works, I just need to sort making the scenario end as completed, or do I need re-write it as a career one to achieve this?
     
  4. Spikee1975

    Spikee1975 Guest

    Many do not know this :)

    There should be. Just trigger that event on the final station (if that doesn't work, add a StopAt instruction after the final PickUp and trigger it there.)

    KTL_Rob Powell could help you there, he said he's been using that method on some of his scenarios.
     
    Last edited by a moderator: Sep 8, 2024
  5. james37611

    james37611 New Member

    Joined:
    Dec 19, 2021
    Messages:
    11
    Likes Received:
    1
    Ohh so you don't need an LUA script just add that SysCall line into the scenario trigger even box at the last station call?
     
  6. Spikee1975

    Spikee1975 Guest

    Yes you need a ScenarioScript.lua to call these functions. It's no rocket science. Paste this into a texteditor and save as "ScenarioScript.lua" in your scenario's folder.

    Code:
    function OnEvent ( event )
    
        if event == "MyForceEnd" then     
                 
            SysCall ( "ScenarioManager:TriggerScenarioComplete", "Scenario completed!" );
             
            return TRUE;
        end
    
    end
    
    Then call MyForceEnd from the scenario in the instruction trigger field for example.
     
    • Helpful Helpful x 2

Share This Page