Можно после каждой битвы:
function rndcast()
while 1 do
SetGameVar('spell', random(5))
local index = GetLastSavedCombatIndex()
while index == GetLastSavedCombatIndex() do
sleep(10)
end
end
end
startThread(rndcast)
А в боевом скрипте строчкой
cast = GetGameVar('spell')+0
заменить строку
cast = random (5)
Да, и random(5) вернёт случайное число от 0 до 4. То есть random(n) возвращает случайное число от 0 до n-1.