- Home /
I can't get an npc to take damage.,I can't get my NPC to take damage.
I'm Trying to script two type of NPCS. The first (a logger character) attacks when a game object on the Tree layer is detected by a ray, dealing damage to the second one (a tree), by calling a function in the trees controller script ("Hurt(damage)"). This is suppose to de-increment the trees current health by the value of a float named "damage". However, when I run my game, while the logger registers a hit as indicated by the debug terminal, the tree takes no damage. I don't know whether my entire approach to implementing these behaviors is broken, or just something in my scripts. This is my first time working with unity, so I don't really have a grasp on how any of this works. Any guidance you all could offer would be greatly appreciated.