Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: PET on September 21, 2017, 08:19:54 AM

Title: Send Event to another FSM + a Value
Post by: PET on September 21, 2017, 08: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
Title: Re: Send Event to another FSM + a Value
Post by: djaydino on September 21, 2017, 08: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 (https://hutonggames.fogbugz.com/default.asp?W1181) 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.