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 node help

I am casting to my character in the EnemyHUD so that I can get his health but I don't know what to use as the object.

https://gyazo.com/1a2b574ecb82001558a1b68e540c3851

Product Version: UE 4.13
Tags:
more ▼

asked Nov 04 '16 at 03:36 PM in Blueprint Scripting

avatar image

ElectricNic89
20 7 13 16

avatar image erik321123 Nov 04 '16 at 03:50 PM

Try putting the owner of the HUD in as the object. I am quite sure the is a node to get the ower of the HUD.

avatar image ElectricNic89 Nov 04 '16 at 04:35 PM

I couldn't find a node that gets the owner of the HUD

avatar image erik321123 Nov 04 '16 at 04:46 PM

Than. You van cast from the character to the hud with get hud. or create An interface.

On Mobile. Sorry for typos

avatar image ElectricNic89 Nov 04 '16 at 04:58 PM

The casting works but now the enemy health is apparently 0, https://gyazo.com/2dc39f7c52cac827fdf081ce270966d8

Even though I set the health to be 100. https://gyazo.com/55ddf850a6eada5afc654cfb665d6d4b

avatar image erik321123 Nov 04 '16 at 05:37 PM

I don't see any output on your first picture. Where should it be?

avatar image ElectricNic89 Nov 04 '16 at 05:46 PM

The gray progress bar above the red cube is the enemy health. It should be red as he has 100 health.

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

2 answers: sort voted first

Hi ElectricNic89,

The way casting works is you get a reference to an object, then check if that object is of a specific type. In this case, you will need to pass a reference of your AI to the character and then cast to the AI class you need. Once you have done this, you'll be able to use other assets. You can find more information on Casting here:

https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/CastNodes/

Additionally, we have a video where Zak Parrish goes over various types of blueprint communication and how to use them:

https://docs.unrealengine.com/latest/INT/Videos/PLZlv_N0_O1gYuWkyTSbfcuyPNOQsK_8bu/EM_HYqQdToE/index.html

more ▼

answered Nov 04 '16 at 07:29 PM

avatar image ElectricNic89 Nov 04 '16 at 08:10 PM

My casting works but the other problem I'm having is this:

The casting works but now the enemy health is apparently 0, https://gyazo.com/2dc39f7c52cac827fdf081ce270966d8

Even though I set the health to be 100. https://gyazo.com/55ddf850a6eada5afc654cfb665d6d4b

The gray progress bar above the red cube is the enemy health. It should be red as he has 100 health.

avatar image jetset_3566 Nov 04 '16 at 08:16 PM

alt text

грубо говоря твой каст идет по линии провала(cast fail), если каст провален то он не сможет взять переменные из этого класса roughly speaking your cast is on the failure of the line (cast fail), if caste is failed then he would not be able to take the variables of this class

avatar image ElectricNic89 Nov 04 '16 at 08:29 PM

But when I don't use the cast failed then I compile it it gives me this message 'Note'

avatar image jetset_3566 Nov 04 '16 at 08:34 PM

![alt text][1]

look tutorial video on twin stick shooter there talk about what you want [1]: /storage/temp/113809-набросок.png

avatar image ElectricNic89 Nov 04 '16 at 08:40 PM
avatar image jetset_3566 Nov 04 '16 at 08:42 PM

enemy spawn on level?

avatar image ElectricNic89 Nov 04 '16 at 08:45 PM

I only have one enemy in my level which I placed in. They don't spawn randomly yet.

avatar image jetset_3566 Nov 04 '16 at 08:48 PM

alt text

вообщем тебе надо зделать эту переменную доступной( на глазок нажать). после на уровне взять пипетку и выбрать класс откуда ты берешь cast

in general you need to create one this variable available (click on the eye). after level and choose pipette to take a class where you take a cast

avatar image ElectricNic89 Nov 04 '16 at 08:55 PM

I'm not using a colour box. I have a widget component inside of my enemy.

https://gyazo.com/caf1748ab35c28261475d1a4dff93bbd

avatar image jetset_3566 Nov 04 '16 at 09:00 PM

alt textcolor box it my project, with I work now. okey. casting works like this: you create a variable in it indicate basisenemoreferentse made it available, there was a yellow eye icon is now at the level you take this class you look at its settings there basisenemoref pipette and pipette take in and poke the class that you want to associate casting

avatar image ElectricNic89 Nov 04 '16 at 09:07 PM

My variable is available as has the yellow icon next to it but I still can find the pipette.

avatar image jetset_3566 Nov 04 '16 at 09:10 PM

get me screenshot when you create widget "enemyhud"

avatar image ElectricNic89 Nov 04 '16 at 09:13 PM

I don't actually ever make the 'enemyhud'. I use a widget component inside of my enemy that is holding the enemyhud widget.

https://gyazo.com/18f578d54164961f726059f9504a88ba

avatar image jetset_3566 Nov 05 '16 at 12:31 PM

sorry I can not help you with this problem, but I try///

avatar image jetset_3566 Nov 05 '16 at 09:55 PM

I find solution^)

https://www.youtube.com/watch?v=M7w9OfPRpKM there two lesson

avatar image ElectricNic89 Nov 06 '16 at 09:58 AM

Thank you! It finally works.

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

you need variable enemy character for cast look lesson in video tutorial https://docs.unrealengine.com/latest/INT/Videos/PLZlv_N0_O1gb5sdygbSiEU7hb0eomNLdq/1pmPb_TWG-8/index.html

more ▼

answered Nov 04 '16 at 06:47 PM

avatar image

jetset_3566
6 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