Change to previous scene

  • #1, by MikaelSaturday, 31. January 2015, 18:33 6 years ago
    Is there a LUA script, or any other method, for going back to the previous scene?

    Thanks in advance!

    Newbie

    15 Posts


  • #2, by afrlmeSaturday, 31. January 2015, 19:13 6 years ago
    You mean to change back from menu to current scene the playable character is on?

    If that's what you mean then just use the change to scene of character action part & select current character from the drop down list.

    Imperator

    6846 Posts

  • #3, by MikaelSaturday, 31. January 2015, 19:34 6 years ago
    Thank you AFRL.

    However, what I actually meant was to switch back to the previous scene from whichever scene you happen to be in (not from the menu, that is). The other adventure game engines I've tried have had this function, and I've grown used to it.

    For example, I usually create a specific scene for each inventory item, which is displayed when the player examines the item. Since examining the items can be done from practically every scene, it is important that the player can go back to the scene that he or she was in before the item was examined.

    Newbie

    15 Posts

  • #4, by afrlmeSaturday, 31. January 2015, 20:39 6 years ago
    Ah ok got you.

    Here you go.

    1. create a value (anywhere you like) & name it: previous_scene.

    2. now add the script below to the script section of the editor.
    function saveScene()
    Values["previous_scene"].String = game.CurrentScene:getName()
    end

    function restoreScene()
    game.CurrentScene = Scenes[Values["previous_scene"]]
    end
    1
    2
    3
    4
    5
    6
    7
    8


    3. to save scene add an execute a script action part just before changing to new scene containing...
    saveScene()
    1
    2


    4. to restore scene add an execute a script action part containing...
    restoreScene()
    1
    2


    This tutorial / code is written off the top of my head, so I can't guarantee it will work.

    Imperator

    6846 Posts

  • #5, by MikaelSaturday, 31. January 2015, 22:42 6 years ago
    Thank you very much. I'm afraid that I'm totally new at this scripting thing. How are the scripts supposed to look like exactly?

    In your step 3, what is supposed to happen is a scene change, executed by a right click (plus the saveScene command of course).

    Step 4 is supposed to simply restore the previous scene, executed by a left click.

    Sorry for being so ignorant, but I can't find any information on how to script a simple scene change.

    Newbie

    15 Posts

  • #6, by afrlmeSaturday, 31. January 2015, 23:07 6 years ago
    Let's see...

    2. script tab > create a new script & copy/paste the script I provided.

    3. just before you execute your scene change (with one of the scene change action parts - not scripting), create an execute a script action part & add what I mentioned in step 3.

    4. create an execute a script action part containing what I mentioned in step 4, in the place, button or whatever it is that triggers scene back.

    In theory it should work correctly. Why is it that you can't manually determine which scene to go back to? More or less the same amount of work involved either way.

    Imperator

    6846 Posts

  • #7, by MikaelSaturday, 31. January 2015, 23:51 6 years ago
    Yes! It works! Thanks a million!

    Why I can't manually determine which scene to go back to? I'll try to explain why:

    My games are made up entirely by photographs. My last game contained over 1,900 scenes. My next game, for which I contemplate using Visionaire, will probably be just as big. Each inventory item can be examined in close up, which leads to a new scene (there may be a better way to this with Visionaire, but that's the way I've made it this far). Each inventory item can be examined from virtually any of these 1,900 scenes.

    So, upon exiting the scenes for the close up of the various inventory items, there as to be a way to go back to the scene which the player was in prior to changing to the scene for the close up.

    Newbie

    15 Posts

  • #8, by afrlmeSunday, 01. February 2015, 00:30 6 years ago
    Ok dokie. smile

    VS was really made with classical third person point & click games in mind, which is why I assume there is no previous scene action, function or field in the data structure.

    Can't complain really I suppose... The script I wrote was a quick & short workaround to the lack of a pre-made action / function.

    Imperator

    6846 Posts

  • #9, by MikaelSunday, 01. February 2015, 00:59 6 years ago
    I'm using The Wintermute Engine at the moment, which was also made with third person games in mind. With Wintermute, as with Visionaire, there are features that aren't especially suitable for first person games, like connecting this and that to a "fictional" character.

    Still, both Wintermute and (what I've seen this far of) Visionaire are superior to the engines made with first person games in mind.

    What I lack with Wintermute is the ability to scale down the game resolution to the user's screen

    Thanks again for your help!

    Newbie

    15 Posts

  • #10, by afrlmeSunday, 01. February 2015, 01:28 6 years ago
    Really? I thought wintermute also had automatic scaling? Then again I've only played one or two games made in wintermute & that was a fair while back.

    Imperator

    6846 Posts

  • #11, by MikaelSunday, 01. February 2015, 03:24 6 years ago
    Wintermute scales up lower resolutions to the user's desktop resolution perfectly, but can not scale down.

    Newbie

    15 Posts

Write post