Hey Geez, Hey Arkensor,
here are the current bugs/mistakes in the **SCR_ScenarioFrameworkSystemSerializer:**
1: -------------------
```
class SCR_ScenarioFrameworkSlotAISave : SCR_ScenarioFrameworkLayerSave **(This is wrong, because SlotAI is SlotBase and not layerBase)**
class SCR_ScenarioFrameworkSlotAISave : SCR_ScenarioFrameworkSlotSave (Fixed)
```
2: -------------------
The LogicCounter will always saved with an empty string as name. This will not work, because if we do not have an entity name, the count will not read from the Serializer
```
class SCR_ScenarioFrameworkLogicCounterSave : SCR_ScenarioFrameworkLogicSave
{
override void Read(PersistenceSystem persistence, SCR_ScenarioFrameworkLogic logic)
{
**we need to call a super or ---> m_sName = logic.GetName();**
m_iCounterValue = SCR_ScenarioFrameworkLogicCounter.Cast(logic).GetCounterValue();
The LogicCounter will always saved with an **empty string as name**. This will not work, because if we do not have an entity name, the count will not read from the Serializer.
i rewritten this class as follows:
```
modded class SCR_ScenarioFrameworkLogicCounterSave : SCR_ScenarioFrameworkLogicSave
{
//------------------------------------------------------------------------------------------------
override void Read(PersistenceSystem persistence, SCR_ScenarioFrameworkLogic logic)
{
m_sName = logic.GetName();
m_bIsTerminated = logic.GetIsTerminated();
m_iCounterValue = SCR_ScenarioFrameworkLogicCounter.Cast(logic).GetCounterValue();
SCR_ScenarioFrameworkActionSave.ReadActions(persistence, logic.m_aActions, m_aActions);
}
//------------------------------------------------------------------------------------------------
override SCR_ScenarioFrameworkLogic Write(PersistenceSystem persistence, SCR_ScenarioFrameworkSystem scenarioFrameworkSystem)
{
if(m_sName.IsEmpty()) return null;
SCR_ScenarioFrameworkLogic logic = SCR_ScenarioFrameworkLogic.Cast(GetGame().GetWorld().FindEntityByName(m_sName));
if(!logic) return null;
if(m_bIsTerminated) logic.SetIsTerminated(true);
SCR_ScenarioFrameworkActionSave.WriteActions(persistence, scenarioFrameworkSystem, m_aActions, logic.m_aActions);
auto counter = SCR_ScenarioFrameworkLogicCounter.Cast(logic);
if(counter) counter.SetCounterValue(m_iCounterValue);
return logic;
}
//------------------------------------------------------------------------------------------------
override bool SerializationSave(BaseSerializationSaveContext context)
{
context.Write(m_sName);
context.WriteDefault(m_bIsTerminated, false);
context.WriteDefault(m_iCounterValue, 0);
if (!context.CanSeekMembers() || !m_aActions.IsEmpty()) context.Write(m_aActions);
return true;
}
//------------------------------------------------------------------------------------------------
override bool SerializationLoad(BaseSerializationLoadContext context)
{
context.Read(m_sName);
context.ReadDefault(m_bIsTerminated, false);
context.Read(m_iCounterValue);
if(!context.Read(m_aActions) && !context.CanSeekMembers()) return false;
return true;
}
}
```
3: -------------------
```
class SCR_ScenarioFrameworkSlotAI : SCR_ScenarioFrameworkSlotBase
{
override bool InitOtherThings()
{
m_aWaypoints.Clear();
m_AIGroup = null; **<------------------------ need to be removed! Otherwise the group from the serializer will removed and the group is spawning twice!**
m_iCurrentlySpawnedWaypoints = 0;
m_bWaypointsInitialized = false;
SCR_AIGroup.IgnoreSpawning(true);
if (m_eActivationType == SCR_ScenarioFrameworkEActivationType.SAME_AS_PARENT && m_WaypointSet && !m_WaypointSet.m_aLayerName.IsEmpty())
InitWaypoints();
return super.InitOtherThings();
}
}
```