function TEST_Threat_AI.DoCastRandomChance(LuaAI, target, chance, spellID, casttime1) local letsDoSpell = rand_range(1,100) data.casting = 0 if ( letsDoSpell >= ( 100 - chance ) ) and ( spellID > 0 ) then -- stopped attack to cast --need to make mob start cast here (emote with spell gfx) --add if hit check and random cast time reset --LuaAI:GetCreature():StopMoving(); --LuaAI:GetCreature():HandleEmoteCommand(EMOTE_STATE_SPELLPRECAST) --LuaAI:SetUpdateInterval(casttime1) LuaAI:DoCast(target, spellID); --start attack again --LuaAI:DoStartAttack(target); end end