How can I put a countdown in a scene?

  • #1, by strotterFriday, 29. August 2014, 20:48 6 years ago
    Sorry for my english (im spanish), im noob. How can I put a countdown in a scene. I want that one scene must been completed before 30 min. Please explain me all the process. Thanks very much!

    Newbie

    4 Posts


  • #2, by NovelSaturday, 30. August 2014, 11:28 6 years ago
    You need two variables, one for minutes (A), one for seconds (B). A starts with 29 and B starts with 59. Then make a loop in which you decrease the value of B by 1 every second. Use the background text action part in order to display the current values. When B=0, decrease A by 1 and set B back to 59.

    This loops goes on until A=0 and then call whatever action you want to happen.

    Newbie

    100 Posts

  • #3, by afrlmeSaturday, 30. August 2014, 14:57 6 years ago
    There's the method Novel just mentioned but the better method would be to use lua script to control which frames of an animation should be shown, which means that you can get a bit more creative with the visual style of your countdown timer than using the display text action parts.

    I won't go into how to do this though, because it's a lot more complicated than what Novel just told you to do.

    Imperator

    6842 Posts

  • #4, by strotterSaturday, 30. August 2014, 18:04 6 years ago
    pff sorry im very noob, how can i decrease the value of B by 1 every second??

    Newbie

    4 Posts

  • #5, by afrlmeSaturday, 30. August 2014, 19:07 6 years ago
    https://www.dropbox.com/s/ipa63k1twwdlmn3/test_shader.zip?dl=0

    Ignore the filename as it's the .ved I've been using to test out the new shader functions, as well as edit & write my own. You will see when you launch the game that it displays a timer using displayed text (background) above the characters head from 1 minute 30 seconds to 0 & then when it reaches 0 it will display a timer finished message.

    The actions for this are located in the main scene in the at begin of scene actions.

    Imperator

    6842 Posts

  • #6, by latoxineSaturday, 30. August 2014, 19:56 6 years ago
    Mein got ! Interesting folow script ;-)

    The scripts are the only single line on the right part ? Or it refer to those present on the SCRIPT tab ?

    Newbie

    29 Posts

  • #7, by strotterSaturday, 30. August 2014, 20:04 6 years ago
    when I open the . ved appears me this message- "cannot load game. If the file is damaged you have tu use a backup. If the ved was created with visionnaire 2.x you have ..." i convert to visionnaire 3 and i open the .ved but its empty :S

    Newbie

    4 Posts

  • #8, by afrlmeSunday, 31. August 2014, 01:57 6 years ago
    hmm I'm using the latest public build of 4.0.1... so if you aren't on 4.0.1 then I recommend upgrading.

    @ latoxine: what? you can ignore the scripts. They are just different versions of the shader toolkit script. The latest version of the script should be on the wiki.

    Imperator

    6842 Posts

Write post