Pickup the weapon with the Highest priority

Hi friends! I think you can help me.

I’ve some “Pick Up Weapon” Actors with Box Component. I pick up a weapon if I press a button when I’m inside the box (every “Pick Up Weapon” Blueprint uses “OnComponentBeginOverlap” for enable input).

Now i would make something like this:

  • gun priority = low (Integer= 1)
  • rifle priority = medium (Integer= 2)
  • RPG priority = high (Integer= 3)

because I want pick up the weapon with the highest priority level when I’m inside many Box Component at the same time.

I think I need a BP Interface, because I’ve seen this thread: Blueprint Catch - Blueprint - Unreal Engine Forums but I would make a simple priority system between the Character BP and every Pick Up Weapon BP…can someone help me?

Please, let me know on this forum or on AnswerHub (Pickup the weapon with the highest priority - Programming & Scripting - Unreal Engine Forums) if you want Karma points.

You’ll need to start by creating an Int variable in your weapon blueprint and then assign the values you mentioned inside each weapon’s default settings.

In your pickup event, after OnComponentBeginOverlap, you’ll want to compare the values of the weapon actors inside the box component. Whichever has the highest number, you pick up.

I don’t have UE installed at work but I can try and show the blueprint logic when I get home later, but I hope that is enough to help you.

Hi Moose, many thanks for your help!