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"

How to scroll between buttons with the scroll wheel?

Hi people.

I created a simple box with 3 buttons (for now), each of these buttons has a weapon assigned to them and when I use it with the mouse it works perfectly. Now all I need to do to perfect this is to make it scrollable through with the mouse scroll (or keys) and make them selectable on a simple mouse click (i'm building a weapon selection bar and i want the user to be able to scroll through the weapons and select the one he uses (similar to half life style only without the submenus). Does anyone know or have some starting point on how to make this work?

Product Version: UE 4.19
Tags:
more ▼

asked May 20 '18 at 09:09 AM in Blueprint Scripting

avatar image

Lord Jambrek
1

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

1 answer: sort voted first
  1. Create Input Mapping(s) in your Project Settings for the mouse scrollwheel axis (if it exists - i have never tried it)

  2. Create a WeaponIndex variable (integer) on your player controller or the main widget of your HUD (so it will always exist as long as the player does.

  3. On the player controller class, add input events for the scroll wheel axis, and depending on if it is > 0 or < 0, then increment or decrement the WeaponIndex variable. Use Mod operator on it against the number of weapons in the menu to make the value wrap around if it goes higher than that number or lower than 0.

  4. Either access the widget from the playercontroller and tell it to Set Focus on the child of your vertical box at the index WeaponIndex, or you can get the widget's Owning Player within the Widget's code and check what the WeaponIndex is from there, but doing it that way you'll have to check on tick or a short timer probably.

There is probably a more elegant way to do this but I think it will work.

more ▼

answered May 20 '18 at 11:39 PM

avatar image

mightyenigma
3.8k 18 23 20

(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