playMaker

Author Topic: How to Find Enemy Closest in Range of Fire?  (Read 92 times)

kanbibadboy77

  • Playmaker Newbie
  • *
  • Posts: 2
    • View Profile
How to Find Enemy Closest in Range of Fire?
« on: October 26, 2017, 02:40:11 AM »
How to Find Enemy Closest in Range of Fire?

krmko

  • Sr. Member
  • ****
  • Posts: 422
    • View Profile
    • Fat Pug Studio
Re: How to Find Enemy Closest in Range of Fire?
« Reply #1 on: October 26, 2017, 07:14:57 AM »
I'm not on desktop now, but i think there's some sort of get closest action.

If not, you can spherecast with tag the enemies, get their distances and compare them etc.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 2247
    • View Profile
    • jinxtergames
Re: How to Find Enemy Closest in Range of Fire?
« Reply #2 on: October 26, 2017, 09:33:54 AM »
Hi,
There are actually several ways you can do this.
You could get 'array maker' on the Ecosystem

Use a trigger and if an enemy goes inside, add it to an array list and if they go outside the trigger (On Trigger Exit) remove them from the array. (array list contains, then use the index nr and array list remove at)

Then on a different fsm use 'Array List Get Closest Game Object'

Or you could place all enemies and use Array List Get Closest Game Object In Sight.


on the User tutorial wiki page you can find several tutorials for using array maker (and many other stuff)
« Last Edit: October 26, 2017, 09:55:07 AM by djaydino »