BEAT EM UP - NPC WEAPON QUEST

In this hypothetical BEU situation shown in the illustration above, you see three NPC’s dwelling currently within the “screenbox” (a box collision of the camera actor).

There is a single weapon somewhere within the screenbox, and it is available (a bool in its bp saying no one has it). Now, which of the three NPC’s go for it?

Logically, it would be the one closet to it. So I need a way to calculate that.

THEN, comes the part where once calculated, one of the NPC’s is assigned and goes to get that weapon, while the other NPC’s go back to there standard function seeking the TPC’s Y1 or Y2 spot(s), (in front or behind).

Note this is different from what I call a walk in, where an NPC introduces you to a weapon by bringing it and trying to attack you with it, but drop it if they are attacked. A classic case of this would be Linda on Double Dragon who comes out of a door and has a whip, introducing you to the first weapon of the game. But once they drop the weapon, the same strategy should apply. In studying Double Dragon considering this, I found only certain enemies go for and or can pickup certain weapons. Like Linda could only get the whip, others only the bat, others the knife. Interesting mechanic.

Any thoughts or opinions are greatly appreciated, thanks.

  • add distances to an array, get array min on Completed, get the char ref
  • send that AI to the Weapon location

one of the NPC’s is assigned and goes to get that weapon, while the other NPC’s go back to there standard function seeking the TPC’s Y1 or Y2 spot(s), (in front or behind).

  • this bit is contradictory; since we only send the closest AI to fetch the weapon, there should be no need to tell others to go back to their duties since they never abandoned them to get the weapon in the first place.

I found only certain enemies go for and or can pickup certain weapons.

  • enemies should have a list of preferred weapons we can query
  • as before, loop over AIs, add distances to an array but only of those queried chars whose preferred weapon matches the one that dropped
  • you end up with a filtered array of AIs who are interested in that weapon → get array min on Completed, get the char ref, send them for the weapon. The others remain unaffected.
1 Like

I haven’t used arrays much. Can you expand on this please? Thank you