skipping a single scene after 5 sectons or two scenes by clicking

  • #1, z andrea_visTuesday, 07. March 2023, 15:10 hodinky A year ago
    I would like to (1) skip a scene after 5 seconds AND (2) skip two scenes by left-clicking. 

    To achieve the first objective, I did the following:
    - Scene 1: "Pause for 5 seconds | Switch to scene 'scene 2' " (at the beginning of the scene)
    - Scene 2: "Pause for 5 seconds | Switch to scene 'scene 3' " (at the beginning of the scene) 
    - Scene 3: this is my landing scene

    To achieve the second objective, I used a traditional click action in both scene 1 and 2, i.e., I set a "Left click" action that switches to scene 3.

    It seems that the 'at the beginning of the scene' actions are still in execution even after switching to scene 3 by clicking so that if I click in scene 1, I am brought to scene 3 (which is OK), and, after 5 seconds, I am brought back to scene 2 (which is not OK). How can I circumvent this whithout scripting?  

    Bažant

    11 Posts


  • #2, z afrlmeWednesday, 08. March 2023, 00:31 hodinky A year ago
    Um, you are trying to do what & what now?

    At begin of scene actions are called whenever a scene is initially shown unless you wrap them in some kind of if query to prevent them from being executed. Also just because you swap to a new scene before it executes whatever is in the at begin of scene actions - or any action for that matter - doesn't meant that the rest of the actions will be automatically terminated.

    To sum it up, you are still showing the scenes & then adding a 5 second pause which is then executing the action part(s) listed after it when the 5 seconds is up. To work around that you need to wrap the change/show scene action inside of an if query. You could do something like this...


    1. pause for 5000ms

    2. if lua result action part >

    return game.CurrentScene == Scenes["whatever the name of the scene is called"]

    3. followed by the change/show scene action part & any other action parts you want to execute.

    4. end if

    & that should stop it from executing the action part if the scene is not that one. Also names when scripting are case sensitive, so take that into consideration.

    Imperátor

    7285 Posts

  • #3, z andrea_visThursday, 09. March 2023, 15:32 hodinky A year ago
    I found an alternative solution, although less elegant than yours.
    The idea is placing the 'change scene' action at the very last frame of an empty animation. In doing this, the 'at the beginning of the scene' problem is avoided. 

    By the way, thank for your help and kindness!

    Bažant

    11 Posts