Undo condition

  • #1, z elecWednesday, 07. June 2017, 13:37 hodinky 7 years ago
    Hey, its me again.
    So i wanted to ask if theres a possibility of undo-ing all conditions and values without changing every single one. When you finish the game and get back to the start menu and then start the game again it starts with all conditions and outfits of the last playthrough.
    Last Problem till finishing the game i swear haha

    Fanoušek fóra

    109 Posts


  • #2, z afrlmeWednesday, 07. June 2017, 14:24 hodinky 7 years ago
    There's multiple methods you can use for resetting all the data.

    1. manually, but as you said. That will take way too long.

    2. using the quicksave/autosave system. You need to create an autosave at the beginning of the game or after pressing the new game button during the initial scene or something. You need to wrap it inside of an if query like so...

    if autosave #1 exists
    else
     pause 500ms
     execute autosave #1
    end if


    Something along the lines of that.

    3. You can use the replaceGame() Lua function which will essentially restart the game from the beginning like how you used to be able to do on sega/snes games etc by holding down x buttons together on the gamepad.
    replaceGame("data.vis") -- replace data.vis with whatever you called the exported vis file when you compiled your game

    I think option 3 is only valid for exported games. I'm not sure if you can reload ved file from the editor. I think it's vis files only.

    Imperátor

    7285 Posts

  • #3, z MachtnixWednesday, 07. June 2017, 14:52 hodinky 7 years ago
    I need a reset too. Example Nr. 3 looks good. What happens if I build a reset button into the game with this Lua code line? I have to reset more than 50 values to zero and to make 25 objects visible. 

    Kapitán

    1097 Posts

  • #4, z MachtnixWednesday, 07. June 2017, 14:54 hodinky 7 years ago
    It's 4.25. 

    Kapitán

    1097 Posts

  • #5, z MachtnixWednesday, 07. June 2017, 15:15 hodinky 7 years ago
    Oh, shit, this autosave-thing works great! Trying 2 weeks with Lua was pointless. Thanks AFRLme for this stupid simple solution I never have had in my mind smile

    I hope it's possible on every pc, because you need to write into an user folder, mostly C:/eigene Dateien or s.th like that. 

    Kapitán

    1097 Posts

  • #6, z afrlmeWednesday, 07. June 2017, 15:47 hodinky 7 years ago
    replaceGame() is available since 4.1 or 4.2 I think. It basically reloads the main vis file. Think of it like pressing reset button on a playstation or something.

    Imperátor

    7285 Posts