Attack a Target (using mouse over?)

So in my script i have a "Monster" (a box) with a script that has the function:


var Player: Transform;

function OnMouseOver () {
if (Input.GetMouseButtonDown(1)) {
Player.SendMessage ("AttackMonster");
   }
}

I have the player set up as the character (obviously) and on that i have this script:


function AttackMonster()
{
print ("ATTACK");
}

now all this works just fine and dandy, no problems at all. But i want the "Monster" to send its location to the other script, so that way i can have the script move the player to the monsters location. I tried adding a var with the position:


var Player: Transform;
var targetPoint = transform.position;
function OnMouseOver () {
if (Input.GetMouseButtonDown(1)) {
Player.SendMessage ("AttackMonster",targetPoint,SendMessageOptions.DontRequireReceiver);
   }
}

I kept getting an Error saying that i cant call that function when declaring a variable, can i fix this? or do i have to do something completely different?

what don't you use, GetComponent to get a reference to one of the scripts of the player and call it's functions.

player.GetComponent(attackscript).attack (position);

the SendMessage should work properly. the parameter than you send can be any type because it's an object.