This is the melee script i’m using/working with on my project.
This is my Error though
Assets/Pirate Game/MeleeScript.js(16,10): BCE0044: expecting (, found ‘AttackDamage’.
Should I put ( instead of attackdamage? tried that and it isn’t expecting that. What should I do? I don’t understand my problem.
#pragma strict
var TheDamage : int = 50;
var Distance : float;
var MaxDistance : float = 1.5;
var cutter02 : Transform;
function Update ()
{
if (Input.GetButtonDown ("Fire1"))
{
cutter02.GetComponent.<Animation>().Play("Attack");
}
function AttackDamage ()
{
var hit : RaycastHit;
if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward), hit))
{
Distance = hit.distance;
if (Distance < MaxDistance)
{
hit.transform.SendMessage("ApplyDamage", TheDamage, SendMessageOptions.DontRequireReceiver);
}
}
}
}