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"

Why is my cast failing?

Hello, I am trying to make my "Something" function inside of "Plant":

alt text

Tell the "YaBoi" event inside of "Stats" to activate.

alt text

However for some reason, the cast always fails, I have tried activating the event without the cast, however, it doesn't activate and I am left scratching my head. If anyone has a solution for this, that would be amazing. Sadly, I need some rest, it's 5am and I have spent five hours trying to fix this issue, to no avail.

Product Version: UE older version
Tags:
more ▼

asked Feb 14 '17 at 10:04 AM in Using UE4

avatar image

ZeroFender
1 1 1

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

1 answer: sort voted first

not much info here, blueprint looks ok but if I had to guess maybe the Object being passed into the Something method is not a Stats type or does not derive from Stats.

more ▼

answered Feb 14 '17 at 11:00 AM

avatar image

Troublesum
196 11 7 12

avatar image ZeroFender Feb 14 '17 at 11:26 AM

How would I make it derive from stats

avatar image Troublesum Feb 14 '17 at 12:07 PM

what is the Object you are passing into to the Something method? it either needs to be of Stats type or has to be based on the Stats type (inherited from Stats).

avatar image ZeroFender Feb 14 '17 at 01:13 PM

Now I am getting an error: "Object" is already a "Stats" you don't need a K2node_dynamic_cast3

avatar image Fotosynthesis Feb 14 '17 at 01:20 PM

Remove the cast ;)

avatar image ZeroFender Feb 14 '17 at 01:26 PM

I removed it and now the event will not activate. The string that says "sadsadsadsadAAAAAAA" prints however, it's weird.

avatar image Fotosynthesis Feb 14 '17 at 01:58 PM

Where are you firing the Something function from? And are you definitely passing in a reference to a Stats actor when you do?

avatar image ZeroFender Feb 14 '17 at 10:01 PM

"Stats" is a UMG, the Something function is located in the "Plant" UMG

avatar image Fotosynthesis Feb 14 '17 at 11:28 PM

Yeah but how are you firing this function? Some event should be triggering the Something function and when it does, it needs to pass in some kind of reference.

avatar image Troublesum Feb 14 '17 at 11:39 PM

well that doesn't answer the question to where are you calling the Somthing function from and what is that (yaboi_Event) event? is the UMG displaying correctly? is it added to the viewport?

avatar image Fotosynthesis Feb 14 '17 at 01:46 PM

Where are you firing the Something function from? And are you definitely passing in a reference to a Stats actor when you do?

avatar image ZeroFender Feb 15 '17 at 02:44 AM

I am firing from the "plant" UMG, "something" is in that UMG, and yes

avatar image ZeroFender Feb 15 '17 at 02:46 AM

alt text

avatar image Troublesum Feb 15 '17 at 04:16 AM

Well there's your problem, you are passing in "Self" from within "Plant" so you are passing in a "self" reference "plant type", you need to get and pass in the "Stats" UMG reference.

avatar image ZeroFender Feb 15 '17 at 04:32 AM

how would I get "stats"

avatar image ZeroFender Feb 15 '17 at 06:08 AM

NEVERMIND, I GOT IT, THANKS FOR THE HELP, this setup works for anyone else having the same issue

alt text

(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