FireBall script

Hi everyone I am making a game in which you can use a series of magic spells and items. One of them is to be able to throw a fireBall which deals continues damage. I have used the "Launcher" weapon from the FPS tutorial but I can't seem to alter the script so that: 1. It does damage 2.The damage is continues upto a certain time limit.

I appreciat all anwsers right or wrong, thank you for reading this and thank you for your time and patience

In your collision method, store a reference to your player script from the colliding object (using GetComponent(PlayerScript), or whatever you called it). In that script, you'll want a damage function which just does health -= damage, and kills the player if the health is below 0 after

What you should then do, is call playerScript.Damage(initialDamage), and call a coroutine, something along the lines of this:

var tickLength = 1.0;
var tickTime = 10.0;
var tickDamage = 5.0;

function TickDamage(playerScript : PlayerScript)
    var time = 0;
    while (time <= tickTime)
        yield WaitForSeconds(tickLength);
        time += tickLength;

That will apply damage (using the same function as the initial damage) to your player