[English] Create a new CutsceneEvent and pair it with CityScheduleCutsceneEvent(...)

  • In order to create a proper CutsceneEvent for the game, you will need to create a new .lua file in this directory:

    G:\The Guild 2: Renaissance\Scripts\Cutscenes\CutsceneTest.lua

    (In this test, we are going to name the file CutsceneTest.lua)

    Then, in any measure the player has access to, use these calls:

    Code: ms_measure
        CreateCutscene("CutsceneTest", "My_Cutscene")
        CopyAliasToCutscene("", "My_Cutscene", "Sim")
        CutsceneCallScheduled("My_Cutscene", "Start")

    CreateCutscene("CutsceneTest", "My_Cutscene")

    This call declares that a new cutscene is about to be defined.

    • The first parameter of this call must be the name of the new file you created in the folder Cutscenes, without its file extension.
    • The second parameter is a custom label of your choice.

    CopyAliasToCutscene("", "My_Cutscene", "Sim")

    This call allows you to send any Alias to the cutscene event, such as attending Sims or buildings.

    • The first parameter is the Alias of the object you want the cutscene event to remember.
    • The second cutscene should be the second parameter of CreateCutscene()
    • The third parameter should be the new Alias which the cutscene event will remember the object as.

    CutsceneCallScheduled("My_Cutscene", "Start")

    This call is used to run a function within your new Cutscene event file.

    • The first parameter must be the second parameter of CreateCutscene()
    • The second parameter should be the name of a function within your new .lua file in the folder Cutscenes.

    Here is what CutsceneTest.lua could look like:

    Remember CutsceneCallScheduled(...), in our example it calls the function Start() in CutsceneTest.lua. This calls is executed immediately. However, we are using the call CityScheduleCutsceneEvent(...) which requires a bunch of different parameters. This call is important, because it adds the CutsceneEvent to the list of visible Public Appointments in the City Hall of the defined settlement ; and starts whichever function is specified at a given time.

    In the example above, we fetch for the right settlement using the CopiedAlias of the player's Sim, which we then pass to CityScheduleCutsceneEvent(...) ; and we define 10am as the time of the day when the Cutscene Event should begin (as in the function called Begin()) with a 1 hour minimum delay of preparation. The label "TEST" can be any label (preferably as defined in texts.dbt) which appears in the Public Appointments list.

    More advanced scripting can make use of the other parameters of this call, and I would suggest to examine pre-existing .lua files to get inspiration on how to use those.

    Be aware that the cutscene Alias "My_Cutscene" gets replaced by an empty "" once the script goes through your new .lua file (example: EndCutscene("")).