Implementation of agent taking damage

coysterk

New member
I'm having trouble designing a conditional that lets an agent register damage. I want to know the general way of letting an AI recognize damage is. I know an easy way is by using the Compare shared variable conditionals. But I don't know how to tell my damage scripts to affect these variables. How do I talk to the behavior tree variables through other scripts. Thank you for your time. P.S. new to this application just want some advice for the future. Any links or videos helps but I have already seen all of opsives recommend videos. Thanks!
 
To anyone who reads this post I have solved my current issue and do not need help anymore. Would still like to learn how to write a conditional but other get shared variable conditionals are working for now. Now I do have a problem. In my tree I have a bunch of play and stop tasks for a particle system. Every time I save and close out of my project I have to reassign my Particle systems attached to my enemy ai after booting the project back up. All my other variables save but my particle prefabs don't. I have them assigned to the gameObject type. Would changing the types of my variables help them save the prefabs. My particle systems are nested onto my ai as children and play when called. Any help on this is much appreciated.
 
If your behavior tree is an external tree or on a prefab then Unity is not able to access scene references from a project level asset. For this situation you will need to assign the variable at runtime using a different script.
 
Top