I was watching a tutorial about AI behavior tree and I am stuck at one stage. The AI should check if player close to npc and if so the npc color get changed but that did not occur I dont know why here are the code:
Hey hi
Can you also show the BP where you change the actual color of the material?
I am using the demo that came with the tutorial but I dont understand where is the real code of “Change Color” . In the demo file when I right click I find Change color message but where it came from ?
Taking a bit more time with it, this is what I see:
In your Service BTS_IsPlayerClose
when the player is close you set ser_Player
key to the Player Pawn object:
However, in your Behavior Tree
ser_Player
is redirected to Self Actor
Blackboard Keywhich means that the moment the player is close
Self Actor
becomes the Player Pawn.
Try redirecting ser_Player
to Player
Blackboard Key and in your Behavior Tree and tell if there is any difference.
PS. Change Color
is in BI_Npc
from what I see in the message target. Take a look at it if the Behavior Tree change doesn’t fix the problem.
Yes all I need is to set “ser player” variable to “player” in the details panel (yellow highlight )
I then searched all blueprints for change color implementation and found it in
npc_StateTree event graph :
And in ChangeSkinColor function
But I am little confused how these blueprints communicate
- The Controller starts the Behavior Tree and runs it;
- The Behavior tree runs services and executes actions;
- At one point it executes the BT_ChangeColor action;
- BT_ChangeColor calls BI_Npc’s event ChangeColor during its execute;
- The event Change color apparently calls the ChangeSkinColour function in its StateTree component…
- …where the Tint parameter is changed of the MI1 and (possibly) MI2 materials.
But BI_Npc is an empty interface I can not see any function in it
Found it the my blueprint window was closed . Thanks
You can see in the class settings that npc_StateTree implements the BI_Npc interface in one of your screenshots
(the little blueprint with arrows in the right corner means that this is an interface event)
Many Thanks @dZh0