playMaker

Author Topic: [SOLVED] adding time to timer ?  (Read 4255 times)

Thyriax

  • Playmaker Newbie
  • *
  • Posts: 25
    • Torii games
[SOLVED] adding time to timer ?
« on: July 06, 2015, 04:06:36 AM »
hi !
Let's me explain my problem.
i want to add a saving float to the timer at the beginning of level, and let's timer go from this float.
This saving float is a float from a saving game.
But when the level is loaded, the timer don't add the saving float and start to 0.
I've try to add some float within game from another fsm, but didn't work. The timer go as usual.

or more simply, how can i add float to a timer?
Thanks for your help
« Last Edit: July 06, 2015, 08:50:38 AM by Thyriax »

DarkSoul

  • Playmaker Newbie
  • *
  • Posts: 37
Re: adding time to timer ?
« Reply #1 on: July 06, 2015, 04:37:41 AM »
Hello,

If you have EasySave you can do this easily by saving  at end for your level , and loadin that value at the start and adding from there .

However your problem is you are not saving you variable to an external file to load back , because unity start everything from there default value unless they got loaded .

There is a lot of ways to save to external file (google it)
If you dont have EasySave , you can do this using xml , but I am not experienced as much in xml sorry.

I hope this helps.

Thyriax

  • Playmaker Newbie
  • *
  • Posts: 25
    • Torii games
Re: adding time to timer ?
« Reply #2 on: July 06, 2015, 04:51:18 AM »
Hi DarkSoul , thanks for reply.
Yes, i use EasySave. And yes, i use it for saving the float at end of level (witch is global time for all levels).
But my problem is a bit more complicated (for me).
This famous "saving float" is a tempory time that i want to add at the beginning of level. This "saving float" is save with EasySave too.
For exemple, you start a new game, you play for 30 seconds, save and quit game.
When you load your game, the timer must start at 30 seconds and not 0. 

The "saving float" is loaded correctly (i see it in inspector)

I hope that i was clear with my explanations .

Thanks !
« Last Edit: July 06, 2015, 05:01:38 AM by Thyriax »

DarkSoul

  • Playmaker Newbie
  • *
  • Posts: 37
Re: adding time to timer ?
« Reply #3 on: July 06, 2015, 07:34:06 AM »

Then it should work correctly ,
Can you post pictures of the fsm you are using.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 6474
    • jinxtergames
Re: adding time to timer ?
« Reply #4 on: July 06, 2015, 07:57:01 AM »
Hi,
if you need to count down the time you can use a custom action i made a while ago,

Countdown Timer you can also find this on the EcoSystem

if count up : get current time in a variable then use float operator current time + saved time and save in a different variable, and set every frame.
Ecosystem might not work at the moment
here are direct Github Links to the custom actions :
https://github.com/PlayMakerEcosystem
https://github.com/jeanfabre


Join the PlayMaker Discord Channel!

Thyriax

  • Playmaker Newbie
  • *
  • Posts: 25
    • Torii games
Re: adding time to timer ?
« Reply #5 on: July 06, 2015, 08:19:57 AM »
Hi Dino, thanks for reply!

It's a count up (classic timer), but as i say, i've already done this and "add float" action (or float operator) didn't work. Well, in fact, it's work to add float, but when the action "Get Time Info" start, it's put the timer to 0, whichever "get info" i use.

here a screenshot of FSM

Thanks for your time

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 6474
    • jinxtergames
Re: adding time to timer ?
« Reply #6 on: July 06, 2015, 08:36:29 AM »
you should change the "float add" into "float operator" and set float 1 "time level temp" and float 2 "time level" (or the other way around)

make a new variable "time total" (or any other name) and set it as store result.

use "time total" in your "seconds to string"
Ecosystem might not work at the moment
here are direct Github Links to the custom actions :
https://github.com/PlayMakerEcosystem
https://github.com/jeanfabre


Join the PlayMaker Discord Channel!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 6474
    • jinxtergames
Re: adding time to timer ?
« Reply #7 on: July 06, 2015, 08:37:40 AM »
ow and don't forget to set every frame on :)
Ecosystem might not work at the moment
here are direct Github Links to the custom actions :
https://github.com/PlayMakerEcosystem
https://github.com/jeanfabre


Join the PlayMaker Discord Channel!

Thyriax

  • Playmaker Newbie
  • *
  • Posts: 25
    • Torii games
Re: adding time to timer ?
« Reply #8 on: July 06, 2015, 08:49:49 AM »
Hi Dino !

it's works now !!! 

Thank you so much !!!