playMaker

Author Topic: [SOLVED]How do you make a timer stop?  (Read 7341 times)

MrMitch

  • Full Member
  • ***
  • Posts: 131
    • Rage Quit Games - Coming Soon
[SOLVED]How do you make a timer stop?
« on: April 05, 2012, 08:32:26 PM »
Hi

I'm trying to figure out a way to make a timer stop when an object enters a trigger and then display the time that it has been stopped at on perhaps a GUI.

I have attached a picture of how my timer is set up but i'm not sure how to approach the rest.

Any help would be greatly appreciated :)
« Last Edit: May 02, 2012, 03:25:56 PM by MrMitch »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: How do you make a timer stop?
« Reply #1 on: April 06, 2012, 07:13:37 PM »
It seems like you need an Idle start state that waits for a COLLISION ENTER event to transition to the Display Timer state (what you have now). Do you know the basics, e.g., how to make a transition? If not, check out the getting started tutorials on our YouTube or Screencast channels.

MrMitch

  • Full Member
  • ***
  • Posts: 131
    • Rage Quit Games - Coming Soon
Re: How do you make a timer stop?
« Reply #2 on: April 09, 2012, 10:20:28 AM »
I was fortunate enough to be part of the playmaker beta and i must say it has doubled in size since then which is very nice to see and makes me feel even more positive about my investment :) Although it has been months since i last worked with unity or playmaker.

I watched through the first 9 tutorials on youtube and will most likely watch the rest while i wait for a reply and try my best to figure it out, so far i've managed to get myself as far as setting up a trigger event as seen in the attachment. From here i'm unsure how to continue as from my research months ago i remember that there is no real way to stop the type of timer i'm trying to set up and that you have to capture the time displayed at the desired moment i could be wrong and perhaps misread.

santelia

  • Junior Playmaker
  • **
  • Posts: 78
Re: How do you make a timer stop?
« Reply #3 on: April 09, 2012, 12:37:47 PM »
I'm rather new here, but I'd suggest you to deal with "int compare" or "float compare" or "string compare" actions, depending on how your timer variables are formatted. Thus you can address events depending on the result (less than, equal,  greater than). And of course with the states nesting possibilities of PlayMaker, there're virtual no limits to the complexity of the time management you can build up, only your time and swear...

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: How do you make a timer stop?
« Reply #4 on: April 11, 2012, 03:35:44 PM »
Perhaps you're looking for the Get Time Info action:
https://hutonggames.fogbugz.com/default.asp?W496

Store the result in a float variable and use Float Compare to trigger events:
https://hutonggames.fogbugz.com/default.asp?W80

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: How do you make a timer stop?
« Reply #5 on: April 15, 2012, 12:04:03 AM »
Did you get this working?

MrMitch

  • Full Member
  • ***
  • Posts: 131
    • Rage Quit Games - Coming Soon
Re: How do you make a timer stop?
« Reply #6 on: April 26, 2012, 02:33:39 PM »
I've been busy over the past couple of weeks and have finally managed to get a chance to start working on playmaker again.

Thanks for the replies, from the quick look i've had this should point me in the direction, just gotta figure out how to set it up :)

I will reply back with how i get on or if i get stuck :P

MrMitch

  • Full Member
  • ***
  • Posts: 131
    • Rage Quit Games - Coming Soon
Re: How do you make a timer stop?
« Reply #7 on: May 02, 2012, 01:37:20 PM »
So after a few days of trying different things out and getting confused i'm here to ask for some help, i basically need this explained to me as i just can't seem to grasp the logic behind it >.<

Ok so what i'm trying to achieve is to have a timer count upwards from level load, once the player enters a trigger at the end of the level, have the timer stop and display the time it took them to reach the end <-- i already wrote this in my original post but i just wanted to make it clear.

In the first picture the 'global' variable is taken from the timer FSM attached to my main GUI Text, i have set up a second GUI Text to display the time when the trigger is entered.

Any help would be greatly apprecaited.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: How do you make a timer stop?
« Reply #8 on: May 02, 2012, 01:55:40 PM »
The actions in the Time Handler state are never run since they're not connected by any transition.

Copy the actions from Time Handler, and put them in the Active state and it should work.

MrMitch

  • Full Member
  • ***
  • Posts: 131
    • Rage Quit Games - Coming Soon
Re: How do you make a timer stop?
« Reply #9 on: May 02, 2012, 03:24:49 PM »
Thank you, it works just as i wanted, the Time Handler state not being apart of the process makes sense now but i thought the timer part would be more complicated but i think i understand what's going on 'behind the scenes' now

Now it's time to expand, thanks again :)