NPC color does not change

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:

Found the problem. The variable ser player was not set to player

Hey hi :slight_smile:

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 Key

which 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.

1 Like

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

  1. The Controller starts the Behavior Tree and runs it;
  2. The Behavior tree runs services and executes actions;
  3. At one point it executes the BT_ChangeColor action;
  4. BT_ChangeColor calls BI_Npc’s event ChangeColor during its execute;
  5. The event Change color apparently calls the ChangeSkinColour function in its StateTree component…
  6. …where the Tint parameter is changed of the MI1 and (possibly) MI2 materials.
1 Like

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)

1 Like

Many Thanks @dZh0

I have a question please . Where “Move to” come from ? and how it created to access the blackboard ?