Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Thyriax on July 06, 2015, 04:06:36 AM

Title: [SOLVED] adding time to timer ?
Post by: Thyriax 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
Title: Re: adding time to timer ?
Post by: DarkSoul 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.
Title: Re: adding time to timer ?
Post by: Thyriax 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 !
Title: Re: adding time to timer ?
Post by: DarkSoul on July 06, 2015, 07:34:06 AM

Then it should work correctly ,
Can you post pictures of the fsm you are using.
Title: Re: adding time to timer ?
Post by: djaydino 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 (http://hutonggames.com/playmakerforum/index.php?topic=8831.msg42251#msg42251) you can also find this on the EcoSystem (https://hutonggames.fogbugz.com/default.asp?W1181)

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.
Title: Re: adding time to timer ?
Post by: Thyriax 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
Title: Re: adding time to timer ?
Post by: djaydino 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"
Title: Re: adding time to timer ?
Post by: djaydino on July 06, 2015, 08:37:40 AM
ow and don't forget to set every frame on :)
Title: Re: adding time to timer ?
Post by: Thyriax on July 06, 2015, 08:49:49 AM
Hi Dino !

it's works now !!! 

Thank you so much !!!