playMaker

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

Athin

  • Full Member
  • ***
  • Posts: 120
    • View Profile
Array List Get Next Closest Game Object Action[SOLVED]
« on: April 05, 2019, 06: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 07, 2019, 10:57:21 PM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14703
  • Official Playmaker Support
    • View Profile
Re: Array List Get Next Closest Game Object Action
« Reply #1 on: April 07, 2019, 10:57:12 PM »
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: 120
    • View Profile
Re: Array List Get Next Closest Game Object Action[SOLVED]
« Reply #2 on: April 08, 2019, 04:56:23 PM »
Hey there

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

Thanks