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"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

enum only returning first entry

Hi all,

So I have two blueprints, which currently are not working. Both blueprints try to pull and use data from an enum (different enums in each blueprint). In each instance, the first entry from the enum is called.

The first enum is used to make an in game calendar, where the date appears. The enum is called up in the widget blueprint for the UI (as pictured below; I've added in the print for debugging purposes). The int-int function is not in the execute path because I was testing to see if it was as simple as removing that bit. The array (game date) is set-up as follows: day (0), month (1), year (2). The corresponding functions for day and year work, and do not use enums.

GetMonth function for UI

The path (after the clamp) is: int to byte>byte to E_MonthNames > enum to string > string to text. Also I have tried this with and without the clamp, with no differences.

As can be seen by the debug text in the second image, the date is correctly updating the month behind the scenes so I know the script in GameState is correct. The calendar has updated to 15/07/2 (yeah year 2), yet the UI and the print script from first screenshot show 'January' instead of 'July',

debug code on left, UI widget to right

I realize I have probably missed something very simple in the scripts but just in case I made a mistake elsewhere, here is a copy of the enum:

enum setup

Likewise, I'm having the same issue with a script that should pull random names from two different enums (based on gender) with pretty much identical setups to the above script. The major difference is I am not pulling external information into this script, like with the other taking information from other scripts.

The use of 'MaleNameTest' was to test if setting the variable solved the issue. Regardless if the name was set as a second variable (as seen in the true path) or just passed through (as seen in the false path) it made no difference. The result was still the first entry from the correct table for the the sex of the NPC (e.g., all female NPCs got the name 'Sarah' instead of a random name from the table).

Script GetRandomName

Thanks in advance for your help.

Product Version: UE 4.20
Tags:
more ▼

asked Jan 17 '19 at 12:48 PM in Blueprint Scripting

avatar image

zjparker6
1 1

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Found a solution. Despite what every tutorial or document I have seen said, I cannot use 'literal enum' this way. The set up is the same as what is currently pictured, except instead of 'literal enum' I have created a variable (or two in the case of the second example) where the selected information from the enum is stored. This is then passed through enum to script.

Works perfectly now.

more ▼

answered Jan 19 '19 at 05:32 PM

avatar image

zjparker6
1 1

(comments are locked)
10|2000 characters needed characters left
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