playMaker

Author Topic: Get Action Event?[SOLVED]  (Read 3020 times)

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 226
Get Action Event?[SOLVED]
« on: June 24, 2017, 10:49:14 AM »
Hey guys, is it currently possible to find out which specific action in a state was the one that triggered a transition event?

I have one state that checks if a whole list of variables has changed and if any of them change i want to fire off the FINISHED event, however in the next state i need to know which specific action triggered the event so that i can know which variable i need to change.

So that when i'm checking 50 variables in one state, i don't also need 50 different transitions :P
« Last Edit: June 29, 2017, 03:20:13 PM by LordHorusNL »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Get Action Event?
« Reply #1 on: June 24, 2017, 09:14:04 PM »
Hi,
you can try with fsm log, you can find it in :

Playmaker/Editor windows. but you can only use this to check manually not to use ingame.

What actions are you using?

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 226
Re: Get Action Event?
« Reply #2 on: June 25, 2017, 06:50:26 AM »
Bool Changed

I need one state with about 30 bool changed actions and one FINISHED transition.

So when one of the bool changed fires en moves to the next state, i need to know which specific action fired the transition event.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Get Action Event?
« Reply #3 on: June 27, 2017, 04:53:17 AM »
Hi,
I made 2 actions you could use

One is the same as the bool changed (Bool Changed Id) but now you can give it an id number and you can store the id result (set this the same variable on all the bool changed actions)
With that number you can know which bool was changed.
If you want to change it to a string instead of an int you can edit the action script, i have added some comments that explains what you need to do.

the 2nd one is a 'bool any true' action but it will also give the element index number.
« Last Edit: June 27, 2017, 05:15:18 AM by djaydino »

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 226
Re: Get Action Event?
« Reply #4 on: June 27, 2017, 10:14:12 AM »
This is just what i need, you are a life saver!

Thank you so much

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 226
Re: Get Action Event?
« Reply #5 on: June 29, 2017, 12:27:08 PM »
Ok so i changed the action you made to ouput a string instead of a int, this works great.

However i just noticed that when using multiple bool changed events in one state, only the last action actually saves the "Store Result" (bool)

The actions above it do not seem to store the result (same for normal bool changed action btw)

Does anybody know how i could get around this?



Edit

Never mind i adjusted the action so i can run multiple versions in the same state.

Problem solved
« Last Edit: June 29, 2017, 03:22:22 PM by LordHorusNL »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Get Action Event?[SOLVED]
« Reply #6 on: June 29, 2017, 06:56:34 PM »
Hi,
 just out of curiosity (and maybe someone else can use it)
What did you change?

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 226
Re: Get Action Event?[SOLVED]
« Reply #7 on: June 29, 2017, 07:19:24 PM »
I have it set up now so that you can have multiple of these actions in the same state and if one of them changes you can continue, extract the name of the action that triggered the transition and loop back to start checking for a bool change again without the bool being reset.

I have one FSM that holds all my variables, and with this i can change any bool and through a loop the FSM sends the info to other FSM's. So i only need to set variables on one FSM during runtime.

Don't know if that makes sense :P But it works for me.
« Last Edit: June 29, 2017, 07:25:34 PM by LordHorusNL »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Get Action Event?[SOLVED]
« Reply #8 on: June 29, 2017, 09:09:15 PM »
Hi,
I made a different one that will get the variable name from the bool variable,
So you do not need to place any name manually.
Also the 'storeResult' bool should work correctly now.

I will place this one on the ecosystem, but i am not sure yet how to name it.

boolChangedVariableName is a bit long, so i think i will use boolChagedName

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 226
Re: Get Action Event?[SOLVED]
« Reply #9 on: June 30, 2017, 10:54:02 AM »
Thanks that would be a bit easier!

If you're going to put it on the ecosystem, it might be a good idea to make the same action for floats also.

Edit: your action still flips the bool back to false like the normal bool changed, mine keeps the value so you can loop back and check for other bool changed events.

Example loop

« Last Edit: June 30, 2017, 11:09:12 AM by LordHorusNL »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Get Action Event?[SOLVED]
« Reply #10 on: June 30, 2017, 09:24:01 PM »
Hi,
You can remove
Code: [Select]
if (storeResult.Value == true) storeResult.Value = false;on line 45
But for Ecosystem i think this is fine.