How to change what function is called during a custom event (communication between scripts)

So for some context, I have a Health script, and there is a public TakeDamage() function, but want there to be an animation triggered when damaged. I want this Health script to be reused among different enemies, so I want some flexibility between what function will be called when TakeDamage() is used. Ideally, the a separate script other than the health would determine which function will be caused when TakeDamage() is used. I’m not sure how to do this, but I know delegates exist but again not too familiar with them. Any help is appreicated.

Events are one way, dragging references around are another way, and interfaces can help further decouple your setup.

Rather than one of us painstakingly retyping all the parts, code and setup of scenes, prefabs, etc., into this tiny little text box (if such a thing were even possible), I suggest you start with some basic Youtube tutorials.

There are thousands of tutorials covering exactly what you seek. Everything you learn about this topic will be learned one small step at a time, just like this guy:

Imphenzia: How Did I Learn To Make Games:

Can you elaborate on the events? Maybe I can make a custom event for when the enemy has taken damage. I have done things similar to this in LUA, so im not completely new to the method.

howw can i make a custom one where i control when it is called

All of that is covered above.

You can also just make a blind delegate (System.Action) and put whatever you want in it, referencing whatever else you want with it.

You can put your TakeDamage() function in a base class and then script different damages in child classes that extend from your base class. Save these into three different c# files and then you can add a SomeEnemyHealth component to get one handle or SomeOtherEnemyHealth to get the other:

public class BaseHealth : MonoBehaviour
{
	public void TakeDamage()
	{
		HandleHit();
	}

	public virtual void HandleHit()
	{
		// do base take damage logic
	}
}
public class SomeEnemyHealth : BaseHealth
{
	public override void HandleHit()
	{
		// do some override version of taking damage
	}
}
public class SomeOtherEnemyHealth : BaseHealth
{
	public override void HandleHit()
	{
		// do another override version of taking damage
	}
}