change scene with luo script

  • #1, by petertermanhansenSaturday, 21. August, 15:51 A month ago
    hi

    I have seen here how to change scene with luo-script.
    But I dont get my character with me. In the editor I would give a position, to place my character, but with the luo game.scene command the is no object, to place the character.
    How to do that?

    regards Peter

    Newbie

    57 Posts


  • #2, by afrlmeSaturday, 21. August, 17:58 A month ago
    It would require multiple lines of code to do that with Lua script.

    1. you need to specify the scene you want to change the current scene to.
    2. you need to specify which scene the character is on.
    3. you need to specify the position you want the character to be placed at in the new scene.
    4. you need to specify the alignment for the character.

    definition script:
    function changeScene(scn, obj)
    game.CurrentScene = Scenes[scn]
    game.CurrentCharacter.Scene = Scenes[scn]
    game.CurrentCharacter.Position = Scenes[scn].Objects[obj].Position
    game.CurrentCharacter.Direction = Scenes[scn].Objects[obj].Direction
    end
    1
    2
    3
    4
    5
    6


    usage:
    changeScene("insert scene name here", "insert object name here")
    1

    Imperator

    7005 Posts

  • #3, by petertermanhansenSaturday, 21. August, 20:38 A month ago
    Thanks - works perfect.

    Newbie

    57 Posts

Write post