playMaker

Author Topic: Getting a state's event and source?  (Read 1143 times)

Ioncloud

  • Playmaker Newbie
  • *
  • Posts: 1
Getting a state's event and source?
« on: May 27, 2016, 05:46:11 PM »
I'm trying to figure out if there is a way to get both the source as well as the event that triggered a state?

I'm trying to set up a custom action that can trigger 1...n "sub states" that are denoted by the event that triggers the substate. The child state needs information about the parent state as well as which event was triggered to get there.

I can get the "source" with State.Fsm.PreviousActiveState.ActiveActions but not which event was fired.

What I'm trying to accomplish is something like a level builder, each state has variables for prefabs to make up the walls, floor, and ceiling. When the state is entered, the prefabs are put together and placed in the world. I then have events for "North", "South", "East", "West" that correspond to adjacent tiles. Once the state has built it's object it calls each of the directional states in order to kick off building the next tiles; however, I need to know where the "previous" node was placed as well as what direction the current tile is from the previous in order to offset the next tile appropriately.

« Last Edit: May 27, 2016, 05:51:39 PM by Ioncloud »

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Getting a state's event and source?
« Reply #1 on: May 27, 2016, 07:45:02 PM »
Did you look at the code from the Get Event Info and get event properties actions? They probably have the code you need in them-
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!