Rate of health loss in trigger box.

so i have a script that makes it when i go in the box area i loos 10 hp points but i dont know how to make it happen every second longer again if i dont leave the box. i can't figure out how to make my Time script part.

var Damage = 10;
var Rate = 1;

function OnTriggerEnter (col : Collider) {
    var player : CharacterDamage = col.GetComponent(CharacterDamage);

        player.ApplyDamage(Damage);

}

function Reset () {
    if (collider == null)   
        gameObject.AddComponent(BoxCollider);
    collider.isTrigger = true;
}

You could do the intial damage like you're doing now. Then for the timed damage that occurs while you stay in the box try this.

It uses the OnTriggerStay event, which is fired continuously after OnTriggerEnter, and until OnTriggerExit. You keep track of the total time in RateCount by adding the delta time value of Time until it equals or exceeds the Rate you want, apply the damange, reset the count.

var Damage = 10;
var Rate : float = 1.0f;
var RateCount : float = 0.0f;

function OnTriggerEnter (col : Collider) {
    var player : CharacterDamage = col.GetComponent(CharacterDamage);

    player.ApplyDamage(Damage);
    RateCount = 0;

}

function OnTriggerStay (col : Collider) {
   RateCount += Time.deltaTime;

   if (RateCount >= Rate){
       var player : CharacterDamage = col.GetComponent(CharacterDamage);
       player.ApplyDamage(Damage);

       RateCount = 0.0f;

       print("Fire!");
   }
}

Open up your console in Unity Editor and see if you get that print("Fire") appearing.

Hope this helps. :)