playMaker

Author Topic: Using the Foreach Array action  (Read 2016 times)

blackant

  • Hero Member
  • *****
  • Posts: 521
  • http://blackantmaster.com
    • blackantmaster.com
Using the Foreach Array action
« on: April 28, 2019, 04:09:41 PM »
Hello,

this is the first time i'm using this action "Array For Each",
i understand the princip but it doesn't work like i espect (it doesn't work at all..)


so i have a character, wich if i click on it, is added to an array, after that, if i click anywhere on the ground, the character must go at the position.
so for each character from the array it would repeat the task.

but for now, with only one character selected and in the arraylist, it doesn't do anything...

the only things i'm asking to the FSM is to set the position vector3 and send event to the gameobject. nothing more...

but the state is still stuck this for each step and will never finish.
but it can finish with an array lenght of 0.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Using the Foreach Array action
« Reply #1 on: April 29, 2019, 05:08:31 PM »
Does the FSM you're running finish? It needs to use the Finish FSM action to tell the caller that it's finished and to move to the next item in the array.

blackant

  • Hero Member
  • *****
  • Posts: 521
  • http://blackantmaster.com
    • blackantmaster.com
Re: Using the Foreach Array action
« Reply #2 on: April 29, 2019, 06:19:05 PM »
i replaced the action by "Get Next" array but i'll check tomorow to understand how it works.

thanks

blackant

  • Hero Member
  • *****
  • Posts: 521
  • http://blackantmaster.com
    • blackantmaster.com
Re: Using the Foreach Array action
« Reply #3 on: April 30, 2019, 01:02:40 PM »
it works, but the trap is that it is marked as an Error.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Using the Foreach Array action
« Reply #4 on: April 30, 2019, 07:29:26 PM »
I think that error is that you don't have a transition state from the FINISHED event. It looks like you can just delete the FINISHED event if it's not used.

Are you using a Finish FSM action?


blackant

  • Hero Member
  • *****
  • Posts: 521
  • http://blackantmaster.com
    • blackantmaster.com
Re: Using the Foreach Array action
« Reply #5 on: May 01, 2019, 01:25:25 AM »
haaa, ok, i didn't know that there was a finish action.
ok i understand  know