I believe the problems lies in SCR_AIStaticArtilleryBehavior.OnActionDeselected() which calls agent.AllowMaxLOD(). The function assumes that the AI was allowed max LOD before starting artillery behaviour. Instead it should check whether AI is allowed max LOD prior to start of behaviour, and then skip agent.AllowMaxLOD() in case it was not.
Description
Description
Details
Details
- Severity
- Minor
- Resolution
- Open
- Reproducibility
- Always
- Operating System
- Windows 11 x64
- Category
- AI Issues
Steps To Reproduce
- Add SlotAI with character to scene
- Add Mortar prefab + ammo to scene
- Add DisableLOD action to AI
- Add waypoints to make AI get in mortar and fire it somewhere repeatably
- Play scene and observe AI with binoculars from ~1km distance (so AI should disappear if max LOD allowed)
AI will spawn and be visible at first. If you look away for some time and back again the AI is no longer rendered.
Event Timeline
Comment Actions
As for fixing it myself, is there any current method for checking if an AIAgent is allowed max LOD? I don't see one in AIAgent.c, so my current workaround is a looped WaitAndExecute that just reapplies DisableLOD constantly.
Comment Actions
My new workaround
modded class SCR_ChimeraAIAgent { bool m_bPreventMaxLODActual = false; } [BaseContainerProps(), SCR_ContainerAIActionTitle()] modded class SCR_ScenarioFrameworkAIActionDisableLOD { override void OnActivate() { super.OnActivate(); if (!m_bDisableLOD) return; array<AIAgent> agents = {}; m_AIGroup.GetAgents(agents); m_AIGroup.m_bPreventMaxLODActual = true; foreach (AIAgent agent : agents) { SCR_ChimeraAIAgent chimeraAgent = SCR_ChimeraAIAgent.Cast(agent); if (chimeraAgent) chimeraAgent.m_bPreventMaxLODActual = true; } } } modded class SCR_AIStaticArtilleryBehavior { override void OnActionDeselected() { AIAgent agent = m_Utility.GetOwner(); SCR_ChimeraAIAgent chimeraAgent = SCR_ChimeraAIAgent.Cast(agent); if (chimeraAgent && chimeraAgent.m_bPreventMaxLODActual) return; agent.AllowMaxLOD(); } }