babalae/better-genshin-impact · error · Exception
没有可用战斗脚本
Error message
没有可用战斗脚本
What it means
Error "没有可用战斗脚本" thrown in babalae/better-genshin-impact.
Source
Thrown at BetterGenshinImpact/GameTask/AutoFight/AutoFightTask.cs:295
if (!combatScenes.CheckTeamInitialized())
{
throw new Exception("识别队伍角色失败");
}*/
// var actionSchedulerByCd = ParseStringToDictionary(_taskParam.ActionSchedulerByCd);
var combatCommands = _combatScriptBag.FindCombatScript(combatScenes.GetAvatars());
// 命令用到的角色名 筛选交集
var commandAvatarNames = combatCommands.Select(c => c.Name).Distinct()
.Select(n => combatScenes.SelectAvatar(n)?.Name)
.WhereNotNull().ToList();
// 过滤不可执行的脚本,Task里并不支持"当前角色"。
combatCommands = combatCommands
.Where(c => commandAvatarNames.Contains(c.Name))
.ToList();
if (commandAvatarNames.Count <= 0)
{
throw new Exception("没有可用战斗脚本");
}
// 新的取消token
var cts2 = new CancellationTokenSource();
ct.Register(cts2.Cancel);
combatScenes.BeforeTask(cts2.Token);
TimeSpan fightTimeout = TimeSpan.FromSeconds(_taskParam.Timeout); // 战斗超时时间
Stopwatch timeoutStopwatch = Stopwatch.StartNew();
// 记录开战时间,供"开战前一段时间阻断战斗结束检查"使用
FightStartTime = DateTime.Now;
Stopwatch checkFightFinishStopwatch = Stopwatch.StartNew();
TimeSpan checkFightFinishTime = TimeSpan.FromSeconds(_finishDetectConfig.CheckTime); //检查战斗超时时间的超时时间
//战斗前检查,可做成配置View on GitHub (pinned to a7cb36712d)
Solutions
- 在自动战斗配置中选择或创建可用的战斗脚本
- 检查战斗脚本文件是否存在且格式正确
- 确认队伍角色与脚本中的角色匹配
Example fix
更换/编写与当前队伍角色一致的txt战斗脚本,确认脚本中角色名(或别名)与游戏内队伍一致。
When it happens
Trigger: FindCombatScript 返回的指令涉及的角色名与当前队伍角色取交集后为空,即所有战斗脚本的角色都不在当前队伍里(且不支持“当前角色”写法)。
Common situations: 战斗脚本目录里的txt脚本与实际上场队伍不匹配,例如脚本写的是别的队伍角色名。
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/ce22beebb3ef5e6a.
Report an issue: GitHub.