Hi ,i made a script to set the damage of any projectile shoots by the player or by enemies using broadcast messages
but i don’t know how to make the script know the message sender
this is the script

var Damage = 0.000;

var DestroyAfterHit = false;

var Part : Transform;

function Hit (ID:int)
{
	BroadcastMessage("Damage",Damage);
	if(DestroyAfterHit)
	{
		Instantiate(Part,transform.position, Quaternion.identity);
		Destroy(gameObject);
	}
}

thanx very much and sorry for poor english

BroadcastMessage() only takes one parameter, and you're already using that for damage, so obviously you can't add a sender parameter.

You can pack up all the parameters you want to pass into an array, list, or dictionary, then use that as the single parameter for BroadcastMessage(), and unpack them in the function on the receiving end, but that could get a little sloppy.

Personally, I just wouldn't use BroadcastMessage(), it doesn't perform very well anyway. I would check to see if the hit object has the script that contains the Damage() function, then call the Damage() function directly and use all the parameters you want. eg:

var damageScript : DamageScript = objectIHit.GetComponent(DamageScript);
if(damageScript){
    damageScript.Damage(damage, sender);
}