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"

Error with AI casting in 4.9.0

Greetings all, I’m attempting to program AI using a combination of blueprints, behavior trees and blackboards.

the youtube tutorial I’m mimicking is here (sadly, I think it is 4.5.): https://www.youtube.com/watch?v=LvDDLMhxYns

The issue is when I try to cast to a controller in one of the tasks, the cast always fails. I want the AI not to only face the player character but who ever hurts him. I’ve tried several work arounds but each one does’t obtain the desired effect. If I could get the AI to do as in the video, I’d be happy.

Here's an image of my blueprint. alt text

Other than this issue, 4.9 has been the best. thanks.

Product Version: UE 4.9
more ▼

asked Sep 07 '15 at 07:44 PM in Blueprint Scripting

avatar image

52 13 17 24

avatar image ambhar Sep 08 '15 at 05:00 PM

Just Cast to your Player Character e.g Cast to ThirdPersonPlayerCharacter (Depending upon your character BP name), in object input add "Get Player Character" node. The output of casting to your character can be directly used as input in "New Focus"

avatar image Van2015 Sep 08 '15 at 05:05 PM

Iv’e tried that and it has worked. The only issue is that I want the bot enemy to attack who ever hurts him(even other AI.) not just the player.

Thanks though!

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

1 answer: sort voted first

Do you have a screenshot of the blueprint where you are actually setting the instigator? Take in mind that one thing is the Damage instigator and other is the Instigator of an actor (by the look of your screenshot it looks like you are getting the instigator of the bot itself, thats why im asking).

You should set the instigator in your blackboard data asset everytime a player or another actor hurts the bot.

more ▼

answered Sep 08 '15 at 04:14 PM

avatar image

969 22 13 29

avatar image Van2015 Sep 08 '15 at 05:00 PM

Here is the screenshot of the damage system in the bot character blueprint in which I set the damage insigator to the instigating object. In the other screenshot I have the "random move to location" task where I set the blackboard key values. Hope this is what you where asking for. :)

alt text

alt text

avatar image Bariudol Sep 08 '15 at 06:43 PM

Maybe you could try setting the instigator during your take damage event. Something like this (add your anim montage call there, i forgot about it).

alt text

takeanydamage.png (160.3 kB)
avatar image Van2015 Sep 08 '15 at 08:20 PM

I just tried that and got better results, but the bot still isn’t setting the damage instigator as “focus.” In the “Event Any Damage” I cast to the controller. What is that you made your cast to?

avatar image Bariudol Sep 08 '15 at 11:10 PM

I made a cast to the AI Controller. Maybe your problem is what its mentioned here

avatar image Van2015 Sep 09 '15 at 12:45 AM

That seems similar, but the focus still doesn’t operate properly. However casting to the AI Controller causes the bot to face where the damage delivering shot came from. The Focus fails to work when I set the “New Focus” to a controller. I’ll attempt setting focus in the “Event Any Damage.”

Do you know of any other methods that would get the same result? Perhaps this isn’t the best way with the focus acting up.

I really appreciate the help!

avatar image Bariudol Sep 09 '15 at 04:03 AM

Sorry I haven't responded in some time. I'll try to build something tomorrow morning and come back to you to see if we can figure this one out.

avatar image Van2015 Sep 09 '15 at 03:34 PM

Thanks so much! I tried some different approaches last night and none of them worked.

(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