playMaker

Author Topic: Get array next “object” problem. [SOLVED]  (Read 2064 times)

agito1987

  • Playmaker Newbie
  • *
  • Posts: 37
Get array next “object” problem. [SOLVED]
« on: October 18, 2016, 12:13:22 PM »
Hey

In my game I use a weapon fire mode that can penetrate objects.
First it could penetrate everything and it worked just fine.

Now I added that it cannot shoot through everything but I can’t get it to work.
I fire raycast all to get all the objects hit on the way and all the hit positions.
By checking the Tag of the objects I want to cut off the array next by branching off and not repeating the loop and emptying the created arrays.

The First shot works just fine. However, the second shot gets stuck on “Get Next Object”.
My problem now is that I don’t understand how this can happen. Because the player always hits an object that cannot be penetrated (Ground, or objects that cannot be penetrated.)



Also The array is not empty =/

Hope someone can help me out with this.
« Last Edit: October 19, 2016, 05:57:43 AM by agito1987 »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Get array next “object” problem.
« Reply #1 on: October 18, 2016, 02:40:07 PM »
Hi,
'Array get next' wants to loop till finished, there is a custom action called 'array get next 2' on the Ecosystem.
It has a 'reset flag'.

What this does is each time it loops thru the action it will check if it is set to true.
If false it will continue looping,
But if it is true it will set it to false and it will reset the loop.
So it will start again from the Start Index.

So on the 'reset flag', add a bool variable,
Then somewhere after the loop set the variable to true.

For the array not empty i can not see the actions you used

agito1987

  • Playmaker Newbie
  • *
  • Posts: 37
Re: Get array next “object” problem.
« Reply #2 on: October 19, 2016, 05:56:24 AM »
Thank you!  ;D

Array get next 2 works great, I came across this action before but didn’t really get how to use the reset flag option.

I was trying to achieve the same thing by clearing the array and resetting it to zero. However the basic get array next still wants to continue.

Everything works just perfect now.

( Had one little plroblem with Get array next 2:
I first used it for an array with objects. When I wanted to set the second array get next 2 it didn’t see my vector 3 array.
I solved this by creating new variable, changed the value from object to vector 3. Now the array get next 2 saw my vector 3 arrays.)