Login / Registrieren
DE EN FR ES IT CZ
Zurück Nach oben

Change to previous scene

  • #1, by Mikael 11 years ago Zitieren
    Is there a LUA script, or any other method, for going back to the previous scene?

    Thanks in advance!
  • #2, by afrlme 11 years ago Zitieren
    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.
  • #3, by Mikael 11 years ago Zitieren
    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.
  • #4, by afrlme 11 years ago Zitieren
    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
    


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


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


    This tutorial / code is written off the top of my head, so I can't guarantee it will work.
  • #5, by Mikael 11 years ago Zitieren
    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.
  • #6, by afrlme 11 years ago Zitieren
    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.
  • #7, by Mikael 11 years ago Zitieren
    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.
  • #8, by afrlme 11 years ago Zitieren
    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.
  • #9, by Mikael 11 years ago Zitieren
    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!
  • #10, by afrlme 11 years ago Zitieren
    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.
  • #11, by Mikael 11 years ago Zitieren
    Wintermute scales up lower resolutions to the user's desktop resolution perfectly, but can not scale down.