Cast is successful but variable doesn't change

Hello, I have a dialogue system that is based on behaviour trees so every dialogue is it’s own tree. I want to have dialogue 1, leave and do something, and come back and have dialogue 2. For this purpose I made a task that is supposed to switch the behaviour tree variable which is in the NPC character. However, this does not happen but instead I have dialogue 1, leave, and dialogue 1 starts all over again. When I play and finish the dialogue, it prints “finish execute”, dialogue 2 (the correct tree which should be the next one) and “cast success”. So if I’ve understood correctly the task runs through successfully but the changing of the variable fails. I would really appreciate the help if anyone knows what I’m doing wrong.

And where did you switch the dialogue tree? Not in these example.

The set node is supposed switch the dialogue tree, no?

Then the New Dialog tree variable is the same as before.

How is that if the print node after it prints dialogue 2 instead of dialogue 1 which is the current tree?

What exactly does SET function does?

Nevermind, finally managed to solve it. I had to change the dialogue tree in the NPC’s AI controller instead of in the NPC. Thank you for taking the time to try and help Dejan.