Player Character Health

hey guys. i have a player character script from BurgZergArcade with weapon meshes along with a player combat script. i want each mesh to take a different amount of health away from the enemy using this code:

 EnemyHealth eh = (EnemyHealth)_enemy.GetComponent("EnemyHealth");
 eh.AddjustCurrentHealth(-45);

also, i want to send a message to the player combat script from the functions of the player character script. do you have any suggestions? thanks

I’d suggest using an actual tutorial instead of grabbing code and worrying your way through it. The changes you’re looking for are very simple.

(change -45 to a variable, call a function)

To expand on Vicenti’s answer, you want to assign -45 to a variable, and pass that in the method call, and not specifically just a number.

int damageInflicted = -45;

EnemyHealth eh = (EnemyHealth)_enemy.GetComponent("EnemyHealth");
eh.AddjustCurrentHealth(damageInflicted); 
/*
 *Check spelling of AddjustCurrentHealth with the spelling of the method
 *The correct spelling of addjust is adjust
*/