playMaker

Author Topic: Copying actions between states [SOLVED]  (Read 1635 times)

paradoxjester

  • Playmaker Newbie
  • *
  • Posts: 12
Copying actions between states [SOLVED]
« on: August 17, 2018, 10:12:14 AM »
Hello!

I have set out to create an editor script that replicates what is contained within an FSM template into what is contained within a PlayMaker FSM component. The end result should be an FSM inside my PlayMaker FSM component that contains all of the states, all of the events, all of the transitions and the variables contained within the Template, but with no actual reference to the Template itself!
I'm having a slight issue. When it comes to copying over States' actions, i'm copying over the whole 'Actions' array, contained within each of my Template's states into each of the corresponding PlayMaker FSM states, which i am copying over. The problem is, because each member of that array is of Class FsmStateAction and not of the more specific inherited subclass, then i cannot specify each action's parameters, or copy it over correctly. If i were to do a shallow copy (just assigning it, or using the array Copy function), then the reference to the template would remain, and any operation made on the action in the template would also affect the action in the PlayMaker FSM component, and viceversa. Is there any way i can copy over the actions contained a state over to the ones contained in another, cutting away any ties that the actions have to their previous state? This is all done via editor script, not at runtime! If anyone has a clue, it would be greatly appreciated! If you need any code examples of the work done up to now i can provide it.

Kind Regards,
Lorenzo
« Last Edit: August 24, 2018, 09:57:45 AM by paradoxjester »

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Copying actions between states
« Reply #1 on: August 18, 2018, 03:54:06 AM »
Wow, sounds like good stuff that would be a game changer. You'd probably need to speak to someone at a higher level, like Lane, Alex or Jean. As for forum members, see if tcmeric can lend a hand.
Available for Playmaker work

paradoxjester

  • Playmaker Newbie
  • *
  • Posts: 12
Re: Copying actions between states
« Reply #2 on: August 24, 2018, 09:57:21 AM »
Hello!

Unfortunately, i was not very thorough in searching for methods, and i realized that simply using
Code: [Select]
FsmState.CopyActionData(FsmState state) will copy the actions with parameters from one state to another, removing the connection between the two ;D. I should have looked better!

Thanks anyways!

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Copying actions between states [SOLVED]
« Reply #3 on: August 30, 2018, 01:50:14 PM »
Great, will we have something to play with soon?  ;D
Available for Playmaker work

Silicon Power

  • Full Member
  • ***
  • Posts: 186
Re: Copying actions between states
« Reply #4 on: April 30, 2022, 10:05:53 AM »
Hello!

Unfortunately, i was not very thorough in searching for methods, and i realized that simply using
Code: [Select]
FsmState.CopyActionData(FsmState state) will copy the actions with parameters from one state to another, removing the connection between the two ;D. I should have looked better!

Thanks anyways!

Hi can you share this action with us?