playMaker

Author Topic: Array List Get Next Closest Game Object Action[SOLVED]  (Read 1599 times)

Athin

  • Full Member
  • ***
  • Posts: 163
Array List Get Next Closest Game Object Action[SOLVED]
« on: April 05, 2019, 09:10:59 PM »
Hey guys,

I'm making an RTS style project featuring large armies.  When I got two armies fighting each other, that initial clash tends to be both sides focusing down 1 guy (The one that triggers the fight) before spreading out to different targets. 

I'm hoping this action can find the closest target and have a Loop event into a new state.  At that state, I can check if the current target is engaged and then loop back to find the second closest unit if needed.

Not sure if there is something out there already for this but I couldn't seem to find anything.

Thanks
« Last Edit: April 08, 2019, 01:57:21 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Array List Get Next Closest Game Object Action
« Reply #1 on: April 08, 2019, 01:57:12 AM »
Hi,

 What you need is to maintain a list of them objects in a sorted list, so you can pick the nth closest object.

there is an action for this ArrayListSortGameObjectByDistance

Bye,

 Jean

Athin

  • Full Member
  • ***
  • Posts: 163
Re: Array List Get Next Closest Game Object Action[SOLVED]
« Reply #2 on: April 08, 2019, 07:56:23 PM »
Hey there

Awesome, didn't know about that action.  That will work perfectly for me

Thanks