playMaker

Author Topic: Send Event to another FSM + a Value  (Read 901 times)

PET

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • GamerPET
Send Event to another FSM + a Value
« on: September 21, 2017, 05:19:54 AM »
Hello there!

I'm having a coin, that when it's colliding with the Player, I want to send an event to the player FSM to "gain some coin". However, I also want to send a value (an INT) to that PlayerFSM.

Is something like this possible with playmaker?

Basically each of my coins can have a different INT. When I collide with that coin, that INT value has to be sent to my main Player FSM so I can do some "currentCoins + receivedCoin".

Thanks <3
Technical Game Designer
www.GamerPET.com

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4818
    • View Profile
    • jinxtergames
Re: Send Event to another FSM + a Value
« Reply #1 on: September 21, 2017, 05:52:13 AM »
Hi,
normally you need to do this :
"Get FSM Int" then "Int Add" then "Set Fsm Int"

But there are actions on the Ecosystem that can do that at once
look for 'Add to Fsm Int'

You can use this directly to the receivedCoin
or to the currentCoins depending on your needs.
then send the event.

or maybe you could use "int changed" on the CurrentCoins and use "Set Fsm int" on the currentCoins it will then trigger the int changed and you can do you currentCoins + receivedCoin. after that you need to set the value from currentCoins back to zero. then you can go back to the state with the "int changed" action.
You might need to use a next frame event before going back to that state after setting to zero.
This way there is no send event needed.