Hello, was wondering if anyone here could help with my enfusion script struggles
i'm trying to get the headquarters in a conflict game to check which side is which
this is my code
protected ref array<SCR_MilitaryBaseComponent> m_aHeadquarters;
Print("[DF_AutoTurretFactionInjector] Search HQs");
GetGame().GetWorld().QueryEntitiesBySphere(vector.Zero, 9999999, HQQueryEntitiesCallbackMethod, null);
Print("[DF_AutoTurretFactionInjector] Found " + m_aHeadquarters.Count() + " HQs");
and the query callback for the entitiesbysphere call
protected bool HQQueryEntitiesCallbackMethod(IEntity e)
{
if (!e)
return false;
Print("[DF_AutoTurretFactionInjector] hq a");
SCR_CampaignMilitaryBaseComponent hq = SCR_CampaignMilitaryBaseComponent.Cast(e.FindComponent(SCR_CampaignMilitaryBaseComponent));
if(!hq || !hq.IsHQ())
return false;
Print("[DF_AutoTurretFactionInjector] hq b");
m_aHeadquarters.Insert(hq);
return true;
}
(the log outputs 2x hq a, nothing after)
Pretty sure I'm doing something wrong in the query callback, but what...
Help would be much appreciated 🙂