Hello,
I am trying to build a behavior tree with an "Attack" which is conditional on "Is Lua True". I cannot find the right syntax to check the Lua variable.
I want the AI to attack only if the Lua variable (bool) is true.
E.g. the Lua variable => "player_alive" = true (default as set in the Dialogue Database / Variables)
How should I write the Lua Code in the Behavior Tree? I tried with "player_alive" or "Variable["player_s5duel"]", but it doesn't work.
I have attached the Lua bridge to the AI character
Thank you!
Behavior Designer - Is Lua True
Re: Behavior Designer - Is Lua True
Hi,
You shouldn't need the bridge for Is Lua True.
The syntax to check if the Dialogue System variable "player_alive" is true is:
You shouldn't need the bridge for Is Lua True.
The syntax to check if the Dialogue System variable "player_alive" is true is:
Code: Select all
Variable["player_alive"] == true
Re: Behavior Designer - Is Lua True
Hi Tony,
thank you for your reply. I tried using this syntax
in the Inspector / Lua Code section of the Behavior Designer Tree (see attached), but I get that the "Lua code is null or empty".
Could you confirm that my approach is correct?
1- I start with the variable "player_alive" = true (setup in the Dialogue database)
-> the AI should attack
2- if, conditional to some action, I set the variable to false in a script: DialogueLua.SetVariable("player_alive", false);
-> the AI should not attack
thank you for your reply. I tried using this syntax
Code: Select all
Variable["player_alive"] == true
Could you confirm that my approach is correct?
1- I start with the variable "player_alive" = true (setup in the Dialogue database)
-> the AI should attack
2- if, conditional to some action, I set the variable to false in a script: DialogueLua.SetVariable("player_alive", false);
-> the AI should not attack
- Attachments
-
- BD1.PNG (41.78 KiB) Viewed 334 times
Re: Behavior Designer - Is Lua True
Hmm, that error is strange, since I see that the Lua Code field has code. From everything you described, you're doing it correctly. Is the error maybe coming from a different behavior tree or a different task node?
Can you send a reproduction project to tony (at) pixelcrushers.com?
Can you send a reproduction project to tony (at) pixelcrushers.com?
Re: Behavior Designer - Is Lua True
Hi Tony,
I tried again and now it works. The only difference is that I wrote the code instead of just copy pasting...it doesnt make much sense but at least it looks fine
Thank you for your support!
I tried again and now it works. The only difference is that I wrote the code instead of just copy pasting...it doesnt make much sense but at least it looks fine
Thank you for your support!
Re: Behavior Designer - Is Lua True
Very strange! Glad it's working now.