Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: sachaMagne on April 12, 2013, 06:49:39 AM

Title: [SOLVED] doing action after a certain time spent in a state ?
Post by: sachaMagne on April 12, 2013, 06:49:39 AM
Hi,
I would like to implement this behaviour with Playmaker but can't find the "proper playmaker" logic to do it:

I got a char. that got different states :running,walking and idle.  I got the char. status through boolean and getting them is not a problem.

My issue is more a "playmaker logic" one:
 I want to regenerate its energy after staying xx seconds in idle mode.

I tried actions timed based but ran into infinite loop at best...

I can't figure any functional and clean way to implement this basic system so far...

Any help would be appreciated !

Thanks
Title: Re: doing action after a certain time spent in a state ?
Post by: ciabaros on April 13, 2013, 12:14:18 PM
Here's the general idea; I'm assuming a new FSM just to keep this solution isolated from the rest of your unknown setup:

Below, I assume that you have access to that character-idle boolean, and I refer to it as "[char-idle]", whatever it is.


This should do it, if implemented correctly.

Additional Note:
The reason you cannot use "Wait" anywhere in this solution, is because during that wait period, the character could leave and re-enter Idle mode and you would never know, giving the sneaky bastard a regen, when not deserved :)
Title: Re: doing action after a certain time spent in a state ?
Post by: sachaMagne on April 15, 2013, 02:53:52 AM
Thanks for your explanation. It helps a lot. I found my first real problem was trying to do it in 3 states. I guess i should start thinking "atomic"...

thanks anyway, it works great.