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 Selection Menu

Hi everyone. How can I create a weapon selection menu which is situated in the menu level but affects the playable one? I already have a weapon base system with 2 children weapons, but I don't know how to access them trough the widget graph and save the selection (sorry for my english).

Product Version: UE 4.21
Tags:
more ▼

asked Apr 21 '19 at 01:13 AM in Blueprint Scripting

avatar image

David432
1 1 1

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

1 answer: sort voted first

Check out video #20 in the link below. It goes over how to store global variables in a game instance. You can store your "selected weapon" in the game instance and when you travel to the first level use the game instance to set the player's weapon they selected from the main menu.

https://www.youtube.com/playlist?list=PLyu-W38DvZhqByAoeva1jewB5s78zQHIy

more ▼

answered Apr 21 '19 at 06:05 PM

avatar image

Nebula Games Inc
4.9k 27 9 14

avatar image David432 Apr 22 '19 at 02:11 PM

Ok, for the primary weapon everything's fine, but only if I don't link the secondary.

https://imgur.com/a/6pAG5KR

If I link the secondary too I spawn with no weapon. Here's the whole graph if it's userful: https://imgur.com/a/Oc428Ms

avatar image Nebula Games Inc Apr 22 '19 at 02:24 PM

You can't use the same variable to store the primary AND secondary together. You would need an integer variable for the primary weapon selected and one for the secondary. Save both to the game instance and have 2 separate functions one that loads the primary weapon using the primary weapon equipped integer and one that uses the secondary weapon equipped integer to load the secondary weapon. With this combined setup only the primary weapon will be correct or only the secondary will be based on whether or not you set the weapon equipped integer with the primary weapon first or secondary. A "switch on int" will only fire one execution path based on the integer input. So if the integer value is 0 it will fire execution path 0, if it is 1 it will fire path 1 etc. So you can't equip BOTH a primary and secondary weapon like that.

avatar image David432 Apr 22 '19 at 03:33 PM

I finally fixed everything. Thanks a lot for your help man

avatar image Nebula Games Inc Apr 22 '19 at 03:55 PM

No problem!

(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