x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Weapon pickup and inventory?

How can I make a weapon that I can pick up and then have multiple weapons in a inventory?

Product Version: UE 4.8
Tags:
more ▼

asked Aug 04 '15 at 02:40 AM in Blueprint Scripting

avatar image

KompaktKat
187 21 26 40

avatar image Overwatch04 Aug 04 '15 at 03:39 AM

I would check out the UMG Inventory tutorial and use that as a starter. You can use a weapon mesh as a pickup item. when that item is picked up you can set up the "USE" option to set a variable to allow you to spawn that weapon. I am not quite sure if it would work but it sounds like what I am going to try once I get done with my menus.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hi pikachu1001000,

A simple way to do an inventory (not the best way, mind you) would be to make an array of a variable type. The size of the array and the number of arrays you may need would depend on how you want this inventory system to work. If you wish to do something similar to an FPS like Doom or Unreal Tournament, you could have an array with about 10 booleans. If you want to get more fancy, you could make a struct or class for the weapons themselves that can store things like ammo or durability, instead of using booleans. Each boolean could be associated with a weapon and be set to true or false depending on if the character has it. You could then have keybindings set up for 1-9 on your keyboard and if a user hits a button, check to see if the boolean for that weapon is true. If it is true, then equip the weapon associated with it.

As far as the pickup goes, you could make an asset that sits on the ground (or floats, it's up to you) with a box collision surrounding it to act as a trigger. Turn all collision off but allow the trigger to overlap pawns. After this, you could use 'OnBeginOverlap' on either the Pawn or the asset itself to set the boolean in your array that is associated with that weapon to true and then run DestroyActor on the asset.

Hope this helps!

Matthew Clark

more ▼

answered Aug 04 '15 at 02:57 PM

avatar image KompaktKat Aug 04 '15 at 03:01 PM

I do want something similar to Unreal Tournament.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question