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"

Cast failed; Cast to HUD on trigger

Trigger volume is triggering just fine, but the Cast to HUD keeps failing. Am I using the Cast function correctly?

Intended function: On trigger volume overlap (when new area entered), the HUD should display the area and level's name (currently defined as a variable in the volume).

Current script flow as I see it looks like this: 1) Volume is triggered starting the overlap event in AreaTrigger. 2) AreaTrigger convert it's AreaName and LevelName enums to strings, then sends that info on over to HUD via a cast (maybe this is not how a Cast works?). 3) HUD prints the Strings in a Draw Text function.

Like I said, trigger volume triggers okay, however, cast always fails.

When I begin play, the HUD displays some test text and the default AreaName text. However, when I enter the volume, I only get 'Cast failed' and the HUD's text does not change.

alt text

alt text

Product Version: UE 4.10
Tags:
hud bp.png (144.2 kB)
more ▼

asked Feb 28 '16 at 02:28 AM in Blueprint Scripting

avatar image

nemesismark
6 2 4 5

avatar image nemesismark Feb 28 '16 at 03:08 AM

I haven't figured out how to use the Cast function yet, but at least I was able to do what I needed!

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

2 answers: sort voted first

I see you already fixed it, but just in case if you want something to cast to your hud it should be connected more like this :) alt text

cast.jpg (57.4 kB)
more ▼

answered Feb 28 '16 at 03:13 AM

avatar image

DoubleDoor
16 1 2 5

avatar image nemesismark Feb 28 '16 at 02:49 PM

Oh I see - so I was just using the wrong object reference for the input on the Cast? Thank you DD, thats very helpful. Does casting work as I think it does, letting you modify variables in another blueprint from within the current blueprint?

avatar image DoubleDoor Feb 28 '16 at 03:04 PM

I don't really know how to explain casting myself, but here you will find an answer that should help you understand it a little bit better: https://answers.unrealengine.com/questions/221544/actor-casting-problem.html

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

Fixed this; Removed the Cast function completely and stored the variables instead in a Blueprint Interface so I have 'Entered new area?', 'Level name', and 'Area name' in a callable function. I still have the Enums set on the trigger volume - these are sent to the interface which when used in the HUD gets me my variables! :) Below for pics!

alt text

alt text

alt text

more ▼

answered Feb 28 '16 at 03:07 AM

avatar image

nemesismark
6 2 4 5

(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