What I want to happen is: if p1Fizzled = true at anytime it will stop the whole function.
The yieldwaitforseconds is my spell cast time, but if p1fizzled=true then i want it to stop casting all together. The ct variable is to make it only run once otherwise it keeps looping. Any ideas on how to get the whole function to halt when p1fizzled = true?
function CastFireball()
{
var spellLvl = 1;
ct = true;
combatIndex.isCasting = true;
combatIndex.spellLoaded = false;
while(p1Fizzled == false && ct == true)
{
yield WaitForSeconds (4);
if(combatIndex.isCasting == true && p1Spellsent == false)
{
p1Lastspell = 10;
p1Lastmana = 10;
spellwait = 0;
combatIndex.spellLoaded = true;
combatIndex.CastRecovery();
ct = false;
}