Damage on prefab collision?

Hi everyone. I’m on my second day scripting and I’m pretty lost. I was following a tutorial here

but I’m trying to alter it to make the game mine. Instead of having a raycast laser shoot, I was having my guy toss rocks. I have a character that moves, and throws the rocks, and the rocks are colliding with my baddies. The baddies aren’t taking damage and I’m not sure how to alter the script so that they do.

Here’s what I have under my “enemyHealth” script:

public void TakeDamage (int amount, Vector3 hitPoint)
{
// If the enemy is dead…
if(isDead)
// … no need to take damage so exit the function.
return;

	// Play the hurt sound effect.
	enemyAudio.Play ();
	
	// Reduce the current health by the amount of damage sustained.
	currentHealth -= amount;
	
	// Set the position of the particle system to where the hit was sustained.
	hitParticles.transform.position = hitPoint;
	
	// And play the particles.
	hitParticles.Play();
	
	// If the current health is less than or equal to zero...
	if(currentHealth <= 0)
	{
		// ... the enemy is dead.
		Death ();
	}
}

Here’s what I have under my PlayerShooting script:

	if(Input.GetButton ("Fire1") && timer >= timeBetweenBullets)
	{
		// ... shoot the gun.
		Shoot ();
	}
}

void Shoot ()
{
	{
		if (Input.GetButtonDown("Fire1"))
		{
			Rigidbody instantiatedProjectile = Instantiate(projectile,transform.position,transform.rotation)as Rigidbody;
			instantiatedProjectile.velocity = transform.TransformDirection(new Vector3(-8,0,speed));
		}
		
	}
}
void OnCollisionEnter (Collision col)
{
	if(col.gameObject.name == "Dinosaur1")
	{
		// Try and find an EnemyHealth script on the gameobject hit.
		EnemyHealth enemyHealth = collider.GetComponent <EnemyHealth> ();
		
		// If the EnemyHealth component exist...
		if(enemyHealth != null)
		{
			// ... the enemy should take damage.
			enemyHealth.TakeDamage (damagePerShot);
		}
	}
}

}

I’m getting the error “Assets/Scripts/PlayerShooting.cs(62,45): error CS1501: No overload for method TakeDamage' takes 1’ arguments”

I get the feeling that the script isn’t properly defining “TakeDamage”
I know what I want to say with the script but I don’t know how to say it.

I want it to say “When ThrowRock(clone) interacts with Enemy collision, have enemy take health damage equal to damagePerShot. If Enemy health is equal to 0, Enemy Dies.”

Any help anyone can offer would be GREATLY appreciated! Again, this is my second day scripting. I did a lot of research, but everything seems to not apply to my situation. I feel like I’ve gotten pretty tangled and I’m not sure how to get it straightened out. Thanks!

That error is telling you that the ‘TakeDamage’ function takes more than one argument. Looking at the fn it does indeed take two args: amount and position.

You just need to pass in the hit position as well as the damage.
Looking at your code you could get this from the Collision parameter. See Unity - Scripting API: Collision